@jayfong/x-server 2.70.0 → 2.72.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.
- package/lib/_cjs/cli/build_util.js +2 -2
- package/lib/_cjs/cli/cli.js +7 -3
- package/lib/_cjs/cli/deploy_util.js +5 -3
- package/lib/cli/build_util.d.ts +1 -0
- package/lib/cli/build_util.js +2 -2
- package/lib/cli/cli.js +7 -3
- package/lib/cli/deploy_util.d.ts +5 -2
- package/lib/cli/deploy_util.js +5 -3
- package/package.json +1 -1
|
@@ -16,8 +16,8 @@ class BuildUtil {
|
|
|
16
16
|
const mainFile = _nodePath.default.join(options.cwd, 'src/main.ts');
|
|
17
17
|
const pkgFile = _nodePath.default.join(options.cwd, 'package.json');
|
|
18
18
|
const pkgContent = await _fsExtra.default.readJson(pkgFile);
|
|
19
|
-
const distDir = _nodePath.default.join(options.cwd, 'dist');
|
|
20
|
-
const tempDir = _nodePath.default.join(options.cwd, 'temp');
|
|
19
|
+
const distDir = _nodePath.default.join(options.cwd, options.channel ? `dist/${options.channel}` : 'dist');
|
|
20
|
+
const tempDir = _nodePath.default.join(options.cwd, options.channel ? `temp/${options.channel}` : 'temp');
|
|
21
21
|
const distMainFile = _nodePath.default.join(distDir, 'main.js');
|
|
22
22
|
const distPkgFile = _nodePath.default.join(distDir, 'package.json');
|
|
23
23
|
const distNvmrcFile = _nodePath.default.join(distDir, '.nvmrc');
|
package/lib/_cjs/cli/cli.js
CHANGED
|
@@ -50,7 +50,7 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
50
50
|
await _template_util.TemplateUtil.init(process.cwd());
|
|
51
51
|
const xsignoreFile = _path.default.join(process.cwd(), '.xsignore');
|
|
52
52
|
const xsignoreContent = (await _fsExtra.default.pathExists(xsignoreFile)) ? (await _fsExtra.default.readFile(xsignoreFile, 'utf-8')).trim().split(/[\r\n]+/g).filter(v => v && !v.startsWith('#')) : [];
|
|
53
|
-
const watcher = _chokidar.default.watch(['src', '.env', '.env
|
|
53
|
+
const watcher = _chokidar.default.watch(['src', '.env', '.env*'], {
|
|
54
54
|
cwd: process.cwd(),
|
|
55
55
|
ignored: ['**/*.test.*', ...xsignoreContent]
|
|
56
56
|
});
|
|
@@ -124,7 +124,8 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
124
124
|
external: externals,
|
|
125
125
|
inlineEnvs: envMap,
|
|
126
126
|
minify: argv.minify,
|
|
127
|
-
noInstall: argv['no-install']
|
|
127
|
+
noInstall: argv['no-install'],
|
|
128
|
+
channel: argv.channel
|
|
128
129
|
});
|
|
129
130
|
console.log('构建成功');
|
|
130
131
|
}).command('api', '生成 API', _ => _.positional('channel', {
|
|
@@ -230,6 +231,7 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
230
231
|
host: deployEnv.HOST,
|
|
231
232
|
user: deployEnv.USER,
|
|
232
233
|
key: deployEnv.KEY,
|
|
234
|
+
pass: deployEnv.PASSWORD,
|
|
233
235
|
token: appEnv.APP_TOKEN,
|
|
234
236
|
port: appEnv.APP_PORT,
|
|
235
237
|
env: appEnv
|
|
@@ -240,10 +242,12 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
240
242
|
host: deployEnv.HOST,
|
|
241
243
|
user: deployEnv.USER,
|
|
242
244
|
key: deployEnv.KEY,
|
|
245
|
+
pass: deployEnv.PASSWORD,
|
|
243
246
|
dir: deployEnv.DIR,
|
|
244
247
|
cmd: deployEnv.CMD,
|
|
245
248
|
memory: deployEnv.MEMORY,
|
|
246
|
-
cron: deployEnv.CRON
|
|
249
|
+
cron: deployEnv.CRON,
|
|
250
|
+
channel: argv.channel
|
|
247
251
|
});
|
|
248
252
|
}
|
|
249
253
|
}).parse();
|
|
@@ -10,7 +10,7 @@ var _vtils = require("vtils");
|
|
|
10
10
|
class DeployUtil {
|
|
11
11
|
static async deploy(options) {
|
|
12
12
|
const pkgContent = await _fsExtra.default.readJson(_path.default.join(options.cwd, 'package.json'));
|
|
13
|
-
const appFile = _path.default.join(options.cwd, `temp/app.${pkgContent.version}.tgz`);
|
|
13
|
+
const appFile = _path.default.join(options.cwd, `temp${options.channel ? `/${options.channel}` : ''}/app.${pkgContent.version}.tgz`);
|
|
14
14
|
if (!(await _fsExtra.default.pathExists(appFile))) {
|
|
15
15
|
throw new Error('请先构建');
|
|
16
16
|
}
|
|
@@ -18,7 +18,8 @@ class DeployUtil {
|
|
|
18
18
|
await ssh.connect({
|
|
19
19
|
host: options.host,
|
|
20
20
|
username: options.user,
|
|
21
|
-
privateKey: options.key
|
|
21
|
+
privateKey: options.key,
|
|
22
|
+
password: options.pass
|
|
22
23
|
});
|
|
23
24
|
const appName = pkgContent.name;
|
|
24
25
|
const appDir = `./${appName}`;
|
|
@@ -52,7 +53,8 @@ class DeployUtil {
|
|
|
52
53
|
await ssh.connect({
|
|
53
54
|
host: options.host,
|
|
54
55
|
username: options.user,
|
|
55
|
-
privateKey: options.key
|
|
56
|
+
privateKey: options.key,
|
|
57
|
+
password: options.pass
|
|
56
58
|
});
|
|
57
59
|
await ssh.execCommand((0, _vtils.dedent)`
|
|
58
60
|
set -ex
|
package/lib/cli/build_util.d.ts
CHANGED
package/lib/cli/build_util.js
CHANGED
|
@@ -10,8 +10,8 @@ export class BuildUtil {
|
|
|
10
10
|
const mainFile = path.join(options.cwd, 'src/main.ts');
|
|
11
11
|
const pkgFile = path.join(options.cwd, 'package.json');
|
|
12
12
|
const pkgContent = await fs.readJson(pkgFile);
|
|
13
|
-
const distDir = path.join(options.cwd, 'dist');
|
|
14
|
-
const tempDir = path.join(options.cwd, 'temp');
|
|
13
|
+
const distDir = path.join(options.cwd, options.channel ? `dist/${options.channel}` : 'dist');
|
|
14
|
+
const tempDir = path.join(options.cwd, options.channel ? `temp/${options.channel}` : 'temp');
|
|
15
15
|
const distMainFile = path.join(distDir, 'main.js');
|
|
16
16
|
const distPkgFile = path.join(distDir, 'package.json');
|
|
17
17
|
const distNvmrcFile = path.join(distDir, '.nvmrc');
|
package/lib/cli/cli.js
CHANGED
|
@@ -47,7 +47,7 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
47
47
|
await TemplateUtil.init(process.cwd());
|
|
48
48
|
const xsignoreFile = path.join(process.cwd(), '.xsignore');
|
|
49
49
|
const xsignoreContent = (await fs.pathExists(xsignoreFile)) ? (await fs.readFile(xsignoreFile, 'utf-8')).trim().split(/[\r\n]+/g).filter(v => v && !v.startsWith('#')) : [];
|
|
50
|
-
const watcher = chokidar.watch(['src', '.env', '.env
|
|
50
|
+
const watcher = chokidar.watch(['src', '.env', '.env*'], {
|
|
51
51
|
cwd: process.cwd(),
|
|
52
52
|
ignored: ['**/*.test.*', ...xsignoreContent]
|
|
53
53
|
});
|
|
@@ -121,7 +121,8 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
121
121
|
external: externals,
|
|
122
122
|
inlineEnvs: envMap,
|
|
123
123
|
minify: argv.minify,
|
|
124
|
-
noInstall: argv['no-install']
|
|
124
|
+
noInstall: argv['no-install'],
|
|
125
|
+
channel: argv.channel
|
|
125
126
|
});
|
|
126
127
|
console.log('构建成功');
|
|
127
128
|
}).command('api', '生成 API', _ => _.positional('channel', {
|
|
@@ -227,6 +228,7 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
227
228
|
host: deployEnv.HOST,
|
|
228
229
|
user: deployEnv.USER,
|
|
229
230
|
key: deployEnv.KEY,
|
|
231
|
+
pass: deployEnv.PASSWORD,
|
|
230
232
|
token: appEnv.APP_TOKEN,
|
|
231
233
|
port: appEnv.APP_PORT,
|
|
232
234
|
env: appEnv
|
|
@@ -237,10 +239,12 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
|
|
|
237
239
|
host: deployEnv.HOST,
|
|
238
240
|
user: deployEnv.USER,
|
|
239
241
|
key: deployEnv.KEY,
|
|
242
|
+
pass: deployEnv.PASSWORD,
|
|
240
243
|
dir: deployEnv.DIR,
|
|
241
244
|
cmd: deployEnv.CMD,
|
|
242
245
|
memory: deployEnv.MEMORY,
|
|
243
|
-
cron: deployEnv.CRON
|
|
246
|
+
cron: deployEnv.CRON,
|
|
247
|
+
channel: argv.channel
|
|
244
248
|
});
|
|
245
249
|
}
|
|
246
250
|
}).parse();
|
package/lib/cli/deploy_util.d.ts
CHANGED
|
@@ -2,16 +2,19 @@ export interface DeployOptions {
|
|
|
2
2
|
cwd: string;
|
|
3
3
|
host: string;
|
|
4
4
|
user: string;
|
|
5
|
-
key
|
|
5
|
+
key?: string;
|
|
6
|
+
pass?: string;
|
|
6
7
|
dir: string;
|
|
7
8
|
memory?: string;
|
|
8
9
|
cron?: string;
|
|
9
10
|
cmd?: string;
|
|
11
|
+
channel?: string;
|
|
10
12
|
}
|
|
11
13
|
export interface DeployEnvOptions {
|
|
12
14
|
host: string;
|
|
13
15
|
user: string;
|
|
14
|
-
key
|
|
16
|
+
key?: string;
|
|
17
|
+
pass?: string;
|
|
15
18
|
port: number;
|
|
16
19
|
token: string;
|
|
17
20
|
env: Record<string, any>;
|
package/lib/cli/deploy_util.js
CHANGED
|
@@ -5,7 +5,7 @@ import { dedent } from 'vtils';
|
|
|
5
5
|
export class DeployUtil {
|
|
6
6
|
static async deploy(options) {
|
|
7
7
|
const pkgContent = await fs.readJson(path.join(options.cwd, 'package.json'));
|
|
8
|
-
const appFile = path.join(options.cwd, `temp/app.${pkgContent.version}.tgz`);
|
|
8
|
+
const appFile = path.join(options.cwd, `temp${options.channel ? `/${options.channel}` : ''}/app.${pkgContent.version}.tgz`);
|
|
9
9
|
if (!(await fs.pathExists(appFile))) {
|
|
10
10
|
throw new Error('请先构建');
|
|
11
11
|
}
|
|
@@ -13,7 +13,8 @@ export class DeployUtil {
|
|
|
13
13
|
await ssh.connect({
|
|
14
14
|
host: options.host,
|
|
15
15
|
username: options.user,
|
|
16
|
-
privateKey: options.key
|
|
16
|
+
privateKey: options.key,
|
|
17
|
+
password: options.pass
|
|
17
18
|
});
|
|
18
19
|
const appName = pkgContent.name;
|
|
19
20
|
const appDir = `./${appName}`;
|
|
@@ -47,7 +48,8 @@ export class DeployUtil {
|
|
|
47
48
|
await ssh.connect({
|
|
48
49
|
host: options.host,
|
|
49
50
|
username: options.user,
|
|
50
|
-
privateKey: options.key
|
|
51
|
+
privateKey: options.key,
|
|
52
|
+
password: options.pass
|
|
51
53
|
});
|
|
52
54
|
await ssh.execCommand(dedent`
|
|
53
55
|
set -ex
|