From 36e1b1928ac46d3fb6a0d5c769ef60f293668d58 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sun, 13 Oct 2024 09:55:38 +0200 Subject: [PATCH] Migrate to pnpm (#949) - Require Node >= 18 --- .github/workflows/javascript.yml | 18 ++++-------------- .github/workflows/ruby.yml | 2 +- .gitignore | 3 ++- Rakefile | 8 ++++---- package.json | 16 ++++++++-------- 5 files changed, 19 insertions(+), 28 deletions(-) diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index 9562cc349..dcd461269 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -11,7 +11,7 @@ permissions: jobs: test: - name: Tests + name: JavaScript Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -20,22 +20,12 @@ jobs: with: ruby-version: '3.3' bundler-cache: true + - uses: pnpm/action-setup@v4 - name: Set up Node uses: actions/setup-node@v4 with: node-version: '18' - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: - echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - uses: actions/cache@v4 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - name: Yarn - run: yarn + - name: Install node dependencies + run: pnpm install - name: Run tests run: bundle exec rake test:js diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index d4cb55338..330eca5b8 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -11,7 +11,7 @@ permissions: jobs: test: - name: Tests + name: Ruby Tests runs-on: ubuntu-latest strategy: matrix: diff --git a/.gitignore b/.gitignore index 4002376b4..b60073464 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ test/generators/tmp/* test/log node_modules -yarn-error.log !.babelrc + +pnpm-lock.yaml diff --git a/Rakefile b/Rakefile index 8008de78e..0064bcb94 100644 --- a/Rakefile +++ b/Rakefile @@ -55,7 +55,7 @@ end desc %(Regenerate JavaScript files) task :regenerate_javascript do - run_yarn_script 'build' + run_pnpm_script 'build' end desc %(Commit JavaScript files) @@ -100,15 +100,15 @@ def which(cmd) end def run_headless_tests - run_yarn_script 'test', "#{test_url}?autostart=false" do + run_pnpm_script 'test', "#{test_url}?autostart=false" do Process.kill 'INT', @server end end -def run_yarn_script(script, options = '') +def run_pnpm_script(script, options = '') require 'English' - system "yarn #{script} #{options}" + system "pnpm #{script} #{options}" exit_code = $CHILD_STATUS.exitstatus yield if block_given? diff --git a/package.json b/package.json index 2358c9f7f..02081743e 100644 --- a/package.json +++ b/package.json @@ -22,26 +22,26 @@ "test": "test/javascript/run-qunit.mjs" }, "devDependencies": { - "@babel/core": "^7.25.2", - "@babel/preset-env": "^7.25.4", + "@babel/core": "^7.25.8", + "@babel/preset-env": "^7.25.8", "@rollup/plugin-babel": "^6.0.4", - "@rollup/plugin-node-resolve": "^15.2.2", + "@rollup/plugin-node-resolve": "^15.3.0", "chrome-launcher": "^1.1.2", - "puppeteer-core": "^23.4.1", - "rollup": "^4.22.0", + "puppeteer-core": "^23.5.3", + "rollup": "^4.24.0", "rollup-plugin-copy": "^3.5.0", "standard": "^17.1.2" }, - "dependencies": {}, "peerDependencies": { "jquery": ">= 1.12.4 < 4.0.0" }, "main": "dist/client-side-validations.js", "module": "dist/client-side-validations.esm.js", "engines": { - "node": ">=12.0.0", - "yarn": ">=1.19.0" + "node": ">= 18.0", + "pnpm": "^9.12.1" }, + "packageManager": "pnpm@^9.12.1", "browserslist": [ ">= 1%", "last 1 major version",