@jayfong/x-server 2.88.1 → 2.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,7 +58,9 @@ class BuildUtil {
58
58
  } catch {}
59
59
 
60
60
  // 构建
61
- await _fsExtra.default.emptyDir(distDir);
61
+ if (!options.noEmptyDistDir) {
62
+ await _fsExtra.default.emptyDir(distDir);
63
+ }
62
64
  // @ts-ignore
63
65
  const {
64
66
  default: macrosPlugin
@@ -140,11 +140,10 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
140
140
  describe: '是否压缩',
141
141
  type: 'boolean',
142
142
  default: true
143
- }).positional('no-install', {
144
- alias: 'n',
145
- describe: '是否不本地安装外部依赖',
143
+ }).positional('local-install', {
144
+ describe: '是否本地安装外部依赖',
146
145
  type: 'boolean',
147
- default: false
146
+ default: true
148
147
  }).positional('channel', {
149
148
  alias: 'h',
150
149
  describe: '渠道',
@@ -164,10 +163,16 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
164
163
  describe: '构建时排除的文件',
165
164
  type: 'string',
166
165
  array: true
167
- }).positional('no-prisma-engine', {
168
- describe: '是否不包含 Prisma 引擎',
166
+ })
167
+ // 注意:不要加 no 前缀,其会自动处理
168
+ .positional('prisma-engine', {
169
+ describe: '是否包含 Prisma 引擎',
169
170
  type: 'boolean',
170
- default: false
171
+ default: true
172
+ }).positional('empty-dist-dir', {
173
+ describe: '是否清空构建目录',
174
+ type: 'boolean',
175
+ default: true
171
176
  }), async argv => {
172
177
  await _env_util.EnvUtil.withChannel({
173
178
  cwd: process.cwd(),
@@ -197,7 +202,7 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
197
202
  external: externals,
198
203
  inlineEnvs: envMap,
199
204
  minify: argv.minify,
200
- noInstall: argv['no-install'],
205
+ noInstall: argv['local-install'] === false,
201
206
  channel: channel,
202
207
  excludeFiles: (argv.exclude ? (0, _vtils.castArray)(argv.exclude) : []).map(item => {
203
208
  return _vtils.StringTemplate.render(item, envMap, {
@@ -207,7 +212,8 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
207
212
  });
208
213
  }),
209
214
  prismaCliBinaryTargets: envMap.PRISMA_CLI_BINARY_TARGETS,
210
- noPrismaEngine: argv['no-prisma-engine']
215
+ noPrismaEngine: argv['prisma-engine'] === false,
216
+ noEmptyDistDir: argv['empty-dist-dir'] === false
211
217
  });
212
218
  console.log('构建成功');
213
219
  if (argv.deploy) {
@@ -9,6 +9,7 @@ export interface BuildOptions {
9
9
  excludeFiles?: string[];
10
10
  prismaCliBinaryTargets?: string;
11
11
  noPrismaEngine?: boolean;
12
+ noEmptyDistDir?: boolean;
12
13
  }
13
14
  export declare class BuildUtil {
14
15
  static build(options: BuildOptions): Promise<void>;
@@ -52,7 +52,9 @@ export class BuildUtil {
52
52
  } catch {}
53
53
 
54
54
  // 构建
55
- await fs.emptyDir(distDir);
55
+ if (!options.noEmptyDistDir) {
56
+ await fs.emptyDir(distDir);
57
+ }
56
58
  // @ts-ignore
57
59
  const {
58
60
  default: macrosPlugin
package/lib/cli/cli.js CHANGED
@@ -138,11 +138,10 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
138
138
  describe: '是否压缩',
139
139
  type: 'boolean',
140
140
  default: true
141
- }).positional('no-install', {
142
- alias: 'n',
143
- describe: '是否不本地安装外部依赖',
141
+ }).positional('local-install', {
142
+ describe: '是否本地安装外部依赖',
144
143
  type: 'boolean',
145
- default: false
144
+ default: true
146
145
  }).positional('channel', {
147
146
  alias: 'h',
148
147
  describe: '渠道',
@@ -162,10 +161,16 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
162
161
  describe: '构建时排除的文件',
163
162
  type: 'string',
164
163
  array: true
165
- }).positional('no-prisma-engine', {
166
- describe: '是否不包含 Prisma 引擎',
164
+ })
165
+ // 注意:不要加 no 前缀,其会自动处理
166
+ .positional('prisma-engine', {
167
+ describe: '是否包含 Prisma 引擎',
167
168
  type: 'boolean',
168
- default: false
169
+ default: true
170
+ }).positional('empty-dist-dir', {
171
+ describe: '是否清空构建目录',
172
+ type: 'boolean',
173
+ default: true
169
174
  }), async argv => {
170
175
  await EnvUtil.withChannel({
171
176
  cwd: process.cwd(),
@@ -195,7 +200,7 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
195
200
  external: externals,
196
201
  inlineEnvs: envMap,
197
202
  minify: argv.minify,
198
- noInstall: argv['no-install'],
203
+ noInstall: argv['local-install'] === false,
199
204
  channel: channel,
200
205
  excludeFiles: (argv.exclude ? castArray(argv.exclude) : []).map(item => {
201
206
  return StringTemplate.render(item, envMap, {
@@ -205,7 +210,8 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
205
210
  });
206
211
  }),
207
212
  prismaCliBinaryTargets: envMap.PRISMA_CLI_BINARY_TARGETS,
208
- noPrismaEngine: argv['no-prisma-engine']
213
+ noPrismaEngine: argv['prisma-engine'] === false,
214
+ noEmptyDistDir: argv['empty-dist-dir'] === false
209
215
  });
210
216
  console.log('构建成功');
211
217
  if (argv.deploy) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.88.1",
3
+ "version": "2.89.0",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",