Skip to content
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

build: migrate to Yarn v3 #2913

Merged
merged 40 commits into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
56f64f4
chore: set up yarn v2
AlCalzone Jun 25, 2021
885c7f7
chore: migrate lockfile
AlCalzone Jun 25, 2021
d8fedb5
chore: migrate to new commands
AlCalzone Jun 25, 2021
c109e7a
chore: add typescript plugin
AlCalzone Jun 25, 2021
6882267
chore: add typescript to all sub-packages
AlCalzone Jun 26, 2021
445b4db
chore: add dependencies to all sub-packages
AlCalzone Jun 26, 2021
48bd283
chore: switch to plug-n-play
AlCalzone Jun 26, 2021
e7ef1a8
chore: enable VSCode support for PnP
AlCalzone Jun 26, 2021
032129b
fix: migrate to yarn v3, fix build errors
AlCalzone Jun 26, 2021
b4aa4da
fix: update lockfile
AlCalzone Jun 27, 2021
bbaadbc
ci: fix yarn cache dir
AlCalzone Jun 27, 2021
01282d7
fix: don't test on Node 10
AlCalzone Jun 27, 2021
1b14f99
build: replace lerna run with yarn run-all
AlCalzone Jun 27, 2021
259a307
fix: delete yarn pnp entrypoint
AlCalzone Jun 27, 2021
c1a2c7c
fix: switch to global cache
AlCalzone Jun 27, 2021
2d936c9
fix: build
AlCalzone Jun 27, 2021
d834eee
fix: run-deps command
AlCalzone Jun 27, 2021
6d2f0ee
fix: don't separate subpackage scripts with a ":"
AlCalzone Jun 27, 2021
e89bb73
fix: add "ghost" dependencies used by tests
AlCalzone Jun 27, 2021
56ea582
fix: recursive build script
AlCalzone Jun 27, 2021
eb20fcb
build: link all packages using workspace URLs
AlCalzone Jun 27, 2021
5085a05
fix: patch ts-morph's resolution
AlCalzone Jun 28, 2021
2d759db
ci: fix test command
AlCalzone Jun 28, 2021
17c5685
ci: exclude matrix from cache config
AlCalzone Jun 28, 2021
e60e83b
chore: add yarn release workflow
AlCalzone Jun 28, 2021
358147b
Merge branch 'master' into yarn-v2
AlCalzone Jun 29, 2021
a229d21
test: before release-script test
AlCalzone Jun 29, 2021
98dace6
chore: get rid of most lerna stuff
AlCalzone Jun 29, 2021
ff326c0
fix: remove stray `exec`
AlCalzone Jun 30, 2021
2aed16c
fix: use published version of @alcalzone/release-script
AlCalzone Jun 30, 2021
74307df
Merge branch 'next' into yarn-v2
AlCalzone Jun 30, 2021
a1ab82f
ci: use yarn to publish PR test builds
AlCalzone Jun 30, 2021
406e828
docs: update the install guide not to mention lerna
AlCalzone Jun 30, 2021
fc92e0a
fix: some bug in ESBuild
AlCalzone Jun 30, 2021
705e50b
chore: use v2 of setup-node action and simplify caching
AlCalzone Jul 1, 2021
bb02504
chore: back to explicit versions
AlCalzone Jul 1, 2021
8cd07b4
build: remove workaround for ESBuild bug
AlCalzone Jul 1, 2021
eff57e0
build: back to lerna for now
AlCalzone Jul 1, 2021
12e8abf
Merge branch 'next' into yarn-v2
AlCalzone Jul 1, 2021
28ff20b
chore: update changelog
AlCalzone Jul 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ indent_style = tab
indent_size = 4

# space indentation for some specific files
[{package.json,lerna.json}]
[{package.json}]
indent_style = space
indent_size = 2

Expand Down
80 changes: 40 additions & 40 deletions .github/workflows-disabled/approve-workflow-runs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch: {}
schedule:
# every 5 minutes
- cron: '*/5 * * * *'
- cron: '*/5 * * * *'

jobs:
approve-workflows:
Expand All @@ -16,42 +16,42 @@ jobs:
node-version: [14.x] # This should be LTS

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile

- name: Check and approve workflows
uses: actions/github-script@v3
with:
github-token: ${{secrets.BOT_TOKEN}}
script: |
const bot = require(`${process.env.GITHUB_WORKSPACE}/.github/bot-scripts/index.js`);
const workflows = [
".github/workflows/generate-docs.yml",
".github/workflows/test-and-release.yml",
".github/workflows/codeql-analysis.yml"
];
const whitelist = [
"packages/config/config/**/*.json"
];
return bot.approveWorkflows({github, context, workflows, whitelist});
- name: Checkout code
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-

- name: Install dependencies
run: yarn install --immutable

- name: Check and approve workflows
uses: actions/github-script@v3
with:
github-token: ${{secrets.BOT_TOKEN}}
script: |
const bot = require(`${process.env.GITHUB_WORKSPACE}/.github/bot-scripts/index.js`);
const workflows = [
".github/workflows/generate-docs.yml",
".github/workflows/test-and-release.yml",
".github/workflows/codeql-analysis.yml"
];
const whitelist = [
"packages/config/config/**/*.json"
];
return bot.approveWorkflows({github, context, workflows, whitelist});
8 changes: 4 additions & 4 deletions .github/workflows/cc-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ jobs:

- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
yarn-

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
run: yarn install --immutable

- name: Compile TypeScript code
run: yarn run build
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ jobs:

- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
yarn-

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
run: yarn install --immutable

- name: Compile TypeScript code
run: yarn run build
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/nightly-config-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ jobs:
# ===============================

npm i -g yarn
yarn install --frozen-lockfile
yarn install --immutable

# ===============================
# Double-check changes with lerna
# Double-check changes
# ===============================

# Verify that only @zwave-js/config and zwave-js are changed
LERNA_CHANGED=$(npx lerna changed)
if [[ $(echo -e "@zwave-js/config\nzwave-js") != "$LERNA_CHANGED" ]]; then
echo "❌ Lerna detected unexpected package changes, aborting..."
WORKSPACE_CHANGED=$(yarn version check | grep "has been modified" | cut -d" " -f3 | sed -E "s/@workspace.+//")
if [[ $(echo -e "@zwave-js/config\nzwave-js") != "$WORKSPACE_CHANGED" ]]; then
echo "❌ Detected unexpected package changes, aborting..."
echo "These packages are changed:"
echo "$LERNA_CHANGED"
echo "$WORKSPACE_CHANGED"
exit 0
fi

Expand All @@ -73,7 +73,7 @@ jobs:
# ===============================

# Create a clean build
npx lerna run build
yarn run-deps build

# Lint config files
yarn run lint:config
Expand All @@ -82,14 +82,10 @@ jobs:
# Bump the version and publish
# ===============================

cd packages/config
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
npm whoami

# Figure out next version
cat > ./script.js << 'EOF'
const semver = require("semver");
let v = require("../config/package.json").version;
let v = require("@zwave-js/config/package.json").version;
const now = new Date();
const today = new Date(now.getTime() - now.getTimezoneOffset()*60000);
const dateStr = today.toISOString().split("T")[0].replace(/-/g, "");
Expand All @@ -108,5 +104,9 @@ jobs:

VERSION=$(node script.js)
echo "Next version is $VERSION"
npm version "$VERSION" --ignore-scripts --no-git-tag-version
npm publish
yarn workspace @zwave-js/config version "$VERSION"

yarn config set npmPublishRegistry 'https://registry.npmjs.org'
yarn config set 'npmRegistries["//registry.npmjs.org"].npmAuthToken' "${{ secrets.NPM_TOKEN }}"
yarn npm whoami
yarn workspace @zwave-js/config npm publish
65 changes: 33 additions & 32 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ jobs:

- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
yarn-

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
run: yarn install --immutable

- name: Compile TypeScript code
run: npx lerna run build
run: yarn run-all build

- name: Run linters
run: yarn run lint
Expand Down Expand Up @@ -111,22 +111,22 @@ jobs:

- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
yarn-

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
run: yarn install --immutable

- name: Compile TypeScript code
run: npx lerna run build
run: yarn run-all build

- name: Lint config files
run: yarn run lint:config
Expand All @@ -142,7 +142,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]
node-version: [12.x, 14.x, 16.x]
os: [ubuntu-latest]

steps:
Expand All @@ -156,19 +156,19 @@ jobs:

- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
yarn-

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
run: yarn install --immutable

# Compilation is necessary, or the tests won't run
- name: Compile TypeScript code
Expand Down Expand Up @@ -201,26 +201,26 @@ jobs:

- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
yarn-

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
run: yarn install --immutable

# Do a full build so the package files are regenerated
- name: Compile TypeScript code
run: yarn run build:full

- name: Import main entry point
run: node -e 'require("./packages/zwave-js")'
run: yarn node -e 'require("./packages/zwave-js")'

# ===================

Expand Down Expand Up @@ -249,19 +249,19 @@ jobs:

- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
yarn-

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
run: yarn install --immutable

# Compilation is necessary, or the tests won't run
- name: Compile TypeScript code
Expand Down Expand Up @@ -318,28 +318,29 @@ jobs:

- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
yarn-

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
run: yarn install --immutable

- name: Create a clean build
run: yarn run build:full

- name: Publish package to npm
- name: Publish packages to npm
run: |
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
npm whoami
npx lerna publish from-package --yes
yarn config set npmPublishRegistry 'https://registry.npmjs.org'
yarn config set 'npmRegistries["//registry.npmjs.org"].npmAuthToken' "${{ secrets.NPM_TOKEN }}"
yarn npm whoami
yarn workspaces foreach exec npm publish --tolerate-republish
AlCalzone marked this conversation as resolved.
Show resolved Hide resolved

- name: Create Github Release
uses: actions/create-release@v1
Expand Down
Loading