Skip to content

Commit 1b83d6b

Browse files
DrJKLsnomiao
andauthored
Migration: pnpm (#5215)
* migration: npm to pnpm Step 1, package and lockfile * migration: npm to pnpm Step 2: docs / LLM instructions * migration: npm to pnpm Step 3: More documentation updates * migration: npm to pnpm Step 4: Even more documentation * migration: npm to pnpm Step 5: GitHub Actions * migration: npm to pnpm Step 6: PNPM installation in actions. This merge is going to be painful. * migration: npm to pnpm Unignore and add pnpm lockfile. * migration: npm to pnpm package-lock.json -> pnpm-lock.yaml * migration: explicit @primeuix/styled, move glob to prod deps * migration: more explicit deps required by the importmap plugin and vite * fix: missed merge artifact * fix: Make sure pnpm is available to install wrangler * migration: pnpm for dev-release.yaml * migration: new setup action version Won't work until that is updated and a new release is cut. * migration: Playwright needs uuid * migration: Add explicit deps for lobehub * chore(version-bump.yaml): change cache from npm to pnpm to optimize package management and improve build performance * migration: install pnpm in version-bump action --------- Co-authored-by: snomiao <[email protected]>
1 parent cd444b6 commit 1b83d6b

35 files changed

+12747
-19943
lines changed

.claude/commands/create-frontend-release.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,21 +244,21 @@ echo "Last stable release: $LAST_STABLE"
244244

245245
1. Run complete test suite:
246246
```bash
247-
npm run test:unit
248-
npm run test:component
247+
pnpm test:unit
248+
pnpm test:component
249249
```
250250
2. Run type checking:
251251
```bash
252-
npm run typecheck
252+
pnpm typecheck
253253
```
254254
3. Run linting (may have issues with missing packages):
255255
```bash
256-
npm run lint || echo "Lint issues - verify if critical"
256+
pnpm lint || echo "Lint issues - verify if critical"
257257
```
258258
4. Test build process:
259259
```bash
260-
npm run build
261-
npm run build:types
260+
pnpm build
261+
pnpm build:types
262262
```
263263
5. **QUALITY GATE**: All tests and builds passing?
264264

@@ -488,7 +488,7 @@ echo "Workflow triggered. Waiting for PR creation..."
488488
```bash
489489
# Check npm availability
490490
for i in {1..10}; do
491-
if npm view @comfyorg/comfyui-frontend-types@${NEW_VERSION} version >/dev/null 2>&1; then
491+
if pnpm view @comfyorg/comfyui-frontend-types@${NEW_VERSION} version >/dev/null 2>&1; then
492492
echo "✅ npm package available"
493493
break
494494
fi

.claude/commands/create-hotfix-release.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ For each commit:
8080
- **CONFIRMATION REQUIRED**: Conflicts resolved correctly?
8181
3. After successful cherry-pick:
8282
- Show the changes: `git show HEAD`
83-
- Run validation: `npm run typecheck && npm run lint`
83+
- Run validation: `pnpm typecheck && pnpm lint`
8484
4. **CONFIRMATION REQUIRED**: Cherry-pick successful and valid?
8585

8686
### Step 6: Create PR to Core Branch
@@ -197,7 +197,7 @@ For each commit:
197197
5. Track progress:
198198
- GitHub release draft/publication
199199
- PyPI upload
200-
- npm types publication
200+
- pnpm types publication
201201
202202
### Step 12: Post-Release Verification
203203
@@ -211,7 +211,7 @@ For each commit:
211211
```
212212
3. Verify npm package:
213213
```bash
214-
npm view @comfyorg/[email protected]
214+
pnpm view @comfyorg/[email protected]
215215
```
216216
4. Generate release summary with:
217217
- Version released

.claude/commands/verify-visually.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Follow these steps systematically to verify our changes:
55

66
1. **Server Setup**
77
- Check if the dev server is running on port 5173 using browser navigation or port checking
8-
- If not running, start it with `npm run dev` from the root directory
8+
- If not running, start it with `pnpm dev` from the root directory
99
- If the server fails to start, provide detailed troubleshooting steps by reading package.json and README.md for accurate instructions
1010
- Wait for the server to be fully ready before proceeding
1111

.github/workflows/chromatic.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ jobs:
2121
with:
2222
fetch-depth: 0 # Required for Chromatic baseline
2323

24+
- name: Install pnpm
25+
uses: pnpm/action-setup@v4
26+
with:
27+
version: 10
28+
2429
- name: Setup Node.js
2530
uses: actions/setup-node@v4
2631
with:
2732
node-version: '20'
28-
cache: 'npm'
33+
cache: 'pnpm'
2934

3035
- name: Get current time
3136
id: current-time
@@ -58,14 +63,14 @@ jobs:
5863
.cache
5964
storybook-static
6065
tsconfig.tsbuildinfo
61-
key: storybook-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('src/**/*.{ts,vue,js}', '*.config.*', '.storybook/**/*') }}
66+
key: storybook-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('src/**/*.{ts,vue,js}', '*.config.*', '.storybook/**/*') }}
6267
restore-keys: |
63-
storybook-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-
68+
storybook-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-
6469
storybook-cache-${{ runner.os }}-
6570
storybook-tools-cache-${{ runner.os }}-
6671
6772
- name: Install dependencies
68-
run: npm ci
73+
run: pnpm install --frozen-lockfile
6974

7075
- name: Build Storybook and run Chromatic
7176
id: chromatic

.github/workflows/claude-pr-review.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,20 @@ jobs:
5353
with:
5454
fetch-depth: 0
5555

56+
- name: Install pnpm
57+
uses: pnpm/action-setup@v4
58+
with:
59+
version: 10
60+
5661
- name: Setup Node.js
5762
uses: actions/setup-node@v4
5863
with:
5964
node-version: '20'
65+
cache: 'pnpm'
6066

6167
- name: Install dependencies for analysis tools
6268
run: |
63-
npm install -g typescript @vue/compiler-sfc
69+
pnpm install -g typescript @vue/compiler-sfc
6470
6571
- name: Run Claude PR Review
6672
uses: anthropics/claude-code-action@main

.github/workflows/dev-release.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ jobs:
1616
steps:
1717
- name: Checkout code
1818
uses: actions/checkout@v4
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v4
21+
with:
22+
version: 10
1923
- uses: actions/setup-node@v4
2024
with:
2125
node-version: 'lts/*'
22-
cache: 'npm'
26+
cache: 'pnpm'
2327

2428
- name: Cache tool outputs
2529
uses: actions/cache@v4
@@ -28,7 +32,7 @@ jobs:
2832
.cache
2933
dist
3034
tsconfig.tsbuildinfo
31-
key: dev-release-tools-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
35+
key: dev-release-tools-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
3236
restore-keys: |
3337
dev-release-tools-cache-${{ runner.os }}-
3438
@@ -42,9 +46,9 @@ jobs:
4246
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
4347
USE_PROD_CONFIG: 'true'
4448
run: |
45-
npm ci
46-
npm run build
47-
npm run zipdist
49+
pnpm install --frozen-lockfile
50+
pnpm build
51+
pnpm zipdist
4852
- name: Upload dist artifact
4953
uses: actions/upload-artifact@v4
5054
with:

.github/workflows/i18n-custom-nodes.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,14 @@ jobs:
4242
with:
4343
repository: ${{ inputs.owner }}/${{ inputs.repository }}
4444
path: 'ComfyUI/custom_nodes/${{ inputs.repository }}'
45+
- name: Install pnpm
46+
uses: pnpm/action-setup@v4
47+
with:
48+
version: 10
4549
- uses: actions/setup-node@v4
4650
with:
4751
node-version: 'lts/*'
52+
cache: 'pnpm'
4853
- uses: actions/setup-python@v4
4954
with:
5055
python-version: '3.10'
@@ -63,8 +68,8 @@ jobs:
6368
working-directory: ComfyUI/custom_nodes/${{ inputs.repository }}
6469
- name: Build & Install ComfyUI_frontend
6570
run: |
66-
npm ci
67-
npm run build
71+
pnpm install --frozen-lockfile
72+
pnpm build
6873
rm -rf ../ComfyUI/web/*
6974
mv dist/* ../ComfyUI/web/
7075
working-directory: ComfyUI_frontend
@@ -79,18 +84,18 @@ jobs:
7984
- name: Start dev server
8085
# Run electron dev server as it is a superset of the web dev server
8186
# We do want electron specific UIs to be translated.
82-
run: npm run dev:electron &
87+
run: pnpm dev:electron &
8388
working-directory: ComfyUI_frontend
8489
- name: Capture base i18n
8590
run: npx tsx scripts/diff-i18n capture
8691
working-directory: ComfyUI_frontend
8792
- name: Update en.json
88-
run: npm run collect-i18n
93+
run: pnpm collect-i18n
8994
env:
9095
PLAYWRIGHT_TEST_URL: http://localhost:5173
9196
working-directory: ComfyUI_frontend
9297
- name: Update translations
93-
run: npm run locale
98+
run: pnpm locale
9499
env:
95100
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
96101
working-directory: ComfyUI_frontend

.github/workflows/i18n-node-defs.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ jobs:
1313
update-locales:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: Comfy-Org/ComfyUI_frontend_setup_action@v2.3
16+
- uses: Comfy-Org/ComfyUI_frontend_setup_action@v3
1717
- name: Install Playwright Browsers
1818
run: npx playwright install chromium --with-deps
1919
working-directory: ComfyUI_frontend
2020
- name: Start dev server
2121
# Run electron dev server as it is a superset of the web dev server
2222
# We do want electron specific UIs to be translated.
23-
run: npm run dev:electron &
23+
run: pnpm dev:electron &
2424
working-directory: ComfyUI_frontend
2525
- name: Update en.json
26-
run: npm run collect-i18n -- scripts/collect-i18n-node-defs.ts
26+
run: pnpm collect-i18n -- scripts/collect-i18n-node-defs.ts
2727
env:
2828
PLAYWRIGHT_TEST_URL: http://localhost:5173
2929
working-directory: ComfyUI_frontend
3030
- name: Update translations
31-
run: npm run locale
31+
run: pnpm locale
3232
env:
3333
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3434
working-directory: ComfyUI_frontend

.github/workflows/i18n.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
if: github.event.pull_request.head.repo.full_name == github.repository
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: Comfy-Org/ComfyUI_frontend_setup_action@v2.3
19+
- uses: Comfy-Org/ComfyUI_frontend_setup_action@v3
2020

2121
- name: Cache tool outputs
2222
uses: actions/cache@v4
2323
with:
2424
path: |
2525
ComfyUI_frontend/.cache
2626
ComfyUI_frontend/.cache
27-
key: i18n-tools-cache-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/package-lock.json') }}
27+
key: i18n-tools-cache-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/pnpm-lock.yaml') }}
2828
restore-keys: |
2929
i18n-tools-cache-${{ runner.os }}-
3030
- name: Install Playwright Browsers
@@ -33,15 +33,15 @@ jobs:
3333
- name: Start dev server
3434
# Run electron dev server as it is a superset of the web dev server
3535
# We do want electron specific UIs to be translated.
36-
run: npm run dev:electron &
36+
run: pnpm dev:electron &
3737
working-directory: ComfyUI_frontend
3838
- name: Update en.json
39-
run: npm run collect-i18n -- scripts/collect-i18n-general.ts
39+
run: pnpm collect-i18n -- scripts/collect-i18n-general.ts
4040
env:
4141
PLAYWRIGHT_TEST_URL: http://localhost:5173
4242
working-directory: ComfyUI_frontend
4343
- name: Update translations
44-
run: npm run locale
44+
run: pnpm locale
4545
env:
4646
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
4747
working-directory: ComfyUI_frontend

.github/workflows/lint-and-format.yaml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@ jobs:
1919
ref: ${{ github.event.pull_request.head.sha }}
2020
fetch-depth: 0
2121

22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v4
24+
with:
25+
version: 10
26+
2227
- name: Use Node.js
2328
uses: actions/setup-node@v4
2429
with:
2530
node-version: 'lts/*'
26-
cache: 'npm'
31+
cache: 'pnpm'
2732

2833
- name: Cache tool outputs
2934
uses: actions/cache@v4
@@ -34,20 +39,20 @@ jobs:
3439
tsconfig.tsbuildinfo
3540
.prettierCache
3641
.knip-cache
37-
key: lint-format-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('src/**/*.{ts,vue,js,mts}', '*.config.*', '.eslintrc.*', '.prettierrc.*', 'tsconfig.json') }}
42+
key: lint-format-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('src/**/*.{ts,vue,js,mts}', '*.config.*', '.eslintrc.*', '.prettierrc.*', 'tsconfig.json') }}
3843
restore-keys: |
39-
lint-format-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-
44+
lint-format-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-
4045
lint-format-cache-${{ runner.os }}-
4146
ci-tools-cache-${{ runner.os }}-
4247
4348
- name: Install dependencies
44-
run: npm ci
49+
run: pnpm install --frozen-lockfile
4550

4651
- name: Run ESLint with auto-fix
47-
run: npm run lint:fix
52+
run: pnpm lint:fix
4853

4954
- name: Run Prettier with auto-format
50-
run: npm run format
55+
run: pnpm format
5156

5257
- name: Check for changes
5358
id: verify-changed-files
@@ -69,9 +74,9 @@ jobs:
6974
7075
- name: Final validation
7176
run: |
72-
npm run lint
73-
npm run format:check
74-
npm run knip
77+
pnpm lint
78+
pnpm format:check
79+
pnpm knip
7580
7681
- name: Comment on PR about auto-fix
7782
if: steps.verify-changed-files.outputs.changed == 'true' && github.event.pull_request.head.repo.full_name == github.repository
@@ -96,5 +101,5 @@ jobs:
96101
issue_number: context.issue.number,
97102
owner: context.repo.owner,
98103
repo: context.repo.repo,
99-
body: '## ⚠️ Linting/Formatting Issues Found\n\nThis PR has linting or formatting issues that need to be fixed.\n\n**Since this PR is from a fork, auto-fix cannot be applied automatically.**\n\n### Option 1: Set up pre-commit hooks (recommended)\nRun this once to automatically format code on every commit:\n```bash\nnpm run prepare\n```\n\n### Option 2: Fix manually\nRun these commands and push the changes:\n```bash\nnpm run lint:fix\nnpm run format\n```\n\nSee [CONTRIBUTING.md](https://github.com/Comfy-Org/ComfyUI_frontend/blob/main/CONTRIBUTING.md#git-pre-commit-hooks) for more details.'
104+
body: '## ⚠️ Linting/Formatting Issues Found\n\nThis PR has linting or formatting issues that need to be fixed.\n\n**Since this PR is from a fork, auto-fix cannot be applied automatically.**\n\n### Option 1: Set up pre-commit hooks (recommended)\nRun this once to automatically format code on every commit:\n```bash\npnpm prepare\n```\n\n### Option 2: Fix manually\nRun these commands and push the changes:\n```bash\npnpm lint:fix\npnpm format\n```\n\nSee [CONTRIBUTING.md](https://github.com/Comfy-Org/ComfyUI_frontend/blob/main/CONTRIBUTING.md#git-pre-commit-hooks) for more details.'
100105
})

0 commit comments

Comments
 (0)