-
-
Notifications
You must be signed in to change notification settings - Fork 64
Standardize repo from module template #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3950155
Standardize repo from module template
mcmire a6feec1
add dist/.gitkeep to fix prebuild linting
legobeat 62f55e7
Copy recent updates to module template
mcmire 5123cba
Build right before linting
mcmire 6ac77fc
Revert "add dist/.gitkeep to fix prebuild linting"
mcmire File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "ignores": [ | ||
| "@lavamoat/allow-scripts", | ||
| "@metamask/auto-changelog", | ||
| "@types/*", | ||
| "prettier-plugin-packagejson", | ||
| "ts-node", | ||
| "typedoc" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,44 @@ | ||
| module.exports = { | ||
| parserOptions: { | ||
| ecmaVersion: 2018, | ||
| }, | ||
| extends: [ | ||
| '@metamask/eslint-config', | ||
| '@metamask/eslint-config/config/nodejs', | ||
| ], | ||
| plugins: [ | ||
| 'json', | ||
| ], | ||
| globals: { | ||
| window: true, | ||
| }, | ||
| ignorePatterns: [ | ||
| '!.eslintrc.js', | ||
| 'node_modules/', | ||
| 'dist/', | ||
| ], | ||
| root: true, | ||
|
|
||
| extends: ['@metamask/eslint-config'], | ||
|
|
||
| rules: {}, | ||
|
|
||
| overrides: [ | ||
| { | ||
| files: ['*.ts'], | ||
| extends: [ | ||
| '@metamask/eslint-config/config/typescript', | ||
| '@metamask/eslint-config-browser', | ||
| '@metamask/eslint-config-typescript', | ||
| ], | ||
| }, | ||
|
|
||
| { | ||
| files: [ | ||
| '.eslintrc.js', | ||
| ], | ||
| files: ['*.js'], | ||
| parserOptions: { | ||
| sourceType: 'script', | ||
| }, | ||
| extends: ['@metamask/eslint-config-nodejs'], | ||
| rules: { | ||
| 'id-length': [ | ||
| 'error', | ||
| { | ||
| min: 2, | ||
| properties: 'never', | ||
| // "t" is an acceptable variable name in Tape tests. | ||
| exceptionPatterns: ['_', 'a', 'b', 'i', 'j', 'k', 't'], | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| ], | ||
| } | ||
|
|
||
| ignorePatterns: [ | ||
| '!.eslintrc.js', | ||
| '!.prettierrc.js', | ||
| 'dist/', | ||
| 'docs/', | ||
| '.yarn/', | ||
| ], | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| * text=auto | ||
|
|
||
| yarn.lock linguist-generated=false | ||
|
|
||
| # yarn v3 | ||
| # See: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored | ||
| /.yarn/releases/** binary | ||
| /.yarn/plugins/** binary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <!-- | ||
| Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: | ||
|
|
||
| * What is the current state of things and why does it need to change? | ||
| * What is the solution your changes offer and how does it work? | ||
|
|
||
| Are there any issues or other links reviewers should consult to understand this pull request better? For instance: | ||
|
|
||
| * Fixes #12345 | ||
| * See: #67890 | ||
| --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: Build, Lint, and Test | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| prepare: | ||
| name: Prepare | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Use Node.js | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: 'yarn' | ||
| - name: Install Yarn dependencies | ||
| run: yarn --immutable | ||
|
|
||
| lint: | ||
| name: Lint | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - prepare | ||
| strategy: | ||
| matrix: | ||
| node-version: [14.x, 16.x, 18.x, 19.x] | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| cache: 'yarn' | ||
| - run: yarn --immutable --immutable-cache | ||
| - run: yarn build | ||
| - run: yarn lint | ||
| - name: Validate RC changelog | ||
| if: ${{ startsWith(github.head_ref, 'release/') }} | ||
| run: yarn auto-changelog validate --rc | ||
| - name: Validate changelog | ||
| if: ${{ !startsWith(github.head_ref, 'release/') }} | ||
| run: yarn auto-changelog validate | ||
| - name: Require clean working directory | ||
| shell: bash | ||
| run: | | ||
| if ! git diff --exit-code; then | ||
| echo "Working tree dirty at end of job" | ||
| exit 1 | ||
| fi | ||
|
|
||
| test: | ||
| name: Test | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - prepare | ||
| strategy: | ||
| matrix: | ||
| node-version: [14.x, 16.x, 18.x, 19.x] | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| cache: 'yarn' | ||
| - run: yarn --immutable --immutable-cache | ||
| - run: yarn test | ||
| - name: Require clean working directory | ||
| shell: bash | ||
| run: | | ||
| if ! git diff --exit-code; then | ||
| echo "Working tree dirty at end of job" | ||
| exit 1 | ||
| fi |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| name: Main | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| check-workflows: | ||
| name: Check workflows | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Download actionlint | ||
| id: download-actionlint | ||
| run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.23 | ||
| shell: bash | ||
| - name: Check workflow files | ||
| run: ${{ steps.download-actionlint.outputs.executable }} -color | ||
| shell: bash | ||
|
|
||
| build-lint-test: | ||
| name: Build, lint, and test | ||
| uses: ./.github/workflows/build-lint-test.yml | ||
|
|
||
| all-jobs-completed: | ||
| name: All jobs completed | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - check-workflows | ||
| - build-lint-test | ||
| outputs: | ||
| PASSED: ${{ steps.set-output.outputs.PASSED }} | ||
| steps: | ||
| - name: Set PASSED output | ||
| id: set-output | ||
| run: echo "PASSED=true" >> "$GITHUB_OUTPUT" | ||
|
|
||
| all-jobs-pass: | ||
| name: All jobs pass | ||
| if: ${{ always() }} | ||
| runs-on: ubuntu-latest | ||
| needs: all-jobs-completed | ||
| steps: | ||
| - name: Check that all jobs have passed | ||
| run: | | ||
| passed="${{ needs.all-jobs-completed.outputs.PASSED }}" | ||
| if [[ $passed != "true" ]]; then | ||
| exit 1 | ||
| fi | ||
|
|
||
| is-release: | ||
| # Filtering by `push` events ensures that we only release from the `main` branch, which is a | ||
| # requirement for our npm publishing environment. | ||
| # The commit author should always be 'github-actions' for releases created by the | ||
| # 'create-release-pr' workflow, so we filter by that as well to prevent accidentally | ||
| # triggering a release. | ||
| if: github.event_name == 'push' && startsWith(github.event.head_commit.author.name, 'github-actions') | ||
| needs: all-jobs-pass | ||
| outputs: | ||
| IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: MetaMask/action-is-release@v1 | ||
| id: is-release | ||
|
|
||
| publish-release: | ||
| needs: is-release | ||
| if: needs.is-release.outputs.IS_RELEASE == 'true' | ||
| name: Publish release | ||
| permissions: | ||
| contents: write | ||
| uses: ./.github/workflows/publish-release.yml | ||
| secrets: | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: Publish docs to GitHub Pages | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| destination_dir: | ||
| required: true | ||
| type: string | ||
| secrets: | ||
| PUBLISH_DOCS_TOKEN: | ||
| required: true | ||
|
|
||
| jobs: | ||
| publish-docs-to-gh-pages: | ||
| name: Publish docs to GitHub Pages | ||
| runs-on: ubuntu-latest | ||
| environment: github-pages | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Ensure `destination_dir` is not empty | ||
| if: ${{ inputs.destination_dir == '' }} | ||
| run: exit 1 | ||
| - name: Checkout the repository | ||
| uses: actions/checkout@v3 | ||
| - name: Use Node.js | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: 'yarn' | ||
| - name: Install npm dependencies | ||
| run: yarn --immutable | ||
| - name: Run build script | ||
| run: yarn build:docs | ||
| - name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch | ||
| uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935 | ||
| with: | ||
| # This `PUBLISH_DOCS_TOKEN` needs to be manually set per-repository. | ||
| # Look in the repository settings under "Environments", and set this token in the `github-pages` environment. | ||
| personal_token: ${{ secrets.PUBLISH_DOCS_TOKEN }} | ||
| publish_dir: ./docs | ||
| destination_dir: ${{ inputs.destination_dir }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will also need a
PUBLISH_DOCS_TOKENin order to merge this pull request.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been setup