Skip to content

Commit

Permalink
chore: Switch from npm to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
cmfcmf committed Nov 10, 2024
1 parent 342913d commit 4ceb1d5
Show file tree
Hide file tree
Showing 12 changed files with 14,090 additions and 62 deletions.
30 changes: 17 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,36 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache: "pnpm"

- run: npm ci
- run: npm run lint
- run: pnpm install
- run: pnpm run lint

- 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 }}'
- run: npm dedupe
- run: pnpm 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 }}'
- run: pnpm dedupe

- run: npm run build
- run: pnpm run build

- run: npm run test
- run: pnpm run test

# Install OS dependencies
# Run `apt update` beforehand to avoid 404 Not Found errors during apt install.
- run: sudo apt update
if: runner.os == 'Linux'
- run: npx playwright install-deps
- run: pnpm exec playwright install-deps
# Install Browsers
- run: npx playwright install
- run: npm run test:e2e -- -- --browser=all --forbid-only
- run: pnpm exec playwright install
- run: pnpm run test:e2e -- -- --browser=all --forbid-only

# TODO: Cannot run browser tests for these for now.
- run: npm run build -w example-docs -- --config docusaurus.config.noTrailingSlash.js
- run: npm run build -w example-docs -- --config docusaurus.config.subDirectory.js
- run: npm run build -w example-docs -- --config docusaurus.config.noTrailingSlashSubdirectory.js
- run: pnpm run build -w example-docs -- --config docusaurus.config.noTrailingSlash.js
- run: pnpm run build -w example-docs -- --config docusaurus.config.subDirectory.js
- run: pnpm run build -w example-docs -- --config docusaurus.config.noTrailingSlashSubdirectory.js
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ lunr.js
lib
.husky
.vscode
example-docs
example-docs
pnpm-lock.yaml
4 changes: 2 additions & 2 deletions .syncpackrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"label": "Example Docs must always use the local version of the search plugin",
"packages": ["example-docs"],
"dependencies": ["@cmfcmf/docusaurus-search-local"],
"pinVersion": "*"
"pinVersion": "workspace:*"
},
{
"label": "The Docusaurus dev dependencies must all have the highest version supported by the plugin.",
"packages": ["**"],
"dependencies": ["@docusaurus/**"],
"dependencyTypes": ["dev"],
"pinVersion": "^2.4.3"
"pinVersion": "catalog:"
},
{
"label": "The Docusaurus peer dependencies must all have the lowest version supported by the plugin.",
Expand Down
4 changes: 2 additions & 2 deletions .versionrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ module.exports = {
sign: true,
scripts: {
// Make sure that there is nothing to format before generating the changelog.
prechangelog: "npm run lint",
prechangelog: "pnpm run lint",
// Format the generated changelog.
postchangelog: "npm run format",
postchangelog: "pnpm run format",
},
header: `\
# Change Log
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Thank you for your interest in contributing to the project!
To get up and running, follow these steps:

1. Clone the repository
2. Install dependencies: `npm install`
3. Build everything `npm run build`
4. Run tests: `npm run test`
2. Install dependencies: `pnpm install`
3. Build everything `pnpm run build`
4. Run tests: `pnpm run test`
5. Run end to end tests using Playwright:
```bash
npm run test:e2e # add `-- -- --debug` to step through the tests
pnpm run test:e2e # add `-- -- --debug` to step through the tests
```
6. Test search manually: `npm run serve`
6. Test search manually: `pnpm run serve`

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))

Expand Down
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"name": "root",
"private": true,
"workspaces": [
"packages/*"
],
"dependencies": {
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
Expand Down Expand Up @@ -38,7 +35,7 @@
},
"engines": {
"node": ">=18.18",
"npm": ">=10"
"pnpm": ">=9"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]"
}
28 changes: 14 additions & 14 deletions packages/docusaurus-search-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,36 +49,36 @@
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.21.0",
"@docusaurus/module-type-aliases": "^2.4.3",
"@docusaurus/plugin-content-blog": "^2.4.3",
"@docusaurus/plugin-content-docs": "^2.4.3",
"@docusaurus/plugin-content-pages": "^2.4.3",
"@docusaurus/theme-classic": "^2.4.3",
"@docusaurus/theme-common": "^2.4.3",
"@docusaurus/types": "^2.4.3",
"@docusaurus/utils-validation": "^2.4.3",
"@docusaurus/module-type-aliases": "catalog:",
"@docusaurus/plugin-content-blog": "catalog:",
"@docusaurus/plugin-content-docs": "catalog:",
"@docusaurus/plugin-content-pages": "catalog:",
"@docusaurus/theme-classic": "catalog:",
"@docusaurus/theme-common": "catalog:",
"@docusaurus/types": "catalog:",
"@docusaurus/utils-validation": "catalog:",
"@playwright/test": "^1.31.1",
"@types/jest": "^29.4.0",
"@types/lunr": "^2.3.3",
"@types/mark.js": "^8.11.7",
"@types/react": "^17",
"@types/react-dom": "^17",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"babel-jest": "^29.4.3",
"concurrently": "^7.0.0",
"copyfiles": "^2.4.1",
"jest": "^29.4.3",
"nodejieba": "^2.5.0 || ^3.0.0",
"nodemon": "^2.0.15",
"playwright": "^1.31.1",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react": "catalog:",
"react-dom": "catalog:",
"typescript": "^5.0.0"
},
"scripts": {
"build:client": "tsc --project tsconfig.client.json && copyfiles --up 1 src/client/**/*.css lib",
"build:server": "tsc --project tsconfig.server.json && copyfiles --up 1 src/lunr.js src/server/lunr-generator.js lib",
"dev": "concurrently --names client,server --prefix-colors blue,green npm:dev:client npm:dev:server",
"dev:client": "concurrently --names tsc,cp npm:dev:client:tsc npm:dev:client:cp",
"dev": "concurrently --names client,server --prefix-colors blue,green pnpm:dev:client pnpm:dev:server",
"dev:client": "concurrently --names tsc,cp pnpm:dev:client:tsc pnpm:dev:client:cp",
"dev:client:tsc": "tsc --project tsconfig.client.json --watch",
"dev:client:cp": "nodemon --watch src/client --ext css --exec \"copyfiles --up 1 src/client/**/*.css lib && touch lib/client/theme/SearchBar/index.js\" ",
"dev:server": "tsc --project tsconfig.server.json --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-search-local/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from "@playwright/test";
export default defineConfig({
webServer: {
command: "npm run serve -- -- --port 3001",
command: "pnpm run serve -- -- --port 3001",
cwd: "../..",
url: "http://localhost:3001/",
timeout: 180 * 1000,
Expand Down
14 changes: 6 additions & 8 deletions packages/example-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
"serve": "docusaurus serve"
},
"dependencies": {
"@cmfcmf/docusaurus-search-local": "*",
"@cmfcmf/docusaurus-search-local": "workspace:*",
"@docusaurus/core": "catalog:",
"@docusaurus/preset-classic": "catalog:",
"@mdx-js/react": "^1.6.21",
"clsx": "^1.1.1"
},
"peerDependencies": {
"@docusaurus/core": "^2.0.0",
"@docusaurus/preset-classic": "^2.0.0",
"react": "^17.0.0",
"react-dom": "^17.0.0"
"clsx": "^1.1.1",
"react": "catalog:",
"react-dom": "catalog:"
},
"browserslist": {
"production": [
Expand Down
Loading

0 comments on commit 4ceb1d5

Please sign in to comment.