Skip to content

Commit 45a6e33

Browse files
Kyome22claude
andcommitted
Migrate from pnpm to npm using min-release-age
npm v11.10.0 introduced min-release-age, the equivalent of pnpm's minimumReleaseAge that we relied on as a supply-chain attack mitigation. Moving back to npm removes the pnpm-only workarounds (notably the `cd ~` dance for `pnpm login`) and shrinks the toolchain. - .npmrc: min-release-age=7 (npm uses days, vs pnpm's 1440 minutes = 1 day; bumped to a week while we're at it) - package.json: drop packageManager, set engines.node/npm and devEngines.packageManager.name=npm - Replace pnpm-lock.yaml with package-lock.json - Remove pnpm-workspace.yaml (only existed to hold minimumReleaseAge) and mise.toml (nodenv handles via .node-version) - CI: drop pnpm/action-setup, use cache: npm, install npm@^11.10.0 to ensure min-release-age is honored - Docs: update CLAUDE.md, README.md, and the release guide Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent dfe875b commit 45a6e33

11 files changed

Lines changed: 1537 additions & 966 deletions

File tree

.github/how_to_release_for_npm.md

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,40 @@
22

33
## 前提
44

5-
- `npm` コマンドは禁止。`pnpm` を使う。
6-
- `pnpm login`**lobsterjs ディレクトリの外** で実行すること。
7-
(lobsterjs 内で実行すると `devEngines` チェックに引っかかってエラーになる)
5+
- パッケージマネージャは `npm``devEngines.packageManager.name=npm``engines.npm``>=11.10.0`)。
6+
- `.npmrc``min-release-age=1` を設定しているため、npm のバージョンが 11.10.0 以上であること。
7+
```sh
8+
npm --version # 11.10.0 以上であること
9+
```
10+
古ければ `npm install -g npm@latest` でアップグレードする。
811

912
## 手順
1013

1114
### 1. バージョンを上げる
1215

13-
`package.json``version` を手動で編集し、git tag を打つ。
16+
`package.json``version` を編集し、git tag を打つ。
1417

1518
```bash
1619
git tag 0.x.x
17-
git push origin 0.x.x # GitHub Release が CI で自動生成される
20+
git push origin 0.x.x # GitHub Release が CI (release.yml) で自動生成される
1821
```
1922

2023
### 2. npm にログイン(未ログインの場合)
2124

2225
```bash
23-
cd ~
24-
pnpm login --registry https://registry.npmjs.org
26+
npm login --registry https://registry.npmjs.org
2527
# ブラウザが開くので認証する
2628

2729
# 確認
28-
pnpm whoami --registry https://registry.npmjs.org
30+
npm whoami --registry https://registry.npmjs.org
2931
```
3032

33+
> Note: pnpm 時代は `cd ~` してから `pnpm login` を実行する回避策が必要だったが、npm では不要。
34+
3135
### 3. ビルド & publish
3236

3337
```bash
34-
cd /path/to/lobsterjs
35-
pnpm run build
36-
pnpm publish --access public
38+
npm ci
39+
npm run build
40+
npm publish --access public
3741
```
38-
39-
## 注意
40-
41-
- `pnpm login` を lobsterjs ディレクトリ内で実行すると以下のエラーが出る(npm が呼ばれてしまう):
42-
```
43-
npm error EBADDEVENGINES Invalid name "pnpm" does not match "npm"
44-
```
45-
必ず `cd ~` などでディレクトリを移動してから実行すること。

.github/workflows/deploy.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,18 @@ jobs:
2323
steps:
2424
- uses: actions/checkout@v6
2525

26-
- uses: pnpm/action-setup@v4
27-
with:
28-
version: 10.30.1
29-
3026
- uses: actions/setup-node@v6
3127
with:
3228
node-version: "24.13.1"
33-
cache: "pnpm"
29+
cache: "npm"
30+
31+
- run: npm install -g npm@^11.10.0
3432

35-
- run: pnpm install
33+
- run: npm ci
3634

37-
- run: pnpm test
35+
- run: npm test
3836

39-
- run: pnpm build:docs
37+
- run: npm run build:docs
4038

4139
- uses: actions/configure-pages@v5
4240

.github/workflows/release.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,18 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v6
1616

17-
- uses: pnpm/action-setup@v4
18-
with:
19-
version: 10.30.1
20-
2117
- uses: actions/setup-node@v6
2218
with:
2319
node-version: "24.13.1"
24-
cache: "pnpm"
20+
cache: "npm"
21+
22+
- run: npm install -g npm@^11.10.0
2523

26-
- run: pnpm install
24+
- run: npm ci
2725

28-
- run: pnpm test
26+
- run: npm test
2927

30-
- run: pnpm build
28+
- run: npm run build
3129

3230
- name: Package skills
3331
run: zip -r lobster-skills.zip skills/

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
min-release-age=7

CLAUDE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ Spec: `markdowns/spec.md` (English), `markdowns/spec-ja.md` (Japanese)
1010

1111
## Commands
1212

13-
This project uses **pnpm** (enforced — npm/yarn will error).
13+
This project uses **npm** (declared via `devEngines`; requires npm `>=11.10.0` for the `min-release-age` setting in `.npmrc`).
1414

1515
```bash
16-
pnpm test # Run all tests once (Vitest)
17-
pnpm test:watch # Run tests in watch mode
18-
pnpm run build # Build ESM bundle + emit .d.ts declarations
19-
pnpm run build:docs # Build and copy dist/lobster.js → docs/lobster.js
16+
npm test # Run all tests once (Vitest)
17+
npm run test:watch # Run tests in watch mode
18+
npm run build # Build ESM bundle + emit .d.ts declarations
19+
npm run build:docs # Build and copy dist/lobster.js → docs/lobster.js
2020
```
2121

2222
To run a single test file:
2323
```bash
24-
pnpm vitest run tests/block-parser.test.ts
24+
npx vitest run tests/block-parser.test.ts
2525
```
2626

2727
## Architecture

README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -336,33 +336,34 @@ Once installed, Claude will use the skills automatically when you ask to create
336336
337337
### Requirements
338338
339-
| Tool | Version |
340-
| :---------------------------- | :--------- |
341-
| [mise](https://mise.jdx.dev/) | 2026.2.19+ |
342-
| pnpm | 10.30.1 |
343-
| Node.js | 24.13.1 |
339+
| Tool | Version |
340+
| :------ | :-------- |
341+
| Node.js | 24.13.1 |
342+
| npm | >=11.10.0 |
343+
344+
`.npmrc` sets `min-release-age=7` so newly published package versions (less than 7 days old) are not installed — a mitigation against npm supply-chain attacks. This requires npm 11.10.0 or later.
344345
345346
### Setup
346347
347348
```sh
348-
# Install mise
349-
brew install mise
350-
echo 'eval "$(mise activate zsh)"' >> ~/.zshrc
349+
# Use any Node version manager (nodenv, fnm, asdf, etc.) — .node-version pins 24.13.1
350+
nodenv install # if using nodenv
351351
352-
# Install pnpm and Node.js (versions defined in mise.toml)
353-
mise install
352+
# Node 24.13.1 ships with npm 11.x but may be older than 11.10.0;
353+
# upgrade so the min-release-age policy in .npmrc takes effect.
354+
npm install -g npm@latest
354355
355-
# Install dependencies
356-
pnpm install
356+
# Install dependencies (uses package-lock.json)
357+
npm ci
357358
```
358359
359360
### Commands
360361
361362
```sh
362-
pnpm test # Run tests (Vitest)
363-
pnpm test:watch # Watch mode
364-
pnpm build # Bundle to dist/
365-
pnpm build:docs # Copy bundle to docs/ for GitHub Pages
363+
npm test # Run tests (Vitest)
364+
npm run test:watch # Watch mode
365+
npm run build # Bundle to dist/
366+
npm run build:docs # Copy bundle to docs/ for GitHub Pages
366367
```
367368
368369
### Project structure
@@ -394,7 +395,7 @@ Issues and pull requests are welcome.
394395
1. Fork the repository
395396
2. Create a feature branch: `git checkout -b feat/my-feature`
396397
3. Add tests for any new behaviour
397-
4. Run `pnpm test` and make sure all tests pass
398+
4. Run `npm test` and make sure all tests pass
398399
5. Open a pull request
399400
400401
---

mise.toml

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)