@jayfong/x-server 1.11.3 → 1.11.6

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.11.6](https://github.com/jfWorks/x-server/compare/v1.11.5...v1.11.6) (2022-04-21)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * initHelperPackage ([5ddae6a](https://github.com/jfWorks/x-server/commit/5ddae6a7fe6b9695f8817a8525a1cff3f90a3c38))
11
+
12
+ ### [1.11.5](https://github.com/jfWorks/x-server/compare/v1.11.4...v1.11.5) (2022-04-20)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * tbify node ([f732b68](https://github.com/jfWorks/x-server/commit/f732b6895895bd6f751e32d7cf04d5ed5ebacd61))
18
+
19
+ ### [1.11.4](https://github.com/jfWorks/x-server/compare/v1.11.3...v1.11.4) (2022-04-20)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * 下载 centos (rhel-openssl-1.0.x) 的可执行文件 ([1b5a13f](https://github.com/jfWorks/x-server/commit/1b5a13f30dd46d0cc5d76ee1697580ad07ab03cd))
25
+
5
26
  ### [1.11.3](https://github.com/jfWorks/x-server/compare/v1.11.2...v1.11.3) (2022-04-20)
6
27
 
7
28
 
@@ -15,6 +15,8 @@ var _execa = _interopRequireDefault(require("execa"));
15
15
 
16
16
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
17
17
 
18
+ var _os = _interopRequireDefault(require("os"));
19
+
18
20
  var _nodePath = _interopRequireDefault(require("node:path"));
19
21
 
20
22
  var _vtils = require("vtils");
@@ -109,6 +111,15 @@ class BuildUtil {
109
111
  const prismaSchemaFile = _nodePath.default.join(options.cwd, 'src/db/schema.prisma');
110
112
 
111
113
  if (await _fsExtra.default.pathExists(prismaSchemaFile)) {
114
+ // 下载 centos (rhel-openssl-1.0.x) 的可执行文件
115
+ await (0, _execa.default)('tbify', ['node', require.resolve('@prisma/engines/download/index.js')], {
116
+ env: {
117
+ // https://www.prisma.io/docs/reference/api-reference/environment-variables-reference#prisma_cli_binary_targets
118
+ // https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#binarytargets-options
119
+ PRISMA_CLI_BINARY_TARGETS: `${_os.default.platform() === 'darwin' ? 'darwin' : 'windows'},rhel-openssl-1.0.x`
120
+ }
121
+ });
122
+
112
123
  const distPrismaSchemaFile = _nodePath.default.join(distDir, 'schema.prisma');
113
124
 
114
125
  await _fsExtra.default.copyFile(prismaSchemaFile, distPrismaSchemaFile);
@@ -131,10 +131,7 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
131
131
  type: 'boolean',
132
132
  default: false
133
133
  }), async argv => {
134
- process.env.NODE_ENV = argv.production ? 'production' : 'development'; // https://www.prisma.io/docs/reference/api-reference/environment-variables-reference#prisma_cli_binary_targets
135
- // https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#binarytargets-options
136
-
137
- process.env.PRISMA_CLI_BINARY_TARGETS = 'darwin,rhel-openssl-1.0.x';
134
+ process.env.NODE_ENV = argv.production ? 'production' : 'development';
138
135
  await _env_util.EnvUtil.importFile({
139
136
  cwd: process.cwd(),
140
137
  file: '.env'
@@ -25,6 +25,11 @@ class TemplateUtil {
25
25
  await _fsExtra.default.copy(fromDir, toDir, {
26
26
  overwrite: true
27
27
  });
28
+ await (0, _vscodeGenerateIndexStandalone.generateManyIndex)({
29
+ cwd: cwd,
30
+ patterns: ['node_modules/.x/*.ts'],
31
+ replaceFile: true
32
+ });
28
33
  }
29
34
  /**
30
35
  * 初始化模型。
@@ -67,6 +72,7 @@ class TemplateUtil {
67
72
  }
68
73
 
69
74
  await (0, _vscodeGenerateIndexStandalone.generateManyIndex)({
75
+ cwd: cwd,
70
76
  patterns: [indexFile, indexFile2],
71
77
  replaceFile: true
72
78
  });
@@ -1,7 +1,9 @@
1
1
  import * as esbuild from 'esbuild';
2
2
  import compressing from 'compressing';
3
3
  import exec from 'execa';
4
+ import execa from 'execa';
4
5
  import fs from 'fs-extra';
6
+ import os from 'os';
5
7
  import path from 'node:path';
6
8
  import { dedent, uniq } from 'vtils';
7
9
  export class BuildUtil {
@@ -85,6 +87,14 @@ export class BuildUtil {
85
87
  const prismaSchemaFile = path.join(options.cwd, 'src/db/schema.prisma');
86
88
 
87
89
  if (await fs.pathExists(prismaSchemaFile)) {
90
+ // 下载 centos (rhel-openssl-1.0.x) 的可执行文件
91
+ await execa('tbify', ['node', require.resolve('@prisma/engines/download/index.js')], {
92
+ env: {
93
+ // https://www.prisma.io/docs/reference/api-reference/environment-variables-reference#prisma_cli_binary_targets
94
+ // https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#binarytargets-options
95
+ PRISMA_CLI_BINARY_TARGETS: `${os.platform() === 'darwin' ? 'darwin' : 'windows'},rhel-openssl-1.0.x`
96
+ }
97
+ });
88
98
  const distPrismaSchemaFile = path.join(distDir, 'schema.prisma');
89
99
  await fs.copyFile(prismaSchemaFile, distPrismaSchemaFile);
90
100
  await fs.copyFile(require.resolve('@prisma/engines/libquery_engine-rhel-openssl-1.0.x.so.node'), path.join(distDir, 'libquery_engine-rhel-openssl-1.0.x.so.node'));
package/lib/cli/cli.js CHANGED
@@ -113,10 +113,7 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
113
113
  type: 'boolean',
114
114
  default: false
115
115
  }), async argv => {
116
- process.env.NODE_ENV = argv.production ? 'production' : 'development'; // https://www.prisma.io/docs/reference/api-reference/environment-variables-reference#prisma_cli_binary_targets
117
- // https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#binarytargets-options
118
-
119
- process.env.PRISMA_CLI_BINARY_TARGETS = 'darwin,rhel-openssl-1.0.x';
116
+ process.env.NODE_ENV = argv.production ? 'production' : 'development';
120
117
  await EnvUtil.importFile({
121
118
  cwd: process.cwd(),
122
119
  file: '.env'
@@ -12,6 +12,11 @@ export class TemplateUtil {
12
12
  await fs.copy(fromDir, toDir, {
13
13
  overwrite: true
14
14
  });
15
+ await generateManyIndex({
16
+ cwd: cwd,
17
+ patterns: ['node_modules/.x/*.ts'],
18
+ replaceFile: true
19
+ });
15
20
  }
16
21
  /**
17
22
  * 初始化模型。
@@ -49,6 +54,7 @@ export class TemplateUtil {
49
54
  }
50
55
 
51
56
  await generateManyIndex({
57
+ cwd: cwd,
52
58
  patterns: [indexFile, indexFile2],
53
59
  replaceFile: true
54
60
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "1.11.3",
3
+ "version": "1.11.6",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",