@nocobase/cli 1.5.0-beta.1 → 1.5.0-beta.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/cli",
3
- "version": "1.5.0-beta.1",
3
+ "version": "1.5.0-beta.3",
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.5.0-beta.1",
11
+ "@nocobase/app": "1.5.0-beta.3",
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.19.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@nocobase/devtools": "1.5.0-beta.1"
28
+ "@nocobase/devtools": "1.5.0-beta.3"
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": "10c6f1f3d90e91f3aabfa80449c7ef062e90f6af"
35
+ "gitHead": "81afcf4affdb652faf4636e6d9351828ce8906be"
36
36
  }
@@ -30,10 +30,10 @@ module.exports = (cli) => {
30
30
  cli
31
31
  .command('dev')
32
32
  .option('-p, --port [port]')
33
- .option('--client')
34
- .option('--server')
33
+ .option('-c, --client')
34
+ .option('-s, --server')
35
35
  .option('--db-sync')
36
- .option('--inspect [port]')
36
+ .option('-i, --inspect [port]')
37
37
  .allowUnknownOption()
38
38
  .action(async (opts) => {
39
39
  let subprocess;
@@ -58,14 +58,16 @@ class Package {
58
58
  return [version, this.data.versions[version].dist.tarball];
59
59
  }
60
60
 
61
- if (version.includes('beta')) {
62
- version = version.split('beta')[0] + 'beta';
63
- } else if (version.includes('alpha')) {
64
- const prefix = (version = version.split('alpha')[0]);
65
- version = Object.keys(this.data.versions)
66
- .filter((ver) => ver.startsWith(`${prefix}alpha`))
67
- .sort()
68
- .pop();
61
+ const keys = version.split('.');
62
+ const length = keys.length;
63
+
64
+ if (version.includes('rc')) {
65
+ version = version.split('-').shift();
66
+ }
67
+
68
+ if (length === 5) {
69
+ keys.pop();
70
+ version = keys.join('.');
69
71
  }
70
72
 
71
73
  if (version === 'latest') {
@@ -93,11 +95,25 @@ class Package {
93
95
  return false;
94
96
  }
95
97
 
98
+ async isDownloaded(version) {
99
+ const packageFile = path.resolve(process.env.PLUGIN_STORAGE_PATH, this.packageName, 'package.json');
100
+ if (await fs.exists(packageFile)) {
101
+ const json = await fs.readJson(packageFile);
102
+ if (json.version === version) {
103
+ return true;
104
+ }
105
+ }
106
+ return false;
107
+ }
108
+
96
109
  async download(options = {}) {
97
110
  if (await this.isDevPackage()) {
98
111
  console.log(chalk.yellowBright(`Skipped: ${this.packageName} is dev package`));
99
112
  return;
100
113
  }
114
+ if (await this.isDownloaded(options.version)) {
115
+ return;
116
+ }
101
117
  await this.getInfo();
102
118
  if (!this.data) {
103
119
  console.log(chalk.redBright(`Download failed: ${this.packageName} package does not exist`));
@@ -105,6 +121,9 @@ class Package {
105
121
  }
106
122
  try {
107
123
  const [version, url] = this.getTarball(options.version);
124
+ if (await this.isDownloaded(version)) {
125
+ return;
126
+ }
108
127
  const response = await axios({
109
128
  url,
110
129
  responseType: 'stream',
@@ -200,8 +219,12 @@ module.exports = (cli) => {
200
219
  .command('download-pro')
201
220
  .option('-V, --version [version]')
202
221
  .action(async () => {
203
- const { NOCOBASE_PKG_URL, NOCOBASE_PKG_USERNAME, NOCOBASE_PKG_PASSWORD } = process.env;
204
- if (!(NOCOBASE_PKG_URL && NOCOBASE_PKG_USERNAME && NOCOBASE_PKG_PASSWORD)) {
222
+ const {
223
+ NOCOBASE_PKG_URL = 'https://pkg.nocobase.com/',
224
+ NOCOBASE_PKG_USERNAME,
225
+ NOCOBASE_PKG_PASSWORD,
226
+ } = process.env;
227
+ if (!(NOCOBASE_PKG_USERNAME && NOCOBASE_PKG_PASSWORD)) {
205
228
  return;
206
229
  }
207
230
  const credentials = { username: NOCOBASE_PKG_USERNAME, password: NOCOBASE_PKG_PASSWORD };
package/src/util.js CHANGED
@@ -337,6 +337,7 @@ exports.initEnv = function initEnv() {
337
337
  LOCAL_STORAGE_DEST: 'storage/uploads',
338
338
  PLUGIN_STORAGE_PATH: resolve(process.cwd(), 'storage/plugins'),
339
339
  MFSU_AD: 'none',
340
+ MAKO_AD: 'none',
340
341
  WS_PATH: '/ws',
341
342
  SOCKET_PATH: 'storage/gateway.sock',
342
343
  NODE_MODULES_PATH: resolve(process.cwd(), 'node_modules'),