@nocobase/cli-v1 2.1.3 → 2.1.5
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
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/cli-v1",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
+
"nocobase": "./bin/index.js",
|
|
8
9
|
"nocobase-v1": "./bin/index.js"
|
|
9
10
|
},
|
|
10
11
|
"dependencies": {
|
|
11
|
-
"@nocobase/cli": "2.1.
|
|
12
|
+
"@nocobase/cli": "2.1.5",
|
|
12
13
|
"@nocobase/license-kit": "^0.3.8",
|
|
13
|
-
"@nocobase/utils": "2.1.
|
|
14
|
+
"@nocobase/utils": "2.1.5",
|
|
14
15
|
"chalk": "^4.1.1",
|
|
15
16
|
"commander": "^9.2.0",
|
|
16
17
|
"deepmerge": "^4.3.1",
|
|
@@ -25,7 +26,6 @@
|
|
|
25
26
|
"tree-kill": "^1.2.2"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"@nocobase/devtools": "2.1.3",
|
|
29
29
|
"@types/fs-extra": "^11.0.1"
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
34
34
|
"directory": "packages/core/cli"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "fb6550c3c607ea45ce5389dafe9d98f17f201aad"
|
|
37
37
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/* eslint-env jest */
|
|
11
|
+
|
|
12
|
+
const { buildAppDevForwardArgs, forwardDevToAppDev } = require('../commands/dev')._test;
|
|
13
|
+
|
|
14
|
+
describe('cli-v1 dev command', () => {
|
|
15
|
+
test('buildAppDevForwardArgs rewrites dev argv to app-dev while preserving extra args', () => {
|
|
16
|
+
expect(
|
|
17
|
+
buildAppDevForwardArgs(['node', 'nocobase-v1', 'dev', '--rsbuild', '--port', '13000', '--inspect=9229']),
|
|
18
|
+
).toEqual(['app-dev', '--rsbuild', '--port', '13000', '--inspect=9229']);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('forwardDevToAppDev delegates to nocobase-v1 app-dev for create-app projects', async () => {
|
|
22
|
+
const calls = [];
|
|
23
|
+
const runCommand = async (...args) => {
|
|
24
|
+
calls.push(args);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
await forwardDevToAppDev({
|
|
28
|
+
argv: ['node', 'nocobase-v1', 'dev', '--port', '13000', '--db-sync'],
|
|
29
|
+
runCommand,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
expect(calls).toEqual([['nocobase-v1', ['app-dev', '--port', '13000', '--db-sync']]]);
|
|
33
|
+
});
|
|
34
|
+
});
|
package/src/commands/dev.js
CHANGED
|
@@ -10,6 +10,7 @@ const _ = require('lodash');
|
|
|
10
10
|
const { Command } = require('commander');
|
|
11
11
|
const {
|
|
12
12
|
generatePlugins,
|
|
13
|
+
hasCorePackages,
|
|
13
14
|
run,
|
|
14
15
|
runWithPrefix,
|
|
15
16
|
postCheck,
|
|
@@ -41,6 +42,14 @@ async function buildBundleStatusHtml() {
|
|
|
41
42
|
);
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
function buildAppDevForwardArgs(argv = process.argv) {
|
|
46
|
+
return ['app-dev', ...argv.slice(3)];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function forwardDevToAppDev({ argv = process.argv, runCommand = run } = {}) {
|
|
50
|
+
await runCommand('nocobase-v1', buildAppDevForwardArgs(argv));
|
|
51
|
+
}
|
|
52
|
+
|
|
44
53
|
/**
|
|
45
54
|
*
|
|
46
55
|
* @param {Command} cli
|
|
@@ -58,6 +67,11 @@ module.exports = (cli) => {
|
|
|
58
67
|
.option('-i, --inspect [port]')
|
|
59
68
|
.allowUnknownOption()
|
|
60
69
|
.action(async (opts) => {
|
|
70
|
+
if (!hasCorePackages()) {
|
|
71
|
+
await forwardDevToAppDev();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
61
75
|
checkDBDialect();
|
|
62
76
|
await buildBundleStatusHtml();
|
|
63
77
|
|
|
@@ -289,3 +303,8 @@ module.exports = (cli) => {
|
|
|
289
303
|
}
|
|
290
304
|
});
|
|
291
305
|
};
|
|
306
|
+
|
|
307
|
+
module.exports._test = {
|
|
308
|
+
buildAppDevForwardArgs,
|
|
309
|
+
forwardDevToAppDev,
|
|
310
|
+
};
|
|
@@ -68,6 +68,14 @@ module.exports = (cli) => {
|
|
|
68
68
|
if (descJson['dependencies']?.['@nocobase/app']) {
|
|
69
69
|
descJson['dependencies']['@nocobase/app'] = stdout;
|
|
70
70
|
}
|
|
71
|
+
descJson['scripts']['dev'] = 'nocobase app-dev';
|
|
72
|
+
if (descJson['dependencies']?.['@nocobase/cli']) {
|
|
73
|
+
descJson['dependencies']['@nocobase/app'] = stdout;
|
|
74
|
+
console.log(
|
|
75
|
+
chalk.yellow('The @nocobase/cli package is no longer needed, it will be removed from dependencies.'),
|
|
76
|
+
);
|
|
77
|
+
delete descJson['dependencies']['@nocobase/cli'];
|
|
78
|
+
}
|
|
71
79
|
if (descJson['devDependencies']?.['@nocobase/devtools']) {
|
|
72
80
|
descJson['devDependencies']['@nocobase/devtools'] = stdout;
|
|
73
81
|
}
|