@jayfong/x-server 2.81.0 → 2.82.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.
@@ -178,16 +178,22 @@ class BuildUtil {
178
178
  const distMultipleSchemaDir = _nodePath.default.join(distDir, _nodePath.default.basename(multipleSchemaDir));
179
179
  await _fsExtra.default.copy(multipleSchemaDir, distMultipleSchemaDir);
180
180
  }
181
-
182
- // 复制查询引擎
183
- const libqueryEngineFiles = await (0, _globby.default)('libquery_engine-*', {
184
- cwd: _nodePath.default.join(options.cwd, 'node_modules/.prisma/client'),
185
- ignore: ['libquery_engine-{darwin,windows}*'],
186
- onlyFiles: true,
187
- absolute: true
188
- });
189
- for (const libqueryEngineFile of libqueryEngineFiles) {
190
- await _fsExtra.default.copyFile(libqueryEngineFile, _nodePath.default.join(distDir, _nodePath.default.basename(libqueryEngineFile)));
181
+ if (!options.noPrismaEngine) {
182
+ // 复制查询引擎
183
+ const libqueryEngineFiles = await (0, _globby.default)('libquery_engine-*', {
184
+ cwd: _nodePath.default.join(options.cwd, 'node_modules/.prisma/client'),
185
+ ignore: ['libquery_engine-{darwin,windows}*'],
186
+ onlyFiles: true,
187
+ absolute: true
188
+ });
189
+ const prismaCliBinaryTargets = options.prismaCliBinaryTargets?.split(',') || [];
190
+ for (const libqueryEngineFile of libqueryEngineFiles) {
191
+ const libqueryEngineFileBaseName = _nodePath.default.basename(libqueryEngineFile);
192
+ if (prismaCliBinaryTargets.length && prismaCliBinaryTargets.every(prismaCliBinaryTarget => !libqueryEngineFile.includes(prismaCliBinaryTarget))) {
193
+ break;
194
+ }
195
+ await _fsExtra.default.copyFile(libqueryEngineFile, _nodePath.default.join(distDir, libqueryEngineFileBaseName));
196
+ }
191
197
  }
192
198
  }
193
199
 
@@ -164,6 +164,10 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
164
164
  describe: '构建时排除的文件',
165
165
  type: 'string',
166
166
  array: true
167
+ }).positional('no-prisma-engine', {
168
+ describe: '是否不包含 Prisma 引擎',
169
+ type: 'boolean',
170
+ default: false
167
171
  }), async argv => {
168
172
  await _env_util.EnvUtil.withChannel({
169
173
  cwd: process.cwd(),
@@ -201,7 +205,9 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
201
205
  onlyCode: true,
202
206
  beforeReplace: v => (0, _vtils.escapeRegExp)(v)
203
207
  });
204
- })
208
+ }),
209
+ prismaCliBinaryTargets: envMap.PRISMA_CLI_BINARY_TARGETS,
210
+ noPrismaEngine: argv['no-prisma-engine']
205
211
  });
206
212
  console.log('构建成功');
207
213
  if (argv.deploy) {
@@ -7,6 +7,8 @@ export interface BuildOptions {
7
7
  noInstall?: boolean;
8
8
  channel?: string;
9
9
  excludeFiles?: string[];
10
+ prismaCliBinaryTargets?: string;
11
+ noPrismaEngine?: boolean;
10
12
  }
11
13
  export declare class BuildUtil {
12
14
  static build(options: BuildOptions): Promise<void>;
@@ -172,16 +172,22 @@ export class BuildUtil {
172
172
  const distMultipleSchemaDir = path.join(distDir, path.basename(multipleSchemaDir));
173
173
  await fs.copy(multipleSchemaDir, distMultipleSchemaDir);
174
174
  }
175
-
176
- // 复制查询引擎
177
- const libqueryEngineFiles = await globby('libquery_engine-*', {
178
- cwd: path.join(options.cwd, 'node_modules/.prisma/client'),
179
- ignore: ['libquery_engine-{darwin,windows}*'],
180
- onlyFiles: true,
181
- absolute: true
182
- });
183
- for (const libqueryEngineFile of libqueryEngineFiles) {
184
- await fs.copyFile(libqueryEngineFile, path.join(distDir, path.basename(libqueryEngineFile)));
175
+ if (!options.noPrismaEngine) {
176
+ // 复制查询引擎
177
+ const libqueryEngineFiles = await globby('libquery_engine-*', {
178
+ cwd: path.join(options.cwd, 'node_modules/.prisma/client'),
179
+ ignore: ['libquery_engine-{darwin,windows}*'],
180
+ onlyFiles: true,
181
+ absolute: true
182
+ });
183
+ const prismaCliBinaryTargets = options.prismaCliBinaryTargets?.split(',') || [];
184
+ for (const libqueryEngineFile of libqueryEngineFiles) {
185
+ const libqueryEngineFileBaseName = path.basename(libqueryEngineFile);
186
+ if (prismaCliBinaryTargets.length && prismaCliBinaryTargets.every(prismaCliBinaryTarget => !libqueryEngineFile.includes(prismaCliBinaryTarget))) {
187
+ break;
188
+ }
189
+ await fs.copyFile(libqueryEngineFile, path.join(distDir, libqueryEngineFileBaseName));
190
+ }
185
191
  }
186
192
  }
187
193
 
package/lib/cli/cli.js CHANGED
@@ -162,6 +162,10 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
162
162
  describe: '构建时排除的文件',
163
163
  type: 'string',
164
164
  array: true
165
+ }).positional('no-prisma-engine', {
166
+ describe: '是否不包含 Prisma 引擎',
167
+ type: 'boolean',
168
+ default: false
165
169
  }), async argv => {
166
170
  await EnvUtil.withChannel({
167
171
  cwd: process.cwd(),
@@ -199,7 +203,9 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
199
203
  onlyCode: true,
200
204
  beforeReplace: v => escapeRegExp(v)
201
205
  });
202
- })
206
+ }),
207
+ prismaCliBinaryTargets: envMap.PRISMA_CLI_BINARY_TARGETS,
208
+ noPrismaEngine: argv['no-prisma-engine']
203
209
  });
204
210
  console.log('构建成功');
205
211
  if (argv.deploy) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.81.0",
3
+ "version": "2.82.0",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",