@nocobase/cli 1.6.20 → 1.6.22
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/package.json +5 -6
- package/src/commands/dev.js +2 -1
- package/src/commands/e2e.js +2 -1
- package/src/commands/global.js +2 -1
- package/src/commands/start.js +24 -12
- package/src/commands/test-coverage.js +3 -1
- package/src/commands/test.js +2 -1
- package/src/commands/upgrade.js +2 -1
- package/src/util.js +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/cli",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.22",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"nocobase": "./bin/index.js"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@nocobase/app": "1.6.
|
|
11
|
+
"@nocobase/app": "1.6.22",
|
|
12
12
|
"@types/fs-extra": "^11.0.1",
|
|
13
13
|
"@umijs/utils": "3.5.20",
|
|
14
14
|
"chalk": "^4.1.1",
|
|
@@ -18,19 +18,18 @@
|
|
|
18
18
|
"fast-glob": "^3.3.1",
|
|
19
19
|
"fs-extra": "^11.1.1",
|
|
20
20
|
"p-all": "3.0.0",
|
|
21
|
-
"pm2": "^5.2.0",
|
|
22
21
|
"portfinder": "^1.0.28",
|
|
23
|
-
"
|
|
22
|
+
"tar": "^7.4.3",
|
|
24
23
|
"tree-kill": "^1.2.2",
|
|
25
24
|
"tsx": "^4.19.0"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|
|
28
|
-
"@nocobase/devtools": "1.6.
|
|
27
|
+
"@nocobase/devtools": "1.6.22"
|
|
29
28
|
},
|
|
30
29
|
"repository": {
|
|
31
30
|
"type": "git",
|
|
32
31
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
33
32
|
"directory": "packages/core/cli"
|
|
34
33
|
},
|
|
35
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "321c0effa18670c0c3edfa09c79d535351ef2b0d"
|
|
36
35
|
}
|
package/src/commands/dev.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
const _ = require('lodash');
|
|
10
10
|
const { Command } = require('commander');
|
|
11
|
-
const { generatePlugins, run, postCheck, nodeCheck, promptForTs, isPortReachable } = require('../util');
|
|
11
|
+
const { generatePlugins, run, postCheck, nodeCheck, promptForTs, isPortReachable, checkDBDialect } = require('../util');
|
|
12
12
|
const { getPortPromise } = require('portfinder');
|
|
13
13
|
const chokidar = require('chokidar');
|
|
14
14
|
const { uid } = require('@formily/shared');
|
|
@@ -36,6 +36,7 @@ module.exports = (cli) => {
|
|
|
36
36
|
.option('-i, --inspect [port]')
|
|
37
37
|
.allowUnknownOption()
|
|
38
38
|
.action(async (opts) => {
|
|
39
|
+
checkDBDialect();
|
|
39
40
|
let subprocess;
|
|
40
41
|
const runDevClient = () => {
|
|
41
42
|
console.log('starting client', 1 * clientPort);
|
package/src/commands/e2e.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
const { Command } = require('commander');
|
|
11
|
-
const { run, isPortReachable } = require('../util');
|
|
11
|
+
const { run, isPortReachable, checkDBDialect } = require('../util');
|
|
12
12
|
const { execSync } = require('node:child_process');
|
|
13
13
|
const axios = require('axios');
|
|
14
14
|
const { pTest } = require('./p-test');
|
|
@@ -165,6 +165,7 @@ const filterArgv = () => {
|
|
|
165
165
|
*/
|
|
166
166
|
module.exports = (cli) => {
|
|
167
167
|
const e2e = cli.command('e2e').hook('preAction', () => {
|
|
168
|
+
checkDBDialect();
|
|
168
169
|
if (process.env.APP_BASE_URL) {
|
|
169
170
|
process.env.APP_BASE_URL = process.env.APP_BASE_URL.replace('localhost', '127.0.0.1');
|
|
170
171
|
console.log('APP_BASE_URL:', process.env.APP_BASE_URL);
|
package/src/commands/global.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
const { Command } = require('commander');
|
|
11
|
-
const { run, isDev, isProd, promptForTs, downloadPro } = require('../util');
|
|
11
|
+
const { run, isDev, isProd, promptForTs, downloadPro, checkDBDialect } = require('../util');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
*
|
|
@@ -21,6 +21,7 @@ module.exports = (cli) => {
|
|
|
21
21
|
.option('-h, --help')
|
|
22
22
|
.option('--ts-node-dev')
|
|
23
23
|
.action(async (options) => {
|
|
24
|
+
checkDBDialect();
|
|
24
25
|
const cmd = process.argv.slice(2)?.[0];
|
|
25
26
|
if (cmd === 'install') {
|
|
26
27
|
await downloadPro();
|
package/src/commands/start.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
const _ = require('lodash');
|
|
10
10
|
const { Command } = require('commander');
|
|
11
|
-
const { run, postCheck, downloadPro, promptForTs } = require('../util');
|
|
11
|
+
const { run, postCheck, downloadPro, promptForTs, checkDBDialect } = require('../util');
|
|
12
12
|
const { existsSync, rmSync } = require('fs');
|
|
13
13
|
const { resolve, isAbsolute } = require('path');
|
|
14
14
|
const chalk = require('chalk');
|
|
@@ -48,8 +48,10 @@ module.exports = (cli) => {
|
|
|
48
48
|
.option('-i, --instances [instances]')
|
|
49
49
|
.option('--db-sync')
|
|
50
50
|
.option('--quickstart')
|
|
51
|
+
.option('--launch-mode [launchMode]')
|
|
51
52
|
.allowUnknownOption()
|
|
52
53
|
.action(async (opts) => {
|
|
54
|
+
checkDBDialect();
|
|
53
55
|
if (opts.quickstart) {
|
|
54
56
|
await downloadPro();
|
|
55
57
|
}
|
|
@@ -118,17 +120,27 @@ module.exports = (cli) => {
|
|
|
118
120
|
]);
|
|
119
121
|
process.exit();
|
|
120
122
|
} else {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
'
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
123
|
+
const launchMode = opts.launchMode || process.env.APP_LAUNCH_MODE || 'pm2';
|
|
124
|
+
if (launchMode === 'pm2') {
|
|
125
|
+
run(
|
|
126
|
+
'pm2-runtime',
|
|
127
|
+
[
|
|
128
|
+
'start',
|
|
129
|
+
...instancesArgs,
|
|
130
|
+
`${APP_PACKAGE_ROOT}/lib/index.js`,
|
|
131
|
+
NODE_ARGS ? `--node-args="${NODE_ARGS}"` : undefined,
|
|
132
|
+
'--',
|
|
133
|
+
...process.argv.slice(2),
|
|
134
|
+
].filter(Boolean),
|
|
135
|
+
);
|
|
136
|
+
} else {
|
|
137
|
+
run(
|
|
138
|
+
'node',
|
|
139
|
+
[`${APP_PACKAGE_ROOT}/lib/index.js`, ...(NODE_ARGS || '').split(' '), ...process.argv.slice(2)].filter(
|
|
140
|
+
Boolean,
|
|
141
|
+
),
|
|
142
|
+
);
|
|
143
|
+
}
|
|
132
144
|
}
|
|
133
145
|
});
|
|
134
146
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
const { run } = require('../util');
|
|
10
|
+
const { run, checkDBDialect } = require('../util');
|
|
11
11
|
const fg = require('fast-glob');
|
|
12
12
|
|
|
13
13
|
const coreClientPackages = ['packages/core/client', 'packages/core/sdk'];
|
|
@@ -30,6 +30,7 @@ const getPackagesDir = (isClient) => {
|
|
|
30
30
|
|
|
31
31
|
module.exports = (cli) => {
|
|
32
32
|
cli.command('test-coverage:server').action(async () => {
|
|
33
|
+
checkDBDialect();
|
|
33
34
|
const packageRoots = getPackagesDir(false);
|
|
34
35
|
for (const dir of packageRoots) {
|
|
35
36
|
try {
|
|
@@ -41,6 +42,7 @@ module.exports = (cli) => {
|
|
|
41
42
|
});
|
|
42
43
|
|
|
43
44
|
cli.command('test-coverage:client').action(async () => {
|
|
45
|
+
checkDBDialect();
|
|
44
46
|
const packageRoots = getPackagesDir(true);
|
|
45
47
|
for (const dir of packageRoots) {
|
|
46
48
|
try {
|
package/src/commands/test.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
const { Command } = require('commander');
|
|
11
|
-
const { run } = require('../util');
|
|
11
|
+
const { run, checkDBDialect } = require('../util');
|
|
12
12
|
const path = require('path');
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -29,6 +29,7 @@ function addTestCommand(name, cli) {
|
|
|
29
29
|
.arguments('[paths...]')
|
|
30
30
|
.allowUnknownOption()
|
|
31
31
|
.action(async (paths, opts) => {
|
|
32
|
+
checkDBDialect();
|
|
32
33
|
if (name === 'test:server') {
|
|
33
34
|
process.env.TEST_ENV = 'server-side';
|
|
34
35
|
} else if (name === 'test:client') {
|
package/src/commands/upgrade.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
const chalk = require('chalk');
|
|
11
11
|
const { Command } = require('commander');
|
|
12
12
|
const { resolve } = require('path');
|
|
13
|
-
const { run, promptForTs, runAppCommand, hasCorePackages, downloadPro, hasTsNode } = require('../util');
|
|
13
|
+
const { run, promptForTs, runAppCommand, hasCorePackages, downloadPro, hasTsNode, checkDBDialect } = require('../util');
|
|
14
14
|
const { existsSync, rmSync } = require('fs');
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -26,6 +26,7 @@ module.exports = (cli) => {
|
|
|
26
26
|
.option('--next')
|
|
27
27
|
.option('-S|--skip-code-update')
|
|
28
28
|
.action(async (options) => {
|
|
29
|
+
checkDBDialect();
|
|
29
30
|
if (hasTsNode()) promptForTs();
|
|
30
31
|
if (hasCorePackages()) {
|
|
31
32
|
// await run('yarn', ['install']);
|
package/src/util.js
CHANGED
|
@@ -360,7 +360,7 @@ exports.initEnv = function initEnv() {
|
|
|
360
360
|
API_BASE_PATH: '/api/',
|
|
361
361
|
API_CLIENT_STORAGE_PREFIX: 'NOCOBASE_',
|
|
362
362
|
API_CLIENT_STORAGE_TYPE: 'localStorage',
|
|
363
|
-
DB_DIALECT: 'sqlite',
|
|
363
|
+
// DB_DIALECT: 'sqlite',
|
|
364
364
|
DB_STORAGE: 'storage/db/nocobase.sqlite',
|
|
365
365
|
// DB_TIMEZONE: '+00:00',
|
|
366
366
|
DB_UNDERSCORED: parseEnv('DB_UNDERSCORED'),
|
|
@@ -472,6 +472,12 @@ exports.initEnv = function initEnv() {
|
|
|
472
472
|
}
|
|
473
473
|
};
|
|
474
474
|
|
|
475
|
+
exports.checkDBDialect = function () {
|
|
476
|
+
if (!process.env.DB_DIALECT) {
|
|
477
|
+
throw new Error('DB_DIALECT is required.');
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
|
|
475
481
|
exports.generatePlugins = function () {
|
|
476
482
|
try {
|
|
477
483
|
require.resolve('@nocobase/devtools/umiConfig');
|