mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-12 20:43:11 +08:00
chore: add script to adapt os memory (#48435)
* chore: add script to adapt os memory * update * update * use typescript * fix
This commit is contained in:
parent
2a23f50c1a
commit
bfa23e16a0
@ -87,7 +87,7 @@
|
|||||||
"sort:api-table": "antd-tools run sort-api-table",
|
"sort:api-table": "antd-tools run sort-api-table",
|
||||||
"sort:package-json": "npx sort-package-json",
|
"sort:package-json": "npx sort-package-json",
|
||||||
"prestart": "npm run version && npm run token:statistic && npm run token:meta && npm run lint:changelog",
|
"prestart": "npm run version && npm run token:statistic && npm run token:meta && npm run lint:changelog",
|
||||||
"start": "cross-env PORT=8001 dumi dev",
|
"start": "tsx ./scripts/set-node-options.ts cross-env PORT=8001 dumi dev",
|
||||||
"pretest": "npm run version",
|
"pretest": "npm run version",
|
||||||
"test": "jest --config .jest.js --no-cache",
|
"test": "jest --config .jest.js --no-cache",
|
||||||
"test:all": "sh -e ./scripts/test-all.sh",
|
"test:all": "sh -e ./scripts/test-all.sh",
|
||||||
|
14
scripts/set-node-options.ts
Normal file
14
scripts/set-node-options.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import os from 'os';
|
||||||
|
|
||||||
|
const childProcess = require('child_process');
|
||||||
|
|
||||||
|
const totalMemory = Math.floor(os.totalmem() / (1024 * 1024));
|
||||||
|
|
||||||
|
if (totalMemory <= 8192) {
|
||||||
|
// setting NODE_OPTIONS
|
||||||
|
process.env.NODE_OPTIONS = '--max-old-space-size=4096';
|
||||||
|
// Execute project startup command
|
||||||
|
const args: string[] = process.argv.slice(2);
|
||||||
|
|
||||||
|
childProcess.execSync(` ${args.join(' ')}`, { stdio: 'inherit' });
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user