Skip to content

Commit ab61ed7

Browse files
committed
build: switch from yarn to pnpm with a 9-day package-age gate
Migrate the package manager from yarn@1 to pnpm@10, and enable pnpm's minimumReleaseAge so newly published dependency versions are not installed until they are at least 9 days (12960 minutes) old. This adds a buffer between a version being published and us pulling it in, giving the ecosystem more time to flag a bad release before it reaches the SDK. pnpm 10 is used rather than 11 because pnpm 11 requires Node.js 22+, while CI still tests against Node 20; minimumReleaseAge has been available since pnpm 10.16. - pnpm-workspace.yaml: minimumReleaseAge 12960; @swc/core build skipped - replace yarn.lock with a policy-compliant pnpm-lock.yaml - pin pnpm via the packageManager field (corepack) - scripts/bootstrap, bin/publish-npm: use pnpm - CI: add pnpm/action-setup before setup-node, cache: pnpm - CONTRIBUTING.md, Brewfile, .gitignore: pnpm
1 parent 40365fc commit ab61ed7

12 files changed

Lines changed: 4254 additions & 3431 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19+
- name: Set up pnpm
20+
uses: pnpm/action-setup@v4
21+
1922
- name: Set up Node
2023
uses: actions/setup-node@v4
2124
with:
2225
node-version: '20'
26+
cache: 'pnpm'
2327

2428
- name: Bootstrap
2529
run: ./scripts/bootstrap
@@ -35,10 +39,14 @@ jobs:
3539
steps:
3640
- uses: actions/checkout@v4
3741

42+
- name: Set up pnpm
43+
uses: pnpm/action-setup@v4
44+
3845
- name: Set up Node
3946
uses: actions/setup-node@v4
4047
with:
4148
node-version: '20'
49+
cache: 'pnpm'
4250

4351
- name: Bootstrap
4452
run: ./scripts/bootstrap
@@ -58,10 +66,14 @@ jobs:
5866
steps:
5967
- uses: actions/checkout@v4
6068

69+
- name: Set up pnpm
70+
uses: pnpm/action-setup@v4
71+
6172
- name: Set up Node
6273
uses: actions/setup-node@v4
6374
with:
6475
node-version: ${{ matrix.node-version }}
76+
cache: 'pnpm'
6577

6678
- name: Bootstrap
6779
run: ./scripts/bootstrap

.github/workflows/publish-npm.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,21 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v4
2222

23+
- name: Set up pnpm
24+
uses: pnpm/action-setup@v4
25+
2326
- name: Set up Node
2427
uses: actions/setup-node@v4
2528
with:
2629
node-version: '20'
30+
cache: 'pnpm'
2731

2832
- name: Upgrade npm to OIDC-capable version
2933
run: npm install -g npm@latest
3034

3135
- name: Install dependencies
3236
run: |
33-
yarn install
37+
pnpm install
3438
3539
- name: Publish to NPM
3640
run: |

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.prism.log
22
node_modules
3-
yarn-error.log
43
codegen.log
54
Brewfile.lock.json
65
dist

Brewfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
brew "node"
2+
brew "pnpm"

CONTRIBUTING.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
## Setting up the environment
22

3-
This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install).
4-
Other package managers may work but are not officially supported for development.
3+
This repository uses [`pnpm`](https://pnpm.io/installation). The pinned version
4+
is declared in the `packageManager` field of `package.json`, so running pnpm
5+
via [Corepack](https://nodejs.org/api/corepack.html) (`corepack enable pnpm`)
6+
will use the correct version automatically. Other package managers may work but
7+
are not officially supported for development.
58

69
To set up the repository, run:
710

811
```sh
9-
$ yarn
10-
$ yarn build
12+
$ pnpm install
13+
$ pnpm build
1114
```
1215

1316
This will install all the required dependencies and build output files to `dist/`.
@@ -32,7 +35,7 @@ All files in the `examples/` directory are not modified by the generator and can
3235
```sh
3336
$ chmod +x examples/<your-example>.ts
3437
# run the example against your api
35-
$ yarn tsn -T examples/<your-example>.ts
38+
$ pnpm tsn -T examples/<your-example>.ts
3639
```
3740

3841
## Using the repository from source
@@ -52,15 +55,9 @@ Alternatively, to link a local copy of the repo:
5255
$ git clone https://www.github.com/lmnt-com/lmnt-node
5356
$ cd lmnt-node
5457

55-
# With yarn
56-
$ yarn link
57-
$ cd ../my-package
58-
$ yarn link lmnt-node
59-
60-
# With pnpm
6158
$ pnpm link --global
6259
$ cd ../my-package
63-
$ pnpm link -global lmnt-node
60+
$ pnpm link --global lmnt-node
6461
```
6562

6663
## Running tests
@@ -72,7 +69,7 @@ $ npx prism mock path/to/your/openapi.yml
7269
```
7370

7471
```sh
75-
$ yarn run test
72+
$ pnpm test
7673
```
7774

7875
## Linting and formatting
@@ -83,13 +80,13 @@ This repository uses [prettier](https://www.npmjs.com/package/prettier) and
8380
To lint:
8481

8582
```sh
86-
$ yarn lint
83+
$ pnpm lint
8784
```
8885

8986
To format and fix all lint issues automatically:
9087

9188
```sh
92-
$ yarn fix
89+
$ pnpm fix
9390
```
9491

9592
## Publishing and releases

bin/publish-npm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -eux
44

5-
yarn build
5+
pnpm run build
66
cd dist
77

88
# Get package name and version from package.json

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"type": "commonjs",
99
"repository": "github:lmnt-com/lmnt-node",
1010
"license": "Apache-2.0",
11-
"packageManager": "yarn@1.22.22",
11+
"packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800",
1212
"files": [
1313
"**/*"
1414
],
@@ -20,7 +20,7 @@
2020
"scripts": {
2121
"test": "./scripts/test",
2222
"build": "./scripts/build",
23-
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
23+
"prepublishOnly": "echo 'to publish, run pnpm build && (cd dist; npm publish)' && exit 1",
2424
"format": "prettier --write --cache --cache-strategy metadata . !dist",
2525
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build && ./scripts/utils/git-swap.sh; fi",
2626
"tsn": "ts-node -r tsconfig-paths/register",

0 commit comments

Comments
 (0)