Skip to content

Commit 66192d4

Browse files
committed
chore: Switch from npm to pnpm
1 parent 342913d commit 66192d4

File tree

12 files changed

+14090
-62
lines changed

12 files changed

+14090
-62
lines changed

.github/workflows/main.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,36 @@ jobs:
3434

3535
steps:
3636
- uses: actions/checkout@v4
37+
- uses: pnpm/action-setup@v4
38+
name: Install pnpm
39+
with:
40+
run_install: false
3741
- name: Use Node.js ${{ matrix.node-version }}
3842
uses: actions/setup-node@v4
3943
with:
4044
node-version: ${{ matrix.node-version }}
41-
cache: "npm"
45+
cache: "pnpm"
4246

43-
- run: npm ci
44-
- run: npm run lint
47+
- run: pnpm install
48+
- run: pnpm run lint
4549

46-
- run: npm install --workspaces --save-dev '@docusaurus/core@${{ matrix.docusaurus-version }}' '@docusaurus/preset-classic@${{ matrix.docusaurus-version }}' '@docusaurus/module-type-aliases@${{ matrix.docusaurus-version }}' '@docusaurus/plugin-content-blog@${{ matrix.docusaurus-version }}' '@docusaurus/plugin-content-docs@${{ matrix.docusaurus-version }}' '@docusaurus/plugin-content-pages@${{ matrix.docusaurus-version }}' '@docusaurus/theme-common@${{ matrix.docusaurus-version }}' '@docusaurus/theme-classic@${{ matrix.docusaurus-version }}' '@docusaurus/types@${{ matrix.docusaurus-version }}'
47-
- run: npm dedupe
50+
- run: pnpm -r add --save-dev '@docusaurus/core@${{ matrix.docusaurus-version }}' '@docusaurus/preset-classic@${{ matrix.docusaurus-version }}' '@docusaurus/module-type-aliases@${{ matrix.docusaurus-version }}' '@docusaurus/plugin-content-blog@${{ matrix.docusaurus-version }}' '@docusaurus/plugin-content-docs@${{ matrix.docusaurus-version }}' '@docusaurus/plugin-content-pages@${{ matrix.docusaurus-version }}' '@docusaurus/theme-common@${{ matrix.docusaurus-version }}' '@docusaurus/theme-classic@${{ matrix.docusaurus-version }}' '@docusaurus/types@${{ matrix.docusaurus-version }}'
51+
- run: pnpm dedupe
4852

49-
- run: npm run build
53+
- run: pnpm run build
5054

51-
- run: npm run test
55+
- run: pnpm run test
5256

5357
# Install OS dependencies
5458
# Run `apt update` beforehand to avoid 404 Not Found errors during apt install.
5559
- run: sudo apt update
5660
if: runner.os == 'Linux'
57-
- run: npx playwright install-deps
61+
- run: pnpm --filter docusaurus-search-local --fail-if-no-match exec playwright install-deps
5862
# Install Browsers
59-
- run: npx playwright install
60-
- run: npm run test:e2e -- -- --browser=all --forbid-only
63+
- run: pnpm --filter docusaurus-search-local --fail-if-no-match exec playwright install
64+
- run: pnpm run test:e2e -- --browser=all --forbid-only
6165

6266
# TODO: Cannot run browser tests for these for now.
63-
- run: npm run build -w example-docs -- --config docusaurus.config.noTrailingSlash.js
64-
- run: npm run build -w example-docs -- --config docusaurus.config.subDirectory.js
65-
- run: npm run build -w example-docs -- --config docusaurus.config.noTrailingSlashSubdirectory.js
67+
- run: pnpm run build -w example-docs -- --config docusaurus.config.noTrailingSlash.js
68+
- run: pnpm run build -w example-docs -- --config docusaurus.config.subDirectory.js
69+
- run: pnpm run build -w example-docs -- --config docusaurus.config.noTrailingSlashSubdirectory.js

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ lunr.js
22
lib
33
.husky
44
.vscode
5-
example-docs
5+
example-docs
6+
pnpm-lock.yaml

.syncpackrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
"label": "Example Docs must always use the local version of the search plugin",
1010
"packages": ["example-docs"],
1111
"dependencies": ["@cmfcmf/docusaurus-search-local"],
12-
"pinVersion": "*"
12+
"pinVersion": "workspace:*"
1313
},
1414
{
1515
"label": "The Docusaurus dev dependencies must all have the highest version supported by the plugin.",
1616
"packages": ["**"],
1717
"dependencies": ["@docusaurus/**"],
1818
"dependencyTypes": ["dev"],
19-
"pinVersion": "^2.4.3"
19+
"pinVersion": "catalog:"
2020
},
2121
{
2222
"label": "The Docusaurus peer dependencies must all have the lowest version supported by the plugin.",

.versionrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ module.exports = {
66
sign: true,
77
scripts: {
88
// Make sure that there is nothing to format before generating the changelog.
9-
prechangelog: "npm run lint",
9+
prechangelog: "pnpm run lint",
1010
// Format the generated changelog.
11-
postchangelog: "npm run format",
11+
postchangelog: "pnpm run format",
1212
},
1313
header: `\
1414
# Change Log

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ Thank you for your interest in contributing to the project!
55
To get up and running, follow these steps:
66

77
1. Clone the repository
8-
2. Install dependencies: `npm install`
9-
3. Build everything `npm run build`
10-
4. Run tests: `npm run test`
8+
2. Install dependencies: `pnpm install`
9+
3. Build everything `pnpm run build`
10+
4. Run tests: `pnpm run test`
1111
5. Run end to end tests using Playwright:
1212
```bash
13-
npm run test:e2e # add `-- -- --debug` to step through the tests
13+
pnpm run test:e2e # add `-- -- --debug` to step through the tests
1414
```
15-
6. Test search manually: `npm run serve`
15+
6. Test search manually: `pnpm run serve`
1616

1717
You can view debug information at http://localhost:3000/\_\_docusaurus/debug (generated by [@docusaurus/plugin-debug](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-debug))
1818

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"name": "root",
33
"private": true,
4-
"workspaces": [
5-
"packages/*"
6-
],
74
"dependencies": {
85
"@commitlint/cli": "^17.8.1",
96
"@commitlint/config-conventional": "^17.8.1",
@@ -38,7 +35,7 @@
3835
},
3936
"engines": {
4037
"node": ">=18.18",
41-
"npm": ">=10"
38+
"pnpm": ">=9"
4239
},
43-
"packageManager": "[email protected]"
40+
"packageManager": "[email protected]"
4441
}

packages/docusaurus-search-local/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,36 +49,36 @@
4949
"@babel/core": "^7.21.0",
5050
"@babel/preset-env": "^7.20.2",
5151
"@babel/preset-typescript": "^7.21.0",
52-
"@docusaurus/module-type-aliases": "^2.4.3",
53-
"@docusaurus/plugin-content-blog": "^2.4.3",
54-
"@docusaurus/plugin-content-docs": "^2.4.3",
55-
"@docusaurus/plugin-content-pages": "^2.4.3",
56-
"@docusaurus/theme-classic": "^2.4.3",
57-
"@docusaurus/theme-common": "^2.4.3",
58-
"@docusaurus/types": "^2.4.3",
59-
"@docusaurus/utils-validation": "^2.4.3",
52+
"@docusaurus/module-type-aliases": "catalog:",
53+
"@docusaurus/plugin-content-blog": "catalog:",
54+
"@docusaurus/plugin-content-docs": "catalog:",
55+
"@docusaurus/plugin-content-pages": "catalog:",
56+
"@docusaurus/theme-classic": "catalog:",
57+
"@docusaurus/theme-common": "catalog:",
58+
"@docusaurus/types": "catalog:",
59+
"@docusaurus/utils-validation": "catalog:",
6060
"@playwright/test": "^1.31.1",
6161
"@types/jest": "^29.4.0",
6262
"@types/lunr": "^2.3.3",
6363
"@types/mark.js": "^8.11.7",
64-
"@types/react": "^17",
65-
"@types/react-dom": "^17",
64+
"@types/react": "catalog:",
65+
"@types/react-dom": "catalog:",
6666
"babel-jest": "^29.4.3",
6767
"concurrently": "^7.0.0",
6868
"copyfiles": "^2.4.1",
6969
"jest": "^29.4.3",
7070
"nodejieba": "^2.5.0 || ^3.0.0",
7171
"nodemon": "^2.0.15",
7272
"playwright": "^1.31.1",
73-
"react": "^17.0.0",
74-
"react-dom": "^17.0.0",
73+
"react": "catalog:",
74+
"react-dom": "catalog:",
7575
"typescript": "^5.0.0"
7676
},
7777
"scripts": {
7878
"build:client": "tsc --project tsconfig.client.json && copyfiles --up 1 src/client/**/*.css lib",
7979
"build:server": "tsc --project tsconfig.server.json && copyfiles --up 1 src/lunr.js src/server/lunr-generator.js lib",
80-
"dev": "concurrently --names client,server --prefix-colors blue,green npm:dev:client npm:dev:server",
81-
"dev:client": "concurrently --names tsc,cp npm:dev:client:tsc npm:dev:client:cp",
80+
"dev": "concurrently --names client,server --prefix-colors blue,green pnpm:dev:client pnpm:dev:server",
81+
"dev:client": "concurrently --names tsc,cp pnpm:dev:client:tsc pnpm:dev:client:cp",
8282
"dev:client:tsc": "tsc --project tsconfig.client.json --watch",
8383
"dev:client:cp": "nodemon --watch src/client --ext css --exec \"copyfiles --up 1 src/client/**/*.css lib && touch lib/client/theme/SearchBar/index.js\" ",
8484
"dev:server": "tsc --project tsconfig.server.json --watch",

packages/docusaurus-search-local/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig } from "@playwright/test";
22
export default defineConfig({
33
webServer: {
4-
command: "npm run serve -- -- --port 3001",
4+
command: "pnpm run serve -- --port 3001",
55
cwd: "../..",
66
url: "http://localhost:3001/",
77
timeout: 180 * 1000,

packages/example-docs/package.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
"serve": "docusaurus serve"
88
},
99
"dependencies": {
10-
"@cmfcmf/docusaurus-search-local": "*",
10+
"@cmfcmf/docusaurus-search-local": "workspace:*",
11+
"@docusaurus/core": "catalog:",
12+
"@docusaurus/preset-classic": "catalog:",
1113
"@mdx-js/react": "^1.6.21",
12-
"clsx": "^1.1.1"
13-
},
14-
"peerDependencies": {
15-
"@docusaurus/core": "^2.0.0",
16-
"@docusaurus/preset-classic": "^2.0.0",
17-
"react": "^17.0.0",
18-
"react-dom": "^17.0.0"
14+
"clsx": "^1.1.1",
15+
"react": "catalog:",
16+
"react-dom": "catalog:"
1917
},
2018
"browserslist": {
2119
"production": [

0 commit comments

Comments
 (0)