Skip to content

Commit ced800d

Browse files
authored
Use npm and update bundling (#3846)
* Use npm and update bundling * Add pnpm to main action * Add missing package
1 parent 7f750a0 commit ced800d

19 files changed

Lines changed: 10668 additions & 5554 deletions

.claude/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"allow": [
44
"WebFetch(domain:prettier.io)",
55
"WebFetch(domain:code.visualstudio.com)",
6-
"Bash(pnpm prettier:*)",
7-
"Bash(pnpm lint:*)",
6+
"Bash(npm run prettier:*)",
7+
"Bash(npm run lint:*)",
88
"mcp__ide__getDiagnostics"
99
],
1010
"deny": [],

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121

2222
// Use 'postCreateCommand' to run commands after the container is created.
23-
"postCreateCommand": "pnpm install",
23+
"postCreateCommand": "npm install",
2424

2525
// Run as the node user for better security.
2626
"remoteUser": "node"

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
## Checklist
2121

2222
- [ ] I have read the [CONTRIBUTING](https://github.com/prettier/prettier-vscode/blob/main/CONTRIBUTING.md) guidelines
23-
- [ ] My code follows the code style of this project (`pnpm lint` passes)
24-
- [ ] I have run `pnpm prettier` to format my code
23+
- [ ] My code follows the code style of this project (`npm run lint` passes)
24+
- [ ] I have run `npm run prettier` to format my code
2525
- [ ] I have added/updated tests that prove my fix or feature works
26-
- [ ] All new and existing tests pass (`pnpm test`)
26+
- [ ] All new and existing tests pass (`npm test`)
2727
- [ ] I have updated the [CHANGELOG.md](https://github.com/prettier/prettier-vscode/blob/main/CHANGELOG.md) with a summary of my changes

.github/copilot-instructions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ This is the official Prettier VS Code extension (`prettier.prettier-vscode`). It
44

55
## Development
66

7-
- Use `pnpm` as the package manager
8-
- Run `pnpm install` to install dependencies
9-
- Run `pnpm compile` to build for development
10-
- Run `pnpm test` to run tests (no VS Code instance can be running)
11-
- Run `pnpm lint` to check linting
12-
- Run `pnpm prettier` to format code
7+
- Use `npm` as the package manager
8+
- Run `npm install` to install dependencies
9+
- Run `npm run compile` to build for development
10+
- Run `npm run test` to run tests (no VS Code instance can be running)
11+
- Run `npm run lint` to check linting
12+
- Run `npm run prettier` to format code
1313

1414
## Architecture
1515

.github/instructions/workflows.instructions.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ applyTo: ".github/workflows/*.yaml"
66

77
## Package Manager
88

9-
- Use `pnpm` as the package manager
10-
- Include `pnpm/action-setup@v4` before running pnpm commands
9+
- Use `npm` as the package manager
1110
- Use `actions/setup-node@v6` with `node-version-file: ".nvmrc"`
1211

1312
## Checkout and Setup Pattern
@@ -17,15 +16,15 @@ applyTo: ".github/workflows/*.yaml"
1716
- uses: actions/setup-node@v6
1817
with:
1918
node-version-file: ".nvmrc"
20-
- uses: pnpm/action-setup@v4
21-
- run: pnpm install
19+
- run: npm ci
2220
```
2321
2422
## Testing
2523
2624
- Linux tests require Xvfb for display: `/usr/bin/Xvfb :99 -screen 0 1024x768x24`
2725
- Set `DISPLAY: ":99.0"` environment variable for tests on Linux
28-
- Tests run via `pnpm test`
26+
- Tests run via `npm test`
27+
- Include `pnpm/action-setup@v4` in test jobs - some test fixtures use `packageManager: pnpm` to verify pnpm compatibility
2928

3029
## Permissions
3130

.github/workflows/main.yaml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ jobs:
1212
- uses: actions/setup-node@v6
1313
with:
1414
node-version-file: ".nvmrc"
15-
- uses: pnpm/action-setup@v4
16-
- run: pnpm install
17-
- run: pnpm lint
18-
- run: pnpm prettier --check
15+
- run: npm ci
16+
- run: npm run lint
17+
- run: npm run prettier -- --check
1918

2019
test:
2120
runs-on: ${{ matrix.os }}
@@ -29,16 +28,17 @@ jobs:
2928
- uses: actions/setup-node@v6
3029
with:
3130
node-version-file: ".nvmrc"
31+
# pnpm is needed for test fixtures that use packageManager: pnpm
3232
- uses: pnpm/action-setup@v4
33-
- run: corepack enable
34-
shell: bash
33+
with:
34+
version: 10
3535

3636
- run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo "Started xvfb"
3737
shell: bash
3838
if: ${{ success() && matrix.os == 'ubuntu-latest' }}
3939

40-
- run: pnpm install
41-
- run: pnpm test
40+
- run: npm ci
41+
- run: npm test
4242
env:
4343
DISPLAY: ":99.0"
4444

@@ -50,10 +50,10 @@ jobs:
5050
- uses: actions/setup-node@v6
5151
with:
5252
node-version-file: ".nvmrc"
53-
- uses: pnpm/action-setup@v4
54-
- run: pnpm install
55-
- run: pnpm exec playwright install --with-deps chromium
56-
- run: pnpm test:web
53+
- run: npm ci
54+
- run: npx playwright install --with-deps chromium
55+
- run: npm run test:web
56+
5757
package:
5858
runs-on: ubuntu-latest
5959
needs: [lint, test, test-web]
@@ -63,16 +63,16 @@ jobs:
6363
- uses: actions/setup-node@v6
6464
with:
6565
node-version-file: ".nvmrc"
66-
- uses: pnpm/action-setup@v4
67-
- run: pnpm install
68-
- run: pnpm compile
66+
- run: npm ci
67+
- run: npm run compile
6968
- run: npx @vscode/vsce package --no-dependencies
7069
- run: echo "VSIX_PATH=$(find . -maxdepth 1 -type f -iname "*.vsix" | head -1)" >> $GITHUB_ENV
7170
- run: echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV
7271
- uses: actions/upload-artifact@v5
7372
with:
7473
path: ${{ env.VSIX_PATH }}
7574
name: ${{ env.VSIX_NAME }}
75+
7676
release:
7777
runs-on: ubuntu-latest
7878
needs: package
@@ -83,7 +83,6 @@ jobs:
8383
- uses: actions/setup-node@v6
8484
with:
8585
node-version-file: ".nvmrc"
86-
- uses: pnpm/action-setup@v4
8786
- name: Check if prerelease
8887
id: check_prerelease
8988
run: |
@@ -92,8 +91,8 @@ jobs:
9291
else
9392
echo "is_prerelease=false" >> $GITHUB_OUTPUT
9493
fi
95-
- run: pnpm install
96-
- run: pnpm compile
94+
- run: npm ci
95+
- run: npm run compile
9796
- run: npx @vscode/vsce package --no-dependencies ${{ steps.check_prerelease.outputs.is_prerelease == 'true' && '--pre-release' || '' }}
9897
- run: echo "VSIX_PATH=$(find . -maxdepth 1 -type f -iname "*.vsix" | head -1)" >> $GITHUB_ENV
9998
- run: echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ node_modules
88
*.log
99
test-results.xml
1010

11-
# Generated pnpm lockfiles in test fixtures (npm lockfiles are tracked)
12-
test-fixtures/**/pnpm-lock.yaml
11+
# Generated lockfiles in test fixtures
12+
test-fixtures/**/package-lock.json
13+
test-fixtures/**/pnpm-lock.yaml
14+
test-fixtures/**/yarn.lock

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ out/
33
dist/
44
test-fixtures/
55
node_modules/
6-
pnpm-lock.yaml
6+
package-lock.json

.vscodeignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ tsconfig.scripts.json
1818
eslint.config.mjs
1919
lefthook.yml
2020
esbuild.mjs
21-
pnpm-lock.yaml
21+
package-lock.json
2222
dist/*.map
2323

2424
node_modules/

CLAUDE.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@ This is the official Prettier VS Code extension (`prettier.prettier-vscode`). It
1010

1111
```bash
1212
# Install dependencies
13-
pnpm install
13+
npm install
1414

1515
# Build for development
16-
pnpm compile
16+
npm run compile
1717

1818
# Build for production
19-
pnpm package
19+
npm run package
2020

2121
# Watch mode (esbuild + TypeScript type checking)
22-
pnpm watch
22+
npm run watch
2323

2424
# Run linting
25-
pnpm lint
25+
npm run lint
2626

2727
# Format code with Prettier
28-
pnpm prettier
28+
npm run prettier
2929

3030
# Run tests (requires no VS Code instance running)
31-
pnpm test
31+
npm test
3232

3333
# Run web extension tests (headless browser)
34-
pnpm test:web
34+
npm run test:web
3535

3636
# Compile tests only
37-
pnpm compile:test
37+
npm run compile:test
3838
```
3939

4040
## Running Tests
@@ -44,16 +44,16 @@ pnpm compile:test
4444
Tests require the `test-fixtures/` workspace and run inside a VS Code instance:
4545

4646
1. **Via VS Code Debug**: Open Debug sidebar → "Launch Tests"
47-
2. **Via CLI**: `pnpm test` (no VS Code instance can be running)
47+
2. **Via CLI**: `npm test` (no VS Code instance can be running)
4848

49-
Before running tests, `pnpm pretest` installs dependencies in various test fixture directories.
49+
Before running tests, `npm run pretest` installs dependencies in various test fixture directories.
5050

5151
### Web Extension Tests
5252

5353
Web tests run in a headless Chromium browser to verify the web extension works correctly:
5454

5555
```bash
56-
pnpm test:web
56+
npm run test:web
5757
```
5858

5959
Web tests are located in `src/test/web/suite/` and test the extension's browser functionality.
@@ -102,7 +102,7 @@ esbuild produces two bundles:
102102

103103
The browser build uses path aliasing to swap `ModuleResolver``BrowserModuleResolver`.
104104

105-
Build configuration is in `esbuild.js`.
105+
Build configuration is in `esbuild.mjs`.
106106

107107
## Test Fixtures
108108

0 commit comments

Comments
 (0)