@nocobase/cli 1.8.0-alpha.9 → 1.8.0-beta.10
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 -5
- package/src/commands/index.js +0 -2
- package/src/commands/pkg.js +2 -6
- package/src/util.js +4 -24
- package/src/commands/instance-id.js +0 -46
- package/src/commands/view-license-key.js +0 -44
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/cli",
|
|
3
|
-
"version": "1.8.0-
|
|
3
|
+
"version": "1.8.0-beta.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
"nocobase": "./bin/index.js"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@nocobase/app": "1.8.0-
|
|
12
|
-
"@nocobase/license-kit": "^0.2.3",
|
|
11
|
+
"@nocobase/app": "1.8.0-beta.10",
|
|
13
12
|
"@types/fs-extra": "^11.0.1",
|
|
14
13
|
"@umijs/utils": "3.5.20",
|
|
15
14
|
"chalk": "^4.1.1",
|
|
@@ -27,12 +26,12 @@
|
|
|
27
26
|
"tsx": "^4.19.0"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
|
-
"@nocobase/devtools": "1.8.0-
|
|
29
|
+
"@nocobase/devtools": "1.8.0-beta.10"
|
|
31
30
|
},
|
|
32
31
|
"repository": {
|
|
33
32
|
"type": "git",
|
|
34
33
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
35
34
|
"directory": "packages/core/cli"
|
|
36
35
|
},
|
|
37
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "09fe854edfc44f45422fa983093dd34694416c5a"
|
|
38
37
|
}
|
package/src/commands/index.js
CHANGED
|
@@ -35,8 +35,6 @@ module.exports = (cli) => {
|
|
|
35
35
|
require('./upgrade')(cli);
|
|
36
36
|
require('./postinstall')(cli);
|
|
37
37
|
require('./pkg')(cli);
|
|
38
|
-
require('./instance-id')(cli);
|
|
39
|
-
require('./view-license-key')(cli);
|
|
40
38
|
if (isPackageValid('@umijs/utils')) {
|
|
41
39
|
require('./create-plugin')(cli);
|
|
42
40
|
}
|
package/src/commands/pkg.js
CHANGED
|
@@ -15,7 +15,6 @@ const tar = require('tar');
|
|
|
15
15
|
const path = require('path');
|
|
16
16
|
const { createStoragePluginsSymlink } = require('@nocobase/utils/plugin-symlink');
|
|
17
17
|
const chalk = require('chalk');
|
|
18
|
-
const { getAccessKeyPair } = require('../util');
|
|
19
18
|
|
|
20
19
|
class Package {
|
|
21
20
|
data;
|
|
@@ -249,13 +248,10 @@ module.exports = (cli) => {
|
|
|
249
248
|
NOCOBASE_PKG_USERNAME,
|
|
250
249
|
NOCOBASE_PKG_PASSWORD,
|
|
251
250
|
} = process.env;
|
|
252
|
-
|
|
253
|
-
if (!(NOCOBASE_PKG_USERNAME && NOCOBASE_PKG_PASSWORD) && !(accessKeyId && accessKeySecret)) {
|
|
251
|
+
if (!(NOCOBASE_PKG_USERNAME && NOCOBASE_PKG_PASSWORD)) {
|
|
254
252
|
return;
|
|
255
253
|
}
|
|
256
|
-
const credentials =
|
|
257
|
-
? { username: accessKeyId, password: accessKeySecret }
|
|
258
|
-
: { username: NOCOBASE_PKG_USERNAME, password: NOCOBASE_PKG_PASSWORD };
|
|
254
|
+
const credentials = { username: NOCOBASE_PKG_USERNAME, password: NOCOBASE_PKG_PASSWORD };
|
|
259
255
|
const pm = new PackageManager({ baseURL: NOCOBASE_PKG_URL });
|
|
260
256
|
await pm.login(credentials);
|
|
261
257
|
const file = path.resolve(__dirname, '../../package.json');
|
package/src/util.js
CHANGED
|
@@ -18,7 +18,6 @@ const dotenv = require('dotenv');
|
|
|
18
18
|
const fs = require('fs-extra');
|
|
19
19
|
const os = require('os');
|
|
20
20
|
const moment = require('moment-timezone');
|
|
21
|
-
const { keyDecrypt } = require('@nocobase/license-kit');
|
|
22
21
|
|
|
23
22
|
exports.isPackageValid = (pkg) => {
|
|
24
23
|
try {
|
|
@@ -166,11 +165,10 @@ exports.promptForTs = () => {
|
|
|
166
165
|
};
|
|
167
166
|
|
|
168
167
|
exports.downloadPro = async () => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
// }
|
|
168
|
+
const { NOCOBASE_PKG_USERNAME, NOCOBASE_PKG_PASSWORD } = process.env;
|
|
169
|
+
if (!(NOCOBASE_PKG_USERNAME && NOCOBASE_PKG_PASSWORD)) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
174
172
|
await exports.run('yarn', ['nocobase', 'pkg', 'download-pro']);
|
|
175
173
|
};
|
|
176
174
|
|
|
@@ -489,21 +487,3 @@ exports.generatePlugins = function () {
|
|
|
489
487
|
return;
|
|
490
488
|
}
|
|
491
489
|
};
|
|
492
|
-
|
|
493
|
-
exports.getAccessKeyPair = function () {
|
|
494
|
-
const keyFile = resolve(process.cwd(), 'storage/.license/license-key');
|
|
495
|
-
if (!fs.existsSync(keyFile)) {
|
|
496
|
-
console.log(chalk.yellow('license-key file not found', keyFile));
|
|
497
|
-
return {};
|
|
498
|
-
}
|
|
499
|
-
try {
|
|
500
|
-
const str = fs.readFileSync(keyFile, 'utf-8');
|
|
501
|
-
const keyDataStr = keyDecrypt(str);
|
|
502
|
-
const keyData = JSON.parse(keyDataStr);
|
|
503
|
-
const { accessKeyId, accessKeySecret } = keyData;
|
|
504
|
-
return { accessKeyId, accessKeySecret };
|
|
505
|
-
} catch (error) {
|
|
506
|
-
console.log(chalk.yellow('Key parse failed, please check your key'));
|
|
507
|
-
return {};
|
|
508
|
-
}
|
|
509
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
const chalk = require('chalk');
|
|
11
|
-
const { Command } = require('commander');
|
|
12
|
-
const { run, isDev } = require('../util');
|
|
13
|
-
const { getInstanceIdAsync } = require('@nocobase/license-kit');
|
|
14
|
-
const path = require('path');
|
|
15
|
-
const fs = require('fs');
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @param {Command} cli
|
|
20
|
-
*/
|
|
21
|
-
module.exports = (cli) => {
|
|
22
|
-
cli
|
|
23
|
-
.command('generate-instance-id')
|
|
24
|
-
.description('Generate InstanceID')
|
|
25
|
-
.option('--force', 'Force generate InstanceID')
|
|
26
|
-
.action(async (options) => {
|
|
27
|
-
console.log('Generating InstanceID...');
|
|
28
|
-
const dir = path.resolve(process.cwd(), 'storage/.license');
|
|
29
|
-
const filePath = path.resolve(dir, 'instance-id');
|
|
30
|
-
if (fs.existsSync(filePath) && !options.force) {
|
|
31
|
-
console.log('InstanceID already exists at ' + filePath);
|
|
32
|
-
return;
|
|
33
|
-
} else {
|
|
34
|
-
if (!fs.existsSync(dir)) {
|
|
35
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
const instanceId = await getInstanceIdAsync();
|
|
39
|
-
fs.writeFileSync(filePath, instanceId + '\n');
|
|
40
|
-
console.log(chalk.greenBright(`InstanceID saved to ${filePath}`));
|
|
41
|
-
} catch (e) {
|
|
42
|
-
console.log(e);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
const chalk = require('chalk');
|
|
11
|
-
const { Command } = require('commander');
|
|
12
|
-
const { keyDecrypt } = require('@nocobase/license-kit');
|
|
13
|
-
const path = require('path');
|
|
14
|
-
const fs = require('fs');
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param {Command} cli
|
|
19
|
-
*/
|
|
20
|
-
module.exports = (cli) => {
|
|
21
|
-
cli
|
|
22
|
-
.command('view-license-key')
|
|
23
|
-
.description('View License Key')
|
|
24
|
-
.action(async (options) => {
|
|
25
|
-
const dir = path.resolve(process.cwd(), 'storage/.license');
|
|
26
|
-
const filePath = path.resolve(dir, 'license-key');
|
|
27
|
-
if (!fs.existsSync(filePath)) {
|
|
28
|
-
console.log('License key not found at ' + filePath);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const key = fs.readFileSync(filePath, 'utf-8');
|
|
32
|
-
let keyDataStr;
|
|
33
|
-
try {
|
|
34
|
-
keyDataStr = keyDecrypt(key);
|
|
35
|
-
} catch (e) {
|
|
36
|
-
console.log('License key decrypt failed', e);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const keyData = JSON.parse(keyDataStr);
|
|
40
|
-
const { accessKeyId, accessKeySecret } = keyData;
|
|
41
|
-
console.log(chalk.greenBright(`Access Key ID: ${accessKeyId}`));
|
|
42
|
-
console.log(chalk.greenBright(`Access Key Secret: ${accessKeySecret}`));
|
|
43
|
-
});
|
|
44
|
-
};
|