模板中添加server:start:watch和build:watch命令

This commit is contained in:
pqcqaq 2024-11-29 13:29:33 +08:00
parent e40639fad7
commit 17e074a06c
1 changed files with 4 additions and 3 deletions

View File

@ -68,7 +68,8 @@ export function packageJsonContent({
const serverInitScript = isDev ? "cross-env NODE_ENV=development cross-env OAK_PLATFORM=server node scripts/initServer.js" : "cross-env OAK_PLATFORM=server node scripts/initServer.js"; const serverInitScript = isDev ? "cross-env NODE_ENV=development cross-env OAK_PLATFORM=server node scripts/initServer.js" : "cross-env OAK_PLATFORM=server node scripts/initServer.js";
const serverStartScript = isDev ? "cross-env NODE_ENV=development cross-env OAK_PLATFORM=server node scripts/startServer.js" : "cross-env OAK_PLATFORM=server node scripts/startServer.js"; const serverStartScript = isDev ? "cross-env NODE_ENV=development cross-env OAK_PLATFORM=server node scripts/startServer.js" : "cross-env OAK_PLATFORM=server node scripts/startServer.js";
return `{ const serverStartWatchScript = isDev ? "cross-env NODE_ENV=development cross-env OAK_PLATFORM=server node --stack-size=65500 scripts/watchServer.js" : "cross-env OAK_PLATFORM=server node --stack-size=65500 scripts/watchServer.js";
return `{
"name": "${name}", "name": "${name}",
"version": "${version}", "version": "${version}",
"description": "${description}", "description": "${description}",
@ -87,8 +88,7 @@ export function packageJsonContent({
"build-analyze:mp:staging": "${cliBinName} build --target mp --mode staging --analyze", "build-analyze:mp:staging": "${cliBinName} build --target mp --mode staging --analyze",
"build:mp": "${cliBinName} build --target mp --mode production", "build:mp": "${cliBinName} build --target mp --mode production",
"build-analyze:mp": "${cliBinName} build --target mp --mode production --analyze", "build-analyze:mp": "${cliBinName} build --target mp --mode production --analyze",
"build:watch": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && npm run copy-config-json && npm run watch:server", "build:watch": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && npm run copy-config-json && npm run server:start:watch",
"watch:server": "node --stack-size=65500 scripts/watchServer.js",
"start:web": "${cliBinName} start --target web --mode development --devMode frontend", "start:web": "${cliBinName} start --target web --mode development --devMode frontend",
"start:web:server": "${cliBinName} start --target web --mode development", "start:web:server": "${cliBinName} start --target web --mode development",
"start:native": "${cliBinName} start --target rn --mode development --devMode frontend", "start:native": "${cliBinName} start --target rn --mode development --devMode frontend",
@ -106,6 +106,7 @@ export function packageJsonContent({
"run:android": "oak-cli run -p android", "run:android": "oak-cli run -p android",
"server:init": "${serverInitScript}", "server:init": "${serverInitScript}",
"server:start": "${serverStartScript}", "server:start": "${serverStartScript}",
"server:start:watch": "${serverStartWatchScript}",
"postinstall": "npm run make:dep" "postinstall": "npm run make:dep"
}, },
"keywords": [], "keywords": [],