Skip to content

Commit 1307906

Browse files
committed
Standardize with module template
- Bring GitHub workflows up to date - Bump our actions - Bump `gh-pages` action, which now requires setting PUBLISH_DOCS_TOKEN - Send release candidate notifications to Slack, which requires SLACK_WEBHOOK_URL - Update dotfiles - Update `.nvmrc` so we're always using the current LTS - Add Yarn constraints - Update build script to publish ESM and CJS versions, and split `tsconfig.json` into development and build versions - Downgrade Yarn to 3.2.1 to match module template - Upgrade ESLint packages and fix lint violations - Upgrade other dev dependencies
1 parent 10206bf commit 1307906

34 files changed

+3931
-2525
lines changed

.depcheckrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"ignores": [
3+
"@lavamoat/allow-scripts",
4+
"@lavamoat/preinstall-always-fail",
5+
"@metamask/auto-changelog",
6+
"@types/*",
7+
"prettier-plugin-packagejson",
8+
"ts-node",
9+
"typedoc"
10+
]
11+
}

.editorconfig

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
# http://editorconfig.org
21
root = true
32

43
[*]
5-
charset = utf-8
6-
end_of_line = lf
7-
indent_size = 2
84
indent_style = space
9-
insert_final_newline = true
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
108
trim_trailing_whitespace = true
11-
12-
[*.md]
13-
indent_size = 4
14-
trim_trailing_whitespace = false
9+
insert_final_newline = true

.eslintrc.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,11 @@ module.exports = {
2727
'id-length': 'off',
2828
'no-param-reassign': 'off',
2929
},
30-
ignorePatterns: ['!.eslintrc.js', 'test/*.js', 'dist'],
30+
ignorePatterns: [
31+
'!.eslintrc.js',
32+
'!.prettierrc.js',
33+
'dist/',
34+
'docs/',
35+
'.yarn/',
36+
],
3137
};

.gitattributes

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
* text=auto
22

3-
# Reviewing the lockfile contents is an important step in verifying that
4-
# we're using the dependencies we expect to be using
5-
package-lock.json linguist-generated=false
63
yarn.lock linguist-generated=false
74

85
# yarn v3

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Lines starting with '#' are comments.
22
# Each line is a file pattern followed by one or more owners.
33

4-
* @MetaMask/devs
4+
* @MetaMask/engineering

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Please see the documentation for all configuration options:
2-
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
33

44
version: 2
55
updates:

.github/pull_request_template.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!--
2+
Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes:
3+
4+
* What is the current state of things and why does it need to change?
5+
* What is the solution your changes offer and how does it work?
6+
7+
Are there any issues or other links reviewers should consult to understand this pull request better? For instance:
8+
9+
* Fixes #12345
10+
* See: #67890
11+
-->

.github/workflows/build-lint-test.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Build, Lint, and Test
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
prepare:
8+
name: Prepare
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Use Node.js
13+
uses: actions/setup-node@v3
14+
with:
15+
node-version-file: '.nvmrc'
16+
cache: 'yarn'
17+
- name: Install Yarn dependencies
18+
run: yarn --immutable
19+
20+
build:
21+
name: Build
22+
runs-on: ubuntu-latest
23+
needs:
24+
- prepare
25+
steps:
26+
- uses: actions/checkout@v3
27+
- name: Use Node.js
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version-file: '.nvmrc'
31+
cache: 'yarn'
32+
- run: yarn --immutable --immutable-cache
33+
- run: yarn build
34+
- name: Require clean working directory
35+
shell: bash
36+
run: |
37+
if ! git diff --exit-code; then
38+
echo "Working tree dirty at end of job"
39+
exit 1
40+
fi
41+
42+
lint:
43+
name: Lint
44+
runs-on: ubuntu-latest
45+
needs:
46+
- prepare
47+
steps:
48+
- uses: actions/checkout@v3
49+
- name: Use Node.js
50+
uses: actions/setup-node@v3
51+
with:
52+
node-version-file: '.nvmrc'
53+
cache: 'yarn'
54+
- run: yarn --immutable --immutable-cache
55+
- run: yarn lint
56+
- name: Validate RC changelog
57+
if: ${{ startsWith(github.head_ref, 'release/') }}
58+
run: yarn auto-changelog validate --rc
59+
- name: Validate changelog
60+
if: ${{ !startsWith(github.head_ref, 'release/') }}
61+
run: yarn auto-changelog validate
62+
- name: Require clean working directory
63+
shell: bash
64+
run: |
65+
if ! git diff --exit-code; then
66+
echo "Working tree dirty at end of job"
67+
exit 1
68+
fi
69+
70+
test:
71+
name: Test
72+
runs-on: ubuntu-latest
73+
needs:
74+
- prepare
75+
strategy:
76+
matrix:
77+
node-version: [16.x, 18.x, 20.x]
78+
steps:
79+
- uses: actions/checkout@v3
80+
- name: Use Node.js ${{ matrix.node-version }}
81+
uses: actions/setup-node@v3
82+
with:
83+
node-version: ${{ matrix.node-version }}
84+
cache: 'yarn'
85+
- run: yarn --immutable --immutable-cache
86+
- run: yarn test
87+
- name: Require clean working directory
88+
shell: bash
89+
run: |
90+
if ! git diff --exit-code; then
91+
echo "Working tree dirty at end of job"
92+
exit 1
93+
fi
94+
95+
compatibility-test:
96+
name: Compatibility test
97+
runs-on: ubuntu-latest
98+
needs:
99+
- prepare
100+
strategy:
101+
matrix:
102+
node-version: [16.x, 20.x]
103+
steps:
104+
- uses: actions/checkout@v3
105+
- name: Use Node.js ${{ matrix.node-version }}
106+
uses: actions/setup-node@v3
107+
with:
108+
node-version: ${{ matrix.node-version }}
109+
cache: 'yarn'
110+
- run: rm yarn.lock && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn
111+
- run: yarn test
112+
- name: Require clean working directory
113+
shell: bash
114+
run: |
115+
git restore yarn.lock
116+
if ! git diff --exit-code; then
117+
echo "Working tree dirty at end of job"
118+
exit 1
119+
fi

.github/workflows/build-test.yml

Lines changed: 0 additions & 148 deletions
This file was deleted.

.github/workflows/create-release-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
default: 'main'
99
required: true
1010
release-type:
11-
description: 'A SemVer version diff, i.e. major, minor, patch, prerelease etc. Mutually exclusive with "release-version".'
11+
description: 'A SemVer version diff, i.e. major, minor, or patch. Mutually exclusive with "release-version".'
1212
required: false
1313
release-version:
1414
description: 'A specific version to bump to. Mutually exclusive with "release-type".'
@@ -33,7 +33,7 @@ jobs:
3333
uses: actions/setup-node@v3
3434
with:
3535
node-version-file: '.nvmrc'
36-
- uses: MetaMask/action-create-release-pr@v1
36+
- uses: MetaMask/action-create-release-pr@v2
3737
env:
3838
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3939
with:

0 commit comments

Comments
 (0)