@jayfong/x-server 1.11.1 → 1.11.4
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 +21 -0
- package/lib/_cjs/cli/build_util.js +16 -0
- package/lib/_cjs/cli/cli.js +1 -4
- package/lib/cli/build_util.js +15 -0
- package/lib/cli/cli.js +1 -4
- package/package.json +2 -2
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.4](https://github.com/jfWorks/x-server/compare/v1.11.3...v1.11.4) (2022-04-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* 下载 centos (rhel-openssl-1.0.x) 的可执行文件 ([1b5a13f](https://github.com/jfWorks/x-server/commit/1b5a13f30dd46d0cc5d76ee1697580ad07ab03cd))
|
|
11
|
+
|
|
12
|
+
### [1.11.3](https://github.com/jfWorks/x-server/compare/v1.11.2...v1.11.3) (2022-04-20)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* mainFields ([80fd62d](https://github.com/jfWorks/x-server/commit/80fd62d3973f556a83dc7bf1930e5bb06c6845ec))
|
|
18
|
+
|
|
19
|
+
### [1.11.2](https://github.com/jfWorks/x-server/compare/v1.11.1...v1.11.2) (2022-04-20)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* bin ([aa23fe9](https://github.com/jfWorks/x-server/commit/aa23fe9a6ccfef2b78f318676d4d983d24f315c4))
|
|
25
|
+
|
|
5
26
|
### [1.11.1](https://github.com/jfWorks/x-server/compare/v1.11.0...v1.11.1) (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");
|
|
@@ -61,6 +63,11 @@ class BuildUtil {
|
|
|
61
63
|
bundle: true,
|
|
62
64
|
outfile: distMainFile,
|
|
63
65
|
platform: 'node',
|
|
66
|
+
// https://esbuild.github.io/api/#main-fields
|
|
67
|
+
// 当 platform 是 node 时,
|
|
68
|
+
// esbuild 默认的 mainFields 是 main,module,
|
|
69
|
+
// 这会导致 treeShaking 失效
|
|
70
|
+
mainFields: ['module', 'main'],
|
|
64
71
|
target: `node${process.version.slice(1)}`,
|
|
65
72
|
external: external,
|
|
66
73
|
minify: (_options$minify = options.minify) != null ? _options$minify : true,
|
|
@@ -104,6 +111,15 @@ class BuildUtil {
|
|
|
104
111
|
const prismaSchemaFile = _nodePath.default.join(options.cwd, 'src/db/schema.prisma');
|
|
105
112
|
|
|
106
113
|
if (await _fsExtra.default.pathExists(prismaSchemaFile)) {
|
|
114
|
+
// 下载 centos (rhel-openssl-1.0.x) 的可执行文件
|
|
115
|
+
await (0, _execa.default)('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
|
+
|
|
107
123
|
const distPrismaSchemaFile = _nodePath.default.join(distDir, 'schema.prisma');
|
|
108
124
|
|
|
109
125
|
await _fsExtra.default.copyFile(prismaSchemaFile, distPrismaSchemaFile);
|
package/lib/_cjs/cli/cli.js
CHANGED
|
@@ -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';
|
|
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'
|
package/lib/cli/build_util.js
CHANGED
|
@@ -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 {
|
|
@@ -37,6 +39,11 @@ export class BuildUtil {
|
|
|
37
39
|
bundle: true,
|
|
38
40
|
outfile: distMainFile,
|
|
39
41
|
platform: 'node',
|
|
42
|
+
// https://esbuild.github.io/api/#main-fields
|
|
43
|
+
// 当 platform 是 node 时,
|
|
44
|
+
// esbuild 默认的 mainFields 是 main,module,
|
|
45
|
+
// 这会导致 treeShaking 失效
|
|
46
|
+
mainFields: ['module', 'main'],
|
|
40
47
|
target: `node${process.version.slice(1)}`,
|
|
41
48
|
external: external,
|
|
42
49
|
minify: (_options$minify = options.minify) != null ? _options$minify : true,
|
|
@@ -80,6 +87,14 @@ export class BuildUtil {
|
|
|
80
87
|
const prismaSchemaFile = path.join(options.cwd, 'src/db/schema.prisma');
|
|
81
88
|
|
|
82
89
|
if (await fs.pathExists(prismaSchemaFile)) {
|
|
90
|
+
// 下载 centos (rhel-openssl-1.0.x) 的可执行文件
|
|
91
|
+
await execa('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
|
+
});
|
|
83
98
|
const distPrismaSchemaFile = path.join(distDir, 'schema.prisma');
|
|
84
99
|
await fs.copyFile(prismaSchemaFile, distPrismaSchemaFile);
|
|
85
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';
|
|
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'
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jayfong/x-server",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.4",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "lib/_cjs/index.js",
|
|
7
7
|
"module": "lib/index.js",
|
|
8
8
|
"types": "lib/index.d.ts",
|
|
9
9
|
"bin": {
|
|
10
|
-
"xs": "lib/cli/cli.js"
|
|
10
|
+
"xs": "lib/_cjs/cli/cli.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"lib"
|