Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 7 additions & 22 deletions .github/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,17 @@ runs:
check-latest: true
cache: npm

- name: Get Node.js and npm version
id: node-version
- name: Install custom npm with linked strategy fix
run: |
echo "NODE_VERSION=$(node -v)" >> "$GITHUB_OUTPUT"
git clone --depth 1 --branch v11-gb-test https://github.com/manzoorwanijk/npm-cli.git /tmp/npm-cli
cd /tmp/npm-cli && node scripts/resetdeps.js
NPM_GLOBAL_DIR="$(npm root -g)/npm"
rm -rf "$NPM_GLOBAL_DIR"
ln -s /tmp/npm-cli "$NPM_GLOBAL_DIR"
npm --version
shell: bash

- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: '**/node_modules'
key: node_modules-${{ runner.os }}-${{ runner.arch }}-${{ steps.node-version.outputs.NODE_VERSION }}-${{ hashFiles('package-lock.json', 'patches/**') }}

- name: Install npm dependencies
if: ${{ steps.cache-node_modules.outputs.cache-hit != 'true' }}
run: |
npm ci
shell: bash
Expand All @@ -40,14 +36,3 @@ runs:
with:
name: npm-logs
path: C:\npm\cache\_logs

# On cache hit, we run the post-install script to match the native `npm ci` behavior.
# An example of this is to patch `node_modules` using patch-package.
- name: Post-install
if: ${{ steps.cache-node_modules.outputs.cache-hit == 'true' }}
run: |
# Run the post-install script for the root project.
npm run postinstall
# Run the post-install scripts for workspaces.
npx lerna run postinstall
shell: bash
18 changes: 18 additions & 0 deletions .github/workflows/build-plugin-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ jobs:
if: ${{ ! matrix.IS_GUTENBERG_PLUGIN }}
run: jq --tab '.wpPlugin.name = "wp"' package.json > package.json.tmp && mv package.json.tmp package.json

- name: Install custom npm with linked strategy fix
run: |
git clone --depth 1 --branch v11-gb-test https://github.com/manzoorwanijk/npm-cli.git /tmp/npm-cli
cd /tmp/npm-cli && node scripts/resetdeps.js
NPM_GLOBAL_DIR="$(npm root -g)/npm"
rm -rf "$NPM_GLOBAL_DIR"
ln -s /tmp/npm-cli "$NPM_GLOBAL_DIR"
npm --version

- name: Build Gutenberg plugin ZIP file
run: ./bin/build-plugin-zip.sh
env:
Expand Down Expand Up @@ -485,6 +494,15 @@ jobs:
registry-url: 'https://registry.npmjs.org'
check-latest: true

- name: Install custom npm with linked strategy fix
run: |
git clone --depth 1 --branch v11-gb-test https://github.com/manzoorwanijk/npm-cli.git /tmp/npm-cli
cd /tmp/npm-cli && node scripts/resetdeps.js
NPM_GLOBAL_DIR="$(npm root -g)/npm"
rm -rf "$NPM_GLOBAL_DIR"
ln -s /tmp/npm-cli "$NPM_GLOBAL_DIR"
npm --version

- name: Publish packages to npm ("latest" dist-tag)
run: |
cd main
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ jobs:
check-latest: true
cache: npm

- name: Install custom npm with linked strategy fix
run: |
git clone --depth 1 --branch v11-gb-test https://github.com/manzoorwanijk/npm-cli.git /tmp/npm-cli
cd /tmp/npm-cli && node scripts/resetdeps.js
NPM_GLOBAL_DIR="$(npm root -g)/npm"
rm -rf "$NPM_GLOBAL_DIR"
ln -s /tmp/npm-cli "$NPM_GLOBAL_DIR"
npm --version

- uses: preactjs/compressed-size-action@66325aad6443cb7cf89c4bfcd414aea2367cda94 # v2.9.1
with:
omit-unchanged: true
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/publish-npm-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ jobs:
registry-url: 'https://registry.npmjs.org'
check-latest: true

- name: Install custom npm with linked strategy fix
run: |
git clone --depth 1 --branch v11-gb-test https://github.com/manzoorwanijk/npm-cli.git /tmp/npm-cli
cd /tmp/npm-cli && node scripts/resetdeps.js
NPM_GLOBAL_DIR="$(npm root -g)/npm"
rm -rf "$NPM_GLOBAL_DIR"
ln -s /tmp/npm-cli "$NPM_GLOBAL_DIR"
npm --version

- name: Publish development packages to npm ("next" dist-tag)
if: ${{ github.event.inputs.release_type == 'development' }}
run: |
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,19 @@ jobs:
node-version: ${{ matrix.node }}
cache: npm

- name: Pin npm version for consistency
run: npm install -g npm@10
- name: Install custom npm with linked strategy fix
shell: bash
run: |
git clone --depth 1 --branch v11-gb-test https://github.com/manzoorwanijk/npm-cli.git "$RUNNER_TEMP/npm-cli"
cd "$RUNNER_TEMP/npm-cli" && node scripts/resetdeps.js
NPM_GLOBAL_DIR="$(npm root -g)/npm"
rm -rf "$NPM_GLOBAL_DIR"
if [[ "$RUNNER_OS" == "Windows" ]]; then
cp -r "$RUNNER_TEMP/npm-cli" "$NPM_GLOBAL_DIR"
else
ln -s "$RUNNER_TEMP/npm-cli" "$NPM_GLOBAL_DIR"
fi
npm --version

- name: npm install
# A "full" install is executed, since `npm ci` does not always exit
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/storybook-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,19 @@ jobs:

- name: Install test-runner and Playwright dependencies
run: |
npm install --no-save @storybook/test-runner@0.24.2
# storybook and playwright are needed as peer dependencies of @storybook/test-runner
STORYBOOK_VERSION=$(node -p "require('./storybook/package.json').devDependencies.storybook")
npm install --save-dev "storybook@$STORYBOOK_VERSION" @storybook/test-runner@0.24.2 playwright
npx playwright install --with-deps

- name: Serve Storybook and run tests
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server ./storybook/build --port 50240 --silent" \
"npx wait-on tcp:127.0.0.1:50240 && \
npx test-storybook --url http://localhost:50240 --config-dir ./storybook"
npx http-server ./storybook/build --port 50240 --silent &
SERVER_PID=$!
# Wait for server to be ready
until curl -sf http://127.0.0.1:50240 > /dev/null 2>&1; do sleep 1; done
# Run tests (kill server on exit)
npx test-storybook --url http://localhost:50240 --config-dir ./storybook
EXIT_CODE=$?
kill $SERVER_PID 2>/dev/null || true
exit $EXIT_CODE
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ legacy-peer-deps = true
prefer-dedupe = true
lockfile-version = 3
min-release-age = 1
install-strategy = "linked"
Loading
Loading