@nocobase/cli 1.4.12 → 1.4.13
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/pkg.js +24 -3
- package/src/util.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.13",
|
|
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.4.
|
|
11
|
+
"@nocobase/app": "1.4.13",
|
|
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.4.
|
|
28
|
+
"@nocobase/devtools": "1.4.13"
|
|
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": "f050b8fc444e552d275b5c3befe57a4f6e2749dd"
|
|
36
36
|
}
|
package/src/commands/pkg.js
CHANGED
|
@@ -140,7 +140,7 @@ class Package {
|
|
|
140
140
|
.on('finish', resolve)
|
|
141
141
|
.on('error', reject);
|
|
142
142
|
});
|
|
143
|
-
console.log(chalk.greenBright(`
|
|
143
|
+
console.log(chalk.greenBright(`Downloaded: ${this.packageName}@${version}`));
|
|
144
144
|
} catch (error) {
|
|
145
145
|
console.log(chalk.redBright(`Download failed: ${this.packageName}`));
|
|
146
146
|
}
|
|
@@ -194,16 +194,37 @@ class PackageManager {
|
|
|
194
194
|
|
|
195
195
|
async getPackages() {
|
|
196
196
|
const pkgs = await this.getProPackages();
|
|
197
|
+
|
|
198
|
+
if (Array.isArray(pkgs)) {
|
|
199
|
+
return {
|
|
200
|
+
commercial_plugins: pkgs,
|
|
201
|
+
licensed_plugins: pkgs,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
197
204
|
return pkgs;
|
|
198
205
|
}
|
|
199
206
|
|
|
207
|
+
async removePackage(packageName) {
|
|
208
|
+
const dir = path.resolve(process.env.PLUGIN_STORAGE_PATH, packageName);
|
|
209
|
+
const r = await fs.exists(dir);
|
|
210
|
+
if (r) {
|
|
211
|
+
console.log(chalk.yellowBright(`Removed: ${packageName}`));
|
|
212
|
+
await fs.rm(dir, { force: true, recursive: true });
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
200
216
|
async download(options = {}) {
|
|
201
217
|
const { version } = options;
|
|
202
218
|
if (!this.token) {
|
|
203
219
|
return;
|
|
204
220
|
}
|
|
205
|
-
const
|
|
206
|
-
for (const pkg of
|
|
221
|
+
const { commercial_plugins, licensed_plugins } = await this.getPackages();
|
|
222
|
+
for (const pkg of commercial_plugins) {
|
|
223
|
+
if (!licensed_plugins.includes(pkg)) {
|
|
224
|
+
await this.removePackage(pkg);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
for (const pkg of licensed_plugins) {
|
|
207
228
|
await this.getPackage(pkg).download({ version });
|
|
208
229
|
}
|
|
209
230
|
}
|
package/src/util.js
CHANGED
|
@@ -164,6 +164,10 @@ exports.promptForTs = () => {
|
|
|
164
164
|
};
|
|
165
165
|
|
|
166
166
|
exports.downloadPro = async () => {
|
|
167
|
+
const { NOCOBASE_PKG_USERNAME, NOCOBASE_PKG_PASSWORD } = process.env;
|
|
168
|
+
if (!(NOCOBASE_PKG_USERNAME && NOCOBASE_PKG_PASSWORD)) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
167
171
|
await exports.run('yarn', ['nocobase', 'pkg', 'download-pro']);
|
|
168
172
|
};
|
|
169
173
|
|