@nocobase/cli-v1 2.1.0-alpha.19 → 2.1.0-alpha.20
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 -5
- package/src/commands/build.js +4 -0
- package/src/commands/clean.js +16 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/cli-v1",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"nocobase-v1": "./bin/index.js"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@nocobase/cli": "2.1.0-alpha.
|
|
11
|
+
"@nocobase/cli": "2.1.0-alpha.20",
|
|
12
12
|
"@nocobase/license-kit": "^0.3.8",
|
|
13
|
-
"@nocobase/utils": "2.1.0-alpha.
|
|
13
|
+
"@nocobase/utils": "2.1.0-alpha.20",
|
|
14
14
|
"@types/fs-extra": "^11.0.1",
|
|
15
15
|
"@umijs/utils": "3.5.20",
|
|
16
16
|
"chalk": "^4.1.1",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"tsx": "^4.19.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@nocobase/devtools": "2.1.0-alpha.
|
|
31
|
+
"@nocobase/devtools": "2.1.0-alpha.20"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
|
35
35
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
36
36
|
"directory": "packages/core/cli"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "3d1535db6bf93ca23257faf474afee0d565f54c6"
|
|
39
39
|
}
|
package/src/commands/build.js
CHANGED
|
@@ -61,6 +61,10 @@ module.exports = (cli) => {
|
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
if (pkgs.length === 0) {
|
|
65
|
+
await run('nocobase-v1', ['clean', '--dist']);
|
|
66
|
+
}
|
|
67
|
+
|
|
64
68
|
if (options.compile || options.watch || isPackageValid('@nocobase/build/src/index.ts')) {
|
|
65
69
|
await run('yarn', ['build', options.watch ? '--watch' : ''], {
|
|
66
70
|
cwd: resolve(process.cwd(), 'packages/core/build'),
|
package/src/commands/clean.js
CHANGED
|
@@ -19,12 +19,24 @@ module.exports = (cli) => {
|
|
|
19
19
|
cli
|
|
20
20
|
.command('clean')
|
|
21
21
|
.allowUnknownOption()
|
|
22
|
-
.
|
|
22
|
+
.option('--dist', 'only clean build output (lib,esm,es,dist), keep node_modules')
|
|
23
|
+
.action((options) => {
|
|
23
24
|
if (!isDev()) {
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
if (options.dist) {
|
|
28
|
+
run('rimraf', ['-rf', 'packages/*/*/{lib,esm,es}']);
|
|
29
|
+
run('rimraf', ['-rf', 'packages/*/@*/*/{lib,esm,es,dist}']);
|
|
30
|
+
// Clean dist separately, skip packages/core/cli/dist to keep the nb CLI functional
|
|
31
|
+
const fg = require('fast-glob');
|
|
32
|
+
const distDirs = fg.sync(['packages/*/*/dist', '!packages/core/cli/dist'], { onlyDirectories: true });
|
|
33
|
+
if (distDirs.length) {
|
|
34
|
+
run('rimraf', ['-rf', ...distDirs]);
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
run('rimraf', ['-rf', './storage/app-dev']);
|
|
38
|
+
run('rimraf', ['-rf', 'packages/*/*/{lib,esm,es,dist,node_modules}']);
|
|
39
|
+
run('rimraf', ['-rf', 'packages/*/@*/*/{lib,esm,es,dist,node_modules}']);
|
|
40
|
+
}
|
|
29
41
|
});
|
|
30
42
|
};
|