-
Notifications
You must be signed in to change notification settings - Fork 16
Upgrade node version to v18-20 and yarn to v3 #600
Changes from all commits
8440ceb
4be93e4
be3a5bc
3013b67
b29cffe
474748b
e66dac8
27030c5
928dcb3
6927bc2
d5cd491
478abc2
a7b1502
405e1e5
3a63e52
69cb4b3
1708fd1
2583a76
d82a223
adf926e
b68ad00
c634a8d
53a1011
96473c6
7e4e97b
cb1a715
6670fa5
cbb2654
1371482
07f5c43
f8d7d67
7b41001
4e20e78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ jobs: | |
- run: | ||
name: Postinstall | ||
command: | | ||
yarn setup | ||
yarn | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
|
@@ -48,7 +48,7 @@ jobs: | |
at: . | ||
- run: | ||
name: build:storybook | ||
command: yarn build-storybook | ||
command: yarn build:storybook | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
#!/usr/bin/env node | ||
const fetch = require('node-fetch'); | ||
|
||
start().catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); | ||
|
||
async function start() { | ||
const fetch = (await import('node-fetch')).default; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
const { | ||
GITHUB_COMMENT_TOKEN, | ||
CIRCLE_PULL_REQUEST, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"ignores": [ | ||
"@lavamoat/allow-scripts", | ||
"@lavamoat/preinstall-always-fail", | ||
"@metamask/auto-changelog", | ||
"@types/*", | ||
"prettier-plugin-packagejson", | ||
"ts-node", | ||
"@storybook/addon-actions", | ||
"@storybook/react-webpack5", | ||
"babel-loader", | ||
"rimraf", | ||
"sass", | ||
"webpack", | ||
"@yarnpkg/core", | ||
"@yarnpkg/cli", | ||
"clipanion", | ||
"@yarnpkg/fslib" | ||
Comment on lines
+15
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @mcmire I'm not sure why buy when I run
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes sense. All of these dependencies are used by Yarn, and |
||
] | ||
} |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -6,22 +6,30 @@ module.exports = { | |||
files: ['*.ts'], | ||||
extends: ['@metamask/eslint-config-typescript'], | ||||
}, | ||||
|
||||
{ | ||||
files: ['*.js'], | ||||
parserOptions: { | ||||
sourceType: 'script', | ||||
}, | ||||
extends: ['@metamask/eslint-config-nodejs'], | ||||
}, | ||||
|
||||
{ | ||||
files: ['*.test.ts', '*.test.js'], | ||||
extends: ['@metamask/eslint-config-jest'], | ||||
extends: [ | ||||
'@metamask/eslint-config-jest', | ||||
'@metamask/eslint-config-nodejs', | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Installed design-tokens
|
||||
], | ||||
}, | ||||
], | ||||
|
||||
ignorePatterns: [ | ||||
'!.eslintrc.js', | ||||
'!.prettierrc.js', | ||||
'dist/', | ||||
'storybook-static/', | ||||
'.yarn/', | ||||
'storybook-static', | ||||
'docs/utils/getCSSVariablesFromStylesheet.ts', // TODO: Fix the types in this file | ||||
Comment on lines
+31
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. matches module template with inclusion of storybook and this util |
||||
], | ||||
}; |
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updates broken link to match module-template |
||
|
||
version: 2 | ||
updates: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
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 | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
needs: | ||
- prepare | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
- run: yarn --immutable --immutable-cache | ||
- run: yarn build | ||
- 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 | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
needs: | ||
- prepare | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
- run: yarn --immutable --immutable-cache | ||
- run: yarn lint | ||
- name: Validate RC changelog | ||
if: ${{ startsWith(github.head_ref, 'release/') }} | ||
run: yarn lint:changelog --rc | ||
- name: Validate changelog | ||
if: ${{ !startsWith(github.head_ref, 'release/') }} | ||
run: yarn lint:changelog | ||
- 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: [18.x, 20.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 | ||
|
||
compatibility-test: | ||
name: Compatibility test | ||
runs-on: ubuntu-latest | ||
needs: | ||
- prepare | ||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.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: rm yarn.lock && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn | ||
- run: yarn test | ||
- name: Require clean working directory | ||
shell: bash | ||
run: | | ||
git restore yarn.lock | ||
if ! git diff --exit-code; then | ||
echo "Working tree dirty at end of job" | ||
exit 1 | ||
fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copy and pasting from module template and renaming |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ on: | |
default: 'main' | ||
required: true | ||
release-type: | ||
description: 'A SemVer version diff, i.e. major, minor, patch, prerelease etc. Mutually exclusive with "release-version".' | ||
description: 'A SemVer version diff, i.e. major, minor, or patch. Mutually exclusive with "release-version".' | ||
required: false | ||
release-version: | ||
description: 'A specific version to bump to. Mutually exclusive with "release-type".' | ||
|
@@ -21,30 +21,21 @@ jobs: | |
contents: write | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
# This is to guarantee that the most recent tag is fetched. | ||
# This can be configured to a more reasonable value by consumers. | ||
fetch-depth: 0 | ||
# We check out the specified branch, which will be used as the base | ||
# branch for all git operations and the release PR. | ||
ref: ${{ github.event.inputs.base-branch }} | ||
- name: Get Node.js version | ||
id: nvm | ||
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc) | ||
- uses: actions/setup-node@v2 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ steps.nvm.outputs.NODE_VERSION }} | ||
- uses: MetaMask/action-create-release-pr@v1 | ||
node-version-file: '.nvmrc' | ||
- uses: MetaMask/action-create-release-pr@v3 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
release-type: ${{ github.event.inputs.release-type }} | ||
release-version: ${{ github.event.inputs.release-version }} | ||
artifacts-path: gh-action__release-authors | ||
# Upload the release author artifact for use in subsequent workflows | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: release-authors | ||
path: gh-action__release-authors | ||
if-no-files-found: error | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
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.
The yarn setup script was previously used in our project as a means to include Lavamoat's allow-scripts. This was necessary at the time due to certain limitations in Lavamoat's developer experience. However, recent improvements in Lavamoat have eliminated these hindrances, particularly when updating dependencies.
As a result, the yarn setup script, which essentially ran yarn install and yarn allow-scripts, has become redundant. Many projects, including ours, are now moving away from using it.
In this pull request, we have removed every instance of the yarn setup script, as shown in the attached screenshot. This change simplifies our scripts and aligns with current best practices