Skip to content

Commit ab0ebca

Browse files
authored
Synchronise package with module template (July 2023) (MetaMask#98)
* Synchronise package with module template (July 2023) * Update pull request template * Update coverage
1 parent 8b3f5bc commit ab0ebca

23 files changed

+2908
-1166
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+
}

.eslintrc.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,18 @@ module.exports = {
1919

2020
{
2121
files: ['*.test.ts', '*.test.js'],
22-
extends: ['@metamask/eslint-config-jest'],
22+
extends: [
23+
'@metamask/eslint-config-jest',
24+
'@metamask/eslint-config-nodejs',
25+
],
2326
},
2427
],
2528

26-
ignorePatterns: ['!.eslintrc.js', '!.prettierrc.js', 'dist/', 'docs/'],
29+
ignorePatterns: [
30+
'!.eslintrc.js',
31+
'!.prettierrc.js',
32+
'dist/',
33+
'docs/',
34+
'.yarn/',
35+
],
2736
};

.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: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
- name: Install Yarn dependencies
1818
run: yarn --immutable
1919

20-
build:
21-
name: Build
20+
build-source:
21+
name: Build source
2222
runs-on: ubuntu-latest
2323
needs:
2424
- prepare
2525
strategy:
2626
matrix:
27-
node-version: [16.x, 18.x, 19.x]
27+
node-version: [16.x, 18.x, 20.x]
2828
steps:
2929
- uses: actions/checkout@v3
3030
- name: Use Node.js ${{ matrix.node-version }}
@@ -33,7 +33,32 @@ jobs:
3333
node-version: ${{ matrix.node-version }}
3434
cache: 'yarn'
3535
- run: yarn --immutable --immutable-cache
36-
- run: yarn build
36+
- run: yarn build:source
37+
- name: Require clean working directory
38+
shell: bash
39+
run: |
40+
if ! git diff --exit-code; then
41+
echo "Working tree dirty at end of job"
42+
exit 1
43+
fi
44+
45+
build-types:
46+
name: Build types
47+
runs-on: ubuntu-latest
48+
needs:
49+
- prepare
50+
strategy:
51+
matrix:
52+
node-version: [16.x, 18.x, 20.x]
53+
steps:
54+
- uses: actions/checkout@v3
55+
- name: Use Node.js ${{ matrix.node-version }}
56+
uses: actions/setup-node@v3
57+
with:
58+
node-version: ${{ matrix.node-version }}
59+
cache: 'yarn'
60+
- run: yarn --immutable --immutable-cache
61+
- run: yarn build:types
3762
- name: Require clean working directory
3863
shell: bash
3964
run: |
@@ -49,7 +74,7 @@ jobs:
4974
- prepare
5075
strategy:
5176
matrix:
52-
node-version: [16.x, 18.x, 19.x]
77+
node-version: [16.x, 18.x, 20.x]
5378
steps:
5479
- uses: actions/checkout@v3
5580
- name: Use Node.js ${{ matrix.node-version }}
@@ -80,7 +105,7 @@ jobs:
80105
- prepare
81106
strategy:
82107
matrix:
83-
node-version: [16.x, 18.x, 19.x]
108+
node-version: [16.x, 18.x, 20.x]
84109
steps:
85110
- uses: actions/checkout@v3
86111
- name: Use Node.js ${{ matrix.node-version }}

.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:

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,4 @@ jobs:
7474
secrets:
7575
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
7676
PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }}
77+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/publish-release.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
secrets:
66
NPM_TOKEN:
77
required: true
8+
SLACK_WEBHOOK_URL:
9+
required: true
810
PUBLISH_DOCS_TOKEN:
911
required: true
1012

@@ -21,7 +23,7 @@ jobs:
2123
uses: actions/setup-node@v3
2224
with:
2325
node-version-file: '.nvmrc'
24-
- uses: MetaMask/action-publish-release@v2
26+
- uses: MetaMask/action-publish-release@v3
2527
env:
2628
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2729
- name: Install
@@ -52,7 +54,10 @@ jobs:
5254
key: ${{ github.sha }}
5355
- name: Dry Run Publish
5456
# omit npm-token token to perform dry run publish
55-
uses: MetaMask/action-npm-publish@v2
57+
uses: MetaMask/action-npm-publish@v4
58+
with:
59+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
60+
subteam: S042S7RE4AE # @metamask-npm-publishers
5661
env:
5762
SKIP_PREPACK: true
5863

.swcrc.build.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://json.schemastore.org/swcrc",
3+
"jsc": {
4+
"parser": {
5+
"syntax": "typescript"
6+
},
7+
"target": "es2020"
8+
},
9+
"sourceMaps": true,
10+
"exclude": [
11+
".*__fixtures__.*",
12+
".*__mocks__.*",
13+
".*__snapshots__.*",
14+
".*__tests?__.*",
15+
".*\\.test\\.?.*\\.tsx?",
16+
".*\\.d\\.tsx?"
17+
]
18+
}

.yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module.exports = {
44
name: "@yarnpkg/plugin-allow-scripts",
55
factory: function (require) {
6-
var plugin=(()=>{var a=Object.create,l=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var u=e=>l(e,"__esModule",{value:!0});var f=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var g=(e,o)=>{for(var r in o)l(e,r,{get:o[r],enumerable:!0})},m=(e,o,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of s(o))!c.call(e,t)&&t!=="default"&&l(e,t,{get:()=>o[t],enumerable:!(r=i(o,t))||r.enumerable});return e},x=e=>m(u(l(e!=null?a(p(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var k={};g(k,{default:()=>d});var n=x(f("@yarnpkg/shell")),y={hooks:{afterAllInstalled:async()=>{let e=await(0,n.execute)("yarn run allow-scripts");e!==0&&process.exit(e)}}},d=y;return k;})();
6+
var plugin=(()=>{var l=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(o,e)=>(typeof require<"u"?require:o)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var u=(t,o)=>{for(var e in o)l(t,e,{get:o[e],enumerable:!0})},f=(t,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of a(o))!c.call(t,i)&&i!==e&&l(t,i,{get:()=>o[i],enumerable:!(r=s(o,i))||r.enumerable});return t};var m=t=>f(l({},"__esModule",{value:!0}),t);var g={};u(g,{default:()=>d});var n=p("@yarnpkg/shell"),x={hooks:{afterAllInstalled:async()=>{let t=await(0,n.execute)("yarn run allow-scripts");t!==0&&process.exit(t)}}},d=x;return m(g);})();
77
return plugin;
88
}
99
};

.yarn/plugins/@yarnpkg/plugin-constraints.cjs

Lines changed: 52 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)