Skip to content

Commit

Permalink
feat: 启动命令兼容pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
Rain120 committed Dec 25, 2024
1 parent a5b3620 commit 88dbbb3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"size-limit": "size-limit",
"sort:api-table": "antd-tools run sort-api-table",
"sort:package-json": "npx sort-package-json",
"dev": "if [\"$npm_execpath\"=\"$(which pnpm)\"];then pnpm run prestart && pnpm start; else npm start; fi",
"dev": "tsx ./scripts/dev-manager.ts",
"prestart": "npm run version && npm run token:statistic && npm run token:meta && npm run lint:changelog",
"start": "tsx ./scripts/set-node-options.ts cross-env PORT=8001 dumi dev",
"pretest": "npm run version",
Expand Down
13 changes: 13 additions & 0 deletions scripts/dev-manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { execSync } from 'child_process';

try {
const isPnpm = process.env.npm_execpath?.includes('pnpm');

if (isPnpm) {
execSync('pnpm run prestart && pnpm start', { stdio: 'inherit' });
} else {
execSync('npm start', { stdio: 'inherit' });
}
} catch (error) {
process.exit(1);
}

0 comments on commit 88dbbb3

Please sign in to comment.