2.3.7-dev

This commit is contained in:
Xu Chang 2023-04-14 18:13:16 +08:00
parent e4ef4ec482
commit d9e34f8298
2 changed files with 40 additions and 56 deletions

View File

@ -17,33 +17,25 @@ async function build(cmd) {
? `split:${!!cmd.split}` ? `split:${!!cmd.split}`
: ''}`)}`); : ''}`)}`);
if (cmd.target === 'mp' || cmd.target === 'wechatMp') { if (cmd.target === 'mp' || cmd.target === 'wechatMp') {
const result = cross_spawn_1.default.sync( const result = cross_spawn_1.default.sync(`cross-env`, [
`cross-env`, `NODE_ENV=${cmd.mode}`,
[ `NODE_TARGET=${cmd.target}`,
`NODE_ENV=${cmd.mode}`, `SUB_DIR_NAME=${cmd.subDir || 'wechatMp'}`,
`NODE_TARGET=${cmd.target}`, `TSC_COMPILE_ON_ERROR=${TSC_COMPILE_ON_ERROR}`,
`SUB_DIR_NAME=${cmd.subDir || 'wechatMp'}`, `COMPILE_ANALYZE=${!!cmd.analyze}`,
`TSC_COMPILE_ON_ERROR=${TSC_COMPILE_ON_ERROR}`, `GENERATE_SOURCEMAP=${!!cmd.sourcemap}`,
`COMPILE_ANALYZE=${!!cmd.analyze}`, `PROD=${!!cmd.prod}`,
`GENERATE_SOURCEMAP=${!!cmd.sourcemap}`, `SPLIT=${!!cmd.split}`,
`PROD=${!!cmd.prod}`, !!cmd.memoryLimit && `MEMORY_LIMIT=${cmd.memoryLimit}`,
`SPLIT=${!!cmd.split}`, `node`,
!!cmd.memoryLimit && `MEMORY_LIMIT=${cmd.memoryLimit}`, cmd.memoryLimit && `--max_old_space_size=${cmd.memoryLimit}`,
`node`, require.resolve(`../scripts/${cmd.mode === 'production'
cmd.memoryLimit && `--max_old_space_size=${cmd.memoryLimit}`, ? 'build-mp.js'
require.resolve( : 'start-mp.js'}`),
`../scripts/${ ].filter(Boolean), {
cmd.mode === 'production' stdio: 'inherit',
? 'build-mp.js' shell: true,
: 'start-mp.js' });
}`
),
].filter(Boolean),
{
stdio: 'inherit',
shell: true,
}
);
if (result.status === 0) { if (result.status === 0) {
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`执行完成`)}`); (0, tip_style_1.Success)(`${(0, tip_style_1.success)(`执行完成`)}`);
} }
@ -52,32 +44,24 @@ async function build(cmd) {
} }
} }
else if (cmd.target === 'web') { else if (cmd.target === 'web') {
const result = cross_spawn_1.default.sync( const result = cross_spawn_1.default.sync(`cross-env`, [
`cross-env`, `NODE_ENV=${cmd.mode}`,
[ `NODE_TARGET=${cmd.target}`,
`NODE_ENV=${cmd.mode}`, `SUB_DIR_NAME=${cmd.subDir || 'web'}`,
`NODE_TARGET=${cmd.target}`, `TSC_COMPILE_ON_ERROR=${TSC_COMPILE_ON_ERROR}`,
`SUB_DIR_NAME=${cmd.subDir || 'web'}`, `COMPILE_ANALYZE=${!!cmd.analyze}`,
`TSC_COMPILE_ON_ERROR=${TSC_COMPILE_ON_ERROR}`, `GENERATE_SOURCEMAP=${!!cmd.sourcemap}`,
`COMPILE_ANALYZE=${!!cmd.analyze}`, `PROD=${!!cmd.prod}`,
`GENERATE_SOURCEMAP=${!!cmd.sourcemap}`, !!cmd.memoryLimit && `MEMORY_LIMIT=${cmd.memoryLimit}`,
`PROD=${!!cmd.prod}`, `node`,
!!cmd.memoryLimit && `MEMORY_LIMIT=${cmd.memoryLimit}`, cmd.memoryLimit && `--max_old_space_size=${cmd.memoryLimit}`,
`node`, require.resolve(`../scripts/${cmd.mode === 'production'
cmd.memoryLimit && `--max_old_space_size=${cmd.memoryLimit}`, ? 'build-web.js'
require.resolve( : 'start-web.js'}`),
`../scripts/${ ].filter(Boolean), {
cmd.mode === 'production' stdio: 'inherit',
? 'build-web.js' shell: true,
: 'start-web.js' });
}`
),
].filter(Boolean),
{
stdio: 'inherit',
shell: true,
}
);
if (result.status === 0) { if (result.status === 0) {
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`执行完成`)}`); (0, tip_style_1.Success)(`${(0, tip_style_1.success)(`执行完成`)}`);
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@xuchangzju/oak-cli", "name": "@xuchangzju/oak-cli",
"version": "2.3.6", "version": "2.3.7",
"description": "oak-cli脚手架", "description": "oak-cli脚手架",
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {
@ -86,8 +86,8 @@
"loader-utils": "^3.2.0", "loader-utils": "^3.2.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mini-css-extract-plugin": "^2.5.3", "mini-css-extract-plugin": "^2.5.3",
"oak-backend-base": "^2.4.1", "oak-backend-base": "file:../oak-backend-base",
"oak-domain": "^2.6.8", "oak-domain": "file:../oak-domain",
"postcss": "^8.4.4", "postcss": "^8.4.4",
"postcss-flexbugs-fixes": "^5.0.2", "postcss-flexbugs-fixes": "^5.0.2",
"postcss-less": "^6.0.0", "postcss-less": "^6.0.0",