Skip to content

Commit af633e8

Browse files
authored
Switch from yarn@1.22.22 to pnpm@11.0.8 (#949)
Switch from yarn@1.22.22 to pnpm@11.0.8, as per #945 (comment). This also pins `@types/node@22.9.0`, matching the version previously resolved through `yarn.lock`. Without the pin, pnpm resolves `@types/node@25.6.0`, which TypeScript 4.9 cannot check. The observed diagnostics: - `error TS1165: A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type` - `error TS2339: Property 'dispose' does not exist on type 'SymbolConstructor'` - `error TS2726: Cannot find lib definition for 'esnext.disposable'` Install pnpm via the methods on the installation page: - https://pnpm.io/installation TODO: - [x] Delete `yarn.lock` - [x] Generate `pnpm-lock.yaml` - [x] Update package scripts from Yarn commands to pnpm commands - [x] Update GitHub Actions from Yarn commands to pnpm commands - [x] Update contributor docs from Yarn commands to pnpm commands - [x] Remove the README install example with Yarn - [x] Update CI from Node 18 to Node 22 for pnpm 11 compatibility - [x] Enable pnpm dependency caching in CI - [x] Pin `devEngines.packageManager` to `pnpm@11.0.8` - [x] Pin `@types/node@22.9.0` - [x] Verify dependencies before scripts with `verifyDepsBeforeRun: error` - [x] Declare the root workspace package with `packages: ['.']` - [x] Block packages newer than seven days with `minimumReleaseAge: 10080` - [x] Apply release-age checks strictly with `minimumReleaseAgeStrict: true` - [x] Treat missing publish times as unsafe with `minimumReleaseAgeIgnoreMissingTime: false` - [x] Prevent trust downgrades with `trustPolicy: no-downgrade` - [x] Allow the trust-policy exception `eslint-config-prettier@8.10.2` - [x] Allow the trust-policy exception `eslint-plugin-prettier@4.2.5` - [x] Allow the trust-policy exception `semver@5.7.2 || 6.3.1` - [x] Allow the trust-policy exception `undici-types@6.19.8` - [x] Block exotic subdependencies with `blockExoticSubdeps: true` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated CI and project tooling to Node.js 22.x. * Migrated package management from Yarn to pnpm across CI, scripts, and project config. * Added a pnpm workspace with stricter dependency and verification policies. * Updated developer scripts and bumped dev tooling/type dependency versions. * **Documentation** * Updated install and contribution instructions to reflect pnpm and Node.js 22.x. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/sql-formatter-org/sql-formatter/pull/949) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 2017285 + ba7437e commit af633e8

9 files changed

Lines changed: 11690 additions & 7006 deletions

File tree

.github/workflows/coveralls.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,32 @@ jobs:
1010

1111
strategy:
1212
matrix:
13-
node-version: [18.x]
13+
node-version: [22.x]
1414

1515
steps:
1616
- uses: actions/checkout@v4
1717

18+
# Work around pnpm/action-setup v6 resolving the wrong version from package.json
19+
# https://github.com/pnpm/action-setup/issues/227
20+
- name: Read pnpm version
21+
id: pnpm-version
22+
run: 'echo "version=$(jq --raw-output ''.devEngines.packageManager.version | split("+")[0]'' package.json)" >> "$GITHUB_OUTPUT"'
23+
24+
- uses: pnpm/action-setup@v6
25+
with:
26+
version: ${{ steps.pnpm-version.outputs.version }}
27+
1828
- name: Use Node.js ${{ matrix.node-version }}
1929
uses: actions/setup-node@v4
2030
with:
2131
node-version: ${{ matrix.node-version }}
32+
cache: pnpm
2233

2334
- name: Install
24-
run: yarn install --ignore-scripts
35+
run: pnpm install --ignore-scripts
2536

2637
- name: Test
27-
run: yarn test --coverage
38+
run: pnpm run test -- --coverage
2839

2940
- name: Coveralls GitHub Action
3041
uses: coverallsapp/github-action@1.1.3

.github/workflows/webpack.yaml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,41 @@ jobs:
99

1010
strategy:
1111
matrix:
12-
node-version: [18.x]
12+
node-version: [22.x]
1313

1414
steps:
1515
- uses: actions/checkout@v4
1616

17+
# Work around pnpm/action-setup v6 resolving the wrong version from package.json
18+
# https://github.com/pnpm/action-setup/issues/227
19+
- name: Read pnpm version
20+
id: pnpm-version
21+
run: 'echo "version=$(jq --raw-output ''.devEngines.packageManager.version | split("+")[0]'' package.json)" >> "$GITHUB_OUTPUT"'
22+
23+
- uses: pnpm/action-setup@v6
24+
with:
25+
version: ${{ steps.pnpm-version.outputs.version }}
26+
1727
- name: Use Node.js ${{ matrix.node-version }}
1828
uses: actions/setup-node@v4
1929
with:
2030
node-version: ${{ matrix.node-version }}
31+
cache: pnpm
2132

2233
- name: Install
23-
run: yarn install --ignore-scripts
34+
run: pnpm install --ignore-scripts
2435

2536
- name: Format
26-
run: yarn pretty:check
37+
run: pnpm run pretty:check
2738

2839
- name: Lint
29-
run: yarn lint
40+
run: pnpm run lint
3041

3142
- name: Test
32-
run: yarn test
43+
run: pnpm run test
3344

3445
- name: Build
35-
run: yarn build
46+
run: pnpm run build
3647

3748
- name: Typecheck
38-
run: yarn ts:check
49+
run: pnpm run ts:check

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
/dist
33
/lib
44
/node_modules
5-
yarn.lock
5+
pnpm-lock.yaml
66
LICENSE
77
/src/parser/grammar.ts

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ as SQL Formatter is mostly in maintenance mode.
55

66
## Setup
77

8-
Run `yarn` after checkout to install all dependencies.
8+
Run `pnpm install` after checkout to install all dependencies.
99

1010
## Tests
1111

12-
Tests can be run with `yarn test`.
12+
Tests can be run with `pnpm test`.
1313

1414
Please add new tests for any new features and bug fixes.
1515
Language-specific tests should be included in their respective `sqldialect.test.ts` files.
@@ -19,7 +19,7 @@ Tests that apply to all languages should be in `behavesLikeSqlFormatter.ts`.
1919

2020
For those who have admin access on the repo, the new release publish flow is as such:
2121

22-
- `npm run release` (bumps version, git tag, git release, npm release) (does not work with `yarn`).
22+
- `pnpm run release` (bumps version, git tag, git release, npm release).
2323
- `git subtree push --prefix static origin gh-pages` (pushes demo page to GH pages)
2424

2525
[prettier-plugin-sql-cst]: https://github.com/nene/prettier-plugin-sql-cst

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,10 @@ It does not support:
1919

2020
## Install
2121

22-
Get the latest version from NPM:
22+
Get the latest version using your package manager of choice:
2323

2424
```sh
25-
npm install sql-formatter
26-
```
27-
28-
Also available with yarn:
29-
30-
```sh
31-
yarn add sql-formatter
25+
npm install sql-formatter # or yarn, pnpm, bun, etc
3226
```
3327

3428
## Usage

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,21 @@
5454
"ts:check": "tsc --noEmit",
5555
"ts:changes": "tsc --noEmit --incremental",
5656
"lint": "eslint --cache .",
57-
"lint:changes": "sh -c eslint --cache $(yarn git:changes)",
57+
"lint:changes": "sh -c 'eslint --cache $(pnpm run --silent git:changes)'",
5858
"pretty": "prettier --write .",
5959
"pretty:check": "prettier --check .",
60-
"fix": "yarn pretty && eslint --fix .",
61-
"test": "yarn grammar && jest",
62-
"test:watch": "yarn test -- --watch",
63-
"test:perf": "yarn grammar && jest --testMatch '<rootDir>/test/perftest.ts' --coverage=false",
64-
"check": "yarn ts:check && yarn pretty:check && yarn lint && yarn test",
65-
"prepare": "yarn clean && yarn grammar && yarn fix && yarn check && yarn build",
60+
"fix": "pnpm run pretty && eslint --fix .",
61+
"test": "pnpm run grammar && jest",
62+
"test:watch": "pnpm run test -- --watch",
63+
"test:perf": "pnpm run grammar && jest --testMatch '<rootDir>/test/perftest.ts' --coverage=false",
64+
"check": "pnpm run ts:check && pnpm run pretty:check && pnpm run lint && pnpm run test",
65+
"prepare": "pnpm run clean && pnpm run grammar && pnpm run fix && pnpm run check && pnpm run build",
6666
"pre-commit": "npm-run-all --parallel ts:changes lint:changes",
6767
"grammar": "nearleyc src/parser/grammar.ne -o src/parser/grammar.ts",
6868
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
6969
"build:esm": "tsc -p tsconfig.esm.json",
7070
"build:webpack": "webpack --config webpack.prod.js && cp dist/sql-formatter.min.cjs dist/sql-formatter.min.js",
71-
"build": "yarn grammar && npm-run-all --parallel build:cjs build:esm build:webpack",
71+
"build": "pnpm run grammar && npm-run-all --parallel build:cjs build:esm build:webpack",
7272
"release": "release-it"
7373
},
7474
"repository": {
@@ -92,6 +92,7 @@
9292
"@types/babel__core": "^7.1.15",
9393
"@types/jest": "^29.5.14",
9494
"@types/nearley": "^2.11.2",
95+
"@types/node": "22.9.0",
9596
"@typescript-eslint/eslint-plugin": "^5.21.0",
9697
"@typescript-eslint/parser": "^5.21.0",
9798
"babel-eslint": "^10.1.0",
@@ -133,8 +134,8 @@
133134
},
134135
"devEngines": {
135136
"packageManager": {
136-
"name": "yarn",
137-
"version": "1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
137+
"name": "pnpm",
138+
"version": "11.0.8+sha512.4c4097e1dd2d42372c4e7fa5a791ff28fc75a484c7ac192e64b1df0fdef17594ba982f9b4fed9adfb3c757846f565b799b2763fb3733d1de1bcb82cf46684912"
138139
}
139140
}
140141
}

0 commit comments

Comments
 (0)