@nocobase/cli 1.3.0-beta → 1.3.1-beta
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 +4 -4
- package/src/commands/upgrade.js +14 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1-beta",
|
|
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.3.
|
|
11
|
+
"@nocobase/app": "1.3.1-beta",
|
|
12
12
|
"@types/fs-extra": "^11.0.1",
|
|
13
13
|
"@umijs/utils": "3.5.20",
|
|
14
14
|
"chalk": "^4.1.1",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"tsx": "^4.6.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@nocobase/devtools": "1.3.
|
|
28
|
+
"@nocobase/devtools": "1.3.1-beta"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
32
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
33
33
|
"directory": "packages/core/cli"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "752217b149c23cab55c1d1c9ae9b609e2067f7e0"
|
|
36
36
|
}
|
package/src/commands/upgrade.js
CHANGED
|
@@ -23,6 +23,7 @@ module.exports = (cli) => {
|
|
|
23
23
|
.command('upgrade')
|
|
24
24
|
.allowUnknownOption()
|
|
25
25
|
.option('--raw')
|
|
26
|
+
.option('--next')
|
|
26
27
|
.option('-S|--skip-code-update')
|
|
27
28
|
.action(async (options) => {
|
|
28
29
|
if (hasTsNode()) promptForTs();
|
|
@@ -40,26 +41,32 @@ module.exports = (cli) => {
|
|
|
40
41
|
await runAppCommand('upgrade');
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
const rmAppDir = () => {
|
|
45
|
+
// If ts-node is not installed, do not do the following
|
|
46
|
+
const appDevDir = resolve(process.cwd(), './storage/.app-dev');
|
|
47
|
+
if (existsSync(appDevDir)) {
|
|
48
|
+
rmSync(appDevDir, { recursive: true, force: true });
|
|
49
|
+
}
|
|
50
|
+
};
|
|
48
51
|
const pkg = require('../../package.json');
|
|
49
52
|
// get latest version
|
|
50
|
-
const { stdout } = await run('npm', ['info', '@nocobase/cli', 'version'], {
|
|
53
|
+
const { stdout } = await run('npm', ['info', options.next ? '@nocobase/cli@next' : '@nocobase/cli', 'version'], {
|
|
54
|
+
stdio: 'pipe',
|
|
55
|
+
});
|
|
51
56
|
if (pkg.version === stdout) {
|
|
52
57
|
await runAppCommand('upgrade');
|
|
58
|
+
rmAppDir();
|
|
53
59
|
return;
|
|
54
60
|
}
|
|
55
61
|
const currentY = 1 * pkg.version.split('.')[1];
|
|
56
62
|
const latestY = 1 * stdout.split('.')[1];
|
|
57
|
-
if (currentY > latestY) {
|
|
63
|
+
if (options.next || currentY > latestY) {
|
|
58
64
|
await run('yarn', ['add', '@nocobase/cli@next', '@nocobase/devtools@next', '-W']);
|
|
59
65
|
} else {
|
|
60
66
|
await run('yarn', ['add', '@nocobase/cli', '@nocobase/devtools', '-W']);
|
|
61
67
|
}
|
|
62
68
|
await run('yarn', ['install']);
|
|
63
69
|
await runAppCommand('upgrade');
|
|
70
|
+
rmAppDir();
|
|
64
71
|
});
|
|
65
72
|
};
|