@nocobase/cli 2.1.0-beta.20 → 2.1.0-beta.22
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/README.md +32 -50
- package/README.zh-CN.md +29 -46
- package/bin/run.js +15 -0
- package/dist/commands/app/down.js +260 -0
- package/dist/commands/app/info.js +140 -0
- package/dist/commands/app/logs.js +98 -0
- package/dist/commands/app/ps.js +60 -0
- package/dist/commands/app/restart.js +75 -0
- package/dist/commands/app/shared.js +95 -0
- package/dist/commands/app/start.js +252 -0
- package/dist/commands/app/stop.js +98 -0
- package/dist/commands/app/upgrade.js +595 -0
- package/dist/commands/build.js +3 -48
- package/dist/commands/db/shared.js +19 -5
- package/dist/commands/dev.js +3 -140
- package/dist/commands/down.js +3 -184
- package/dist/commands/download.js +4 -856
- package/dist/commands/env/add.js +33 -48
- package/dist/commands/env/auth.js +6 -13
- package/dist/commands/env/list.js +10 -15
- package/dist/commands/env/remove.js +4 -10
- package/dist/commands/env/update.js +7 -13
- package/dist/commands/env/use.js +5 -13
- package/dist/commands/{prompts-stages.js → examples/prompts-stages.js} +3 -3
- package/dist/commands/{prompts-test.js → examples/prompts-test.js} +3 -3
- package/dist/commands/init.js +262 -63
- package/dist/commands/install.js +352 -86
- package/dist/commands/logs.js +3 -81
- package/dist/commands/plugin/disable.js +64 -0
- package/dist/commands/plugin/enable.js +64 -0
- package/dist/commands/plugin/list.js +62 -0
- package/dist/commands/pm/disable.js +3 -54
- package/dist/commands/pm/enable.js +3 -54
- package/dist/commands/pm/list.js +3 -45
- package/dist/commands/ps.js +3 -107
- package/dist/commands/restart.js +3 -65
- package/dist/commands/scaffold/migration.js +1 -1
- package/dist/commands/scaffold/plugin.js +1 -1
- package/dist/commands/self/check.js +1 -1
- package/dist/commands/self/update.js +13 -3
- package/dist/commands/skills/check.js +11 -5
- package/dist/commands/skills/index.js +1 -1
- package/dist/commands/skills/install.js +20 -7
- package/dist/commands/skills/remove.js +71 -0
- package/dist/commands/skills/update.js +27 -7
- package/dist/commands/source/build.js +58 -0
- package/dist/commands/source/dev.js +157 -0
- package/dist/commands/source/download.js +866 -0
- package/dist/commands/source/test.js +467 -0
- package/dist/commands/start.js +3 -202
- package/dist/commands/stop.js +3 -81
- package/dist/commands/test.js +3 -457
- package/dist/commands/upgrade.js +3 -574
- package/dist/help/runtime-help.js +3 -0
- package/dist/lib/api-client.js +3 -2
- package/dist/lib/app-health.js +126 -0
- package/dist/lib/app-managed-resources.js +264 -0
- package/dist/lib/app-runtime.js +16 -5
- package/dist/lib/auth-store.js +162 -43
- package/dist/lib/bootstrap.js +13 -12
- package/dist/lib/cli-home.js +38 -6
- package/dist/lib/cli-locale.js +15 -1
- package/dist/lib/env-auth.js +3 -3
- package/dist/lib/env-config.js +80 -0
- package/dist/lib/generated-command.js +10 -2
- package/dist/lib/http-request.js +49 -0
- package/dist/lib/resource-command.js +10 -2
- package/dist/lib/runtime-generator.js +1 -1
- package/dist/lib/self-manager.js +1 -1
- package/dist/lib/skills-manager.js +173 -79
- package/dist/lib/startup-update.js +203 -0
- package/dist/locale/en-US.json +4 -1
- package/dist/locale/zh-CN.json +4 -1
- package/package.json +26 -3
package/dist/commands/env/add.js
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { Args, Command, Flags } from '@oclif/core';
|
|
10
10
|
import { upsertEnv } from '../../lib/auth-store.js';
|
|
11
|
+
import { resolveDefaultConfigScope } from '../../lib/cli-home.js';
|
|
12
|
+
import { buildStoredEnvConfig, } from '../../lib/env-config.js';
|
|
11
13
|
import { runPromptCatalog, } from '../../lib/prompt-catalog.js';
|
|
12
14
|
import { applyCliLocale, CLI_LOCALE_FLAG_DESCRIPTION, CLI_LOCALE_FLAG_OPTIONS, localeText, } from '../../lib/cli-locale.js';
|
|
13
15
|
import { validateApiBaseUrl } from '../../lib/prompt-validators.js';
|
|
@@ -32,6 +34,10 @@ const ENV_RUNTIME_FLAG_MAP = {
|
|
|
32
34
|
'db-database': 'dbDatabase',
|
|
33
35
|
'db-user': 'dbUser',
|
|
34
36
|
'db-password': 'dbPassword',
|
|
37
|
+
'root-username': 'rootUsername',
|
|
38
|
+
'root-email': 'rootEmail',
|
|
39
|
+
'root-password': 'rootPassword',
|
|
40
|
+
'root-nickname': 'rootNickname',
|
|
35
41
|
};
|
|
36
42
|
const ENV_BOOLEAN_RUNTIME_FLAG_MAP = {
|
|
37
43
|
'builtin-db': 'builtinDb',
|
|
@@ -45,7 +51,7 @@ export default class EnvAdd extends Command {
|
|
|
45
51
|
static examples = [
|
|
46
52
|
'<%= config.bin %> <%= command.id %>',
|
|
47
53
|
'<%= config.bin %> <%= command.id %> local',
|
|
48
|
-
'<%= config.bin %> <%= command.id %> local --
|
|
54
|
+
'<%= config.bin %> <%= command.id %> local --api-base-url http://localhost:13000/api --auth-type oauth',
|
|
49
55
|
];
|
|
50
56
|
static args = {
|
|
51
57
|
name: Args.string({
|
|
@@ -73,12 +79,6 @@ export default class EnvAdd extends Command {
|
|
|
73
79
|
description: 'Skip command intro when invoked by another CLI command',
|
|
74
80
|
default: false,
|
|
75
81
|
}),
|
|
76
|
-
scope: Flags.string({
|
|
77
|
-
char: 's',
|
|
78
|
-
description: 'Where to store env config: project (.nocobase in the repo) or global (user-level); prompted in a TTY when omitted',
|
|
79
|
-
options: ['project', 'global'],
|
|
80
|
-
default: 'project',
|
|
81
|
-
}),
|
|
82
82
|
'default-api-base-url': Flags.string({
|
|
83
83
|
char: 'd',
|
|
84
84
|
hidden: true,
|
|
@@ -86,7 +86,6 @@ export default class EnvAdd extends Command {
|
|
|
86
86
|
}),
|
|
87
87
|
'api-base-url': Flags.string({
|
|
88
88
|
char: 'u',
|
|
89
|
-
aliases: ['base-url'],
|
|
90
89
|
description: 'Root URL for HTTP API calls, including the /api prefix (e.g. http://localhost:13000/api); prompted in a TTY when omitted',
|
|
91
90
|
}),
|
|
92
91
|
'auth-type': Flags.string({
|
|
@@ -191,6 +190,22 @@ export default class EnvAdd extends Command {
|
|
|
191
190
|
hidden: true,
|
|
192
191
|
description: 'Database password saved with this env',
|
|
193
192
|
}),
|
|
193
|
+
'root-username': Flags.string({
|
|
194
|
+
hidden: true,
|
|
195
|
+
description: 'Initial root username saved with this env',
|
|
196
|
+
}),
|
|
197
|
+
'root-email': Flags.string({
|
|
198
|
+
hidden: true,
|
|
199
|
+
description: 'Initial root email saved with this env',
|
|
200
|
+
}),
|
|
201
|
+
'root-password': Flags.string({
|
|
202
|
+
hidden: true,
|
|
203
|
+
description: 'Initial root password saved with this env',
|
|
204
|
+
}),
|
|
205
|
+
'root-nickname': Flags.string({
|
|
206
|
+
hidden: true,
|
|
207
|
+
description: 'Initial root nickname saved with this env',
|
|
208
|
+
}),
|
|
194
209
|
};
|
|
195
210
|
static prompts = {
|
|
196
211
|
name: {
|
|
@@ -199,24 +214,6 @@ export default class EnvAdd extends Command {
|
|
|
199
214
|
placeholder: envAddText('prompts.name.placeholder'),
|
|
200
215
|
required: true,
|
|
201
216
|
},
|
|
202
|
-
scope: {
|
|
203
|
-
type: 'select',
|
|
204
|
-
message: envAddText('prompts.scope.message'),
|
|
205
|
-
options: [
|
|
206
|
-
{
|
|
207
|
-
value: 'project',
|
|
208
|
-
label: envAddText('prompts.scope.projectLabel'),
|
|
209
|
-
hint: envAddText('prompts.scope.projectHint'),
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
value: 'global',
|
|
213
|
-
label: envAddText('prompts.scope.globalLabel'),
|
|
214
|
-
hint: envAddText('prompts.scope.globalHint'),
|
|
215
|
-
},
|
|
216
|
-
],
|
|
217
|
-
initialValue: 'project',
|
|
218
|
-
required: true,
|
|
219
|
-
},
|
|
220
217
|
apiBaseUrl: {
|
|
221
218
|
type: 'text',
|
|
222
219
|
message: envAddText('prompts.apiBaseUrl.message'),
|
|
@@ -252,10 +249,7 @@ export default class EnvAdd extends Command {
|
|
|
252
249
|
if (name) {
|
|
253
250
|
values.name = name;
|
|
254
251
|
}
|
|
255
|
-
|
|
256
|
-
values.scope = flags.scope;
|
|
257
|
-
}
|
|
258
|
-
const apiFromFlag = flags['api-base-url'] ?? flags['base-url'];
|
|
252
|
+
const apiFromFlag = flags['api-base-url'];
|
|
259
253
|
if (typeof apiFromFlag === 'string' && apiFromFlag.trim() !== '') {
|
|
260
254
|
values.apiBaseUrl = apiFromFlag.trim();
|
|
261
255
|
}
|
|
@@ -277,28 +271,20 @@ export default class EnvAdd extends Command {
|
|
|
277
271
|
return initialValues;
|
|
278
272
|
}
|
|
279
273
|
buildEnvConfig(results, flags) {
|
|
280
|
-
const
|
|
281
|
-
|
|
274
|
+
const envConfigInput = {
|
|
275
|
+
apiBaseUrl: results.apiBaseUrl,
|
|
276
|
+
authType: results.authType,
|
|
277
|
+
accessToken: results.accessToken,
|
|
282
278
|
};
|
|
283
279
|
for (const [flagName, configKey] of Object.entries(ENV_RUNTIME_FLAG_MAP)) {
|
|
284
280
|
const value = flags[flagName];
|
|
285
|
-
|
|
286
|
-
envConfig[configKey] = value.trim();
|
|
287
|
-
}
|
|
281
|
+
envConfigInput[configKey] = value;
|
|
288
282
|
}
|
|
289
283
|
for (const [flagName, configKey] of Object.entries(ENV_BOOLEAN_RUNTIME_FLAG_MAP)) {
|
|
290
284
|
const value = flags[flagName];
|
|
291
|
-
|
|
292
|
-
envConfig[configKey] = value;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
if (flags['builtin-db'] === false) {
|
|
296
|
-
envConfig.builtinDbImage = undefined;
|
|
297
|
-
}
|
|
298
|
-
if (results.authType === 'token' && results.accessToken != null) {
|
|
299
|
-
envConfig.accessToken = String(results.accessToken);
|
|
285
|
+
envConfigInput[configKey] = value;
|
|
300
286
|
}
|
|
301
|
-
return
|
|
287
|
+
return buildStoredEnvConfig(envConfigInput);
|
|
302
288
|
}
|
|
303
289
|
async run() {
|
|
304
290
|
const { args, flags } = await this.parse(EnvAdd);
|
|
@@ -314,10 +300,9 @@ export default class EnvAdd extends Command {
|
|
|
314
300
|
command: this,
|
|
315
301
|
});
|
|
316
302
|
const envName = String(results.name);
|
|
317
|
-
const scope = results.scope;
|
|
318
303
|
const envConfig = this.buildEnvConfig(results, parsedFlags);
|
|
319
|
-
printVerbose(`Saving env "${envName}"
|
|
320
|
-
await upsertEnv(envName, envConfig, { scope });
|
|
304
|
+
printVerbose(`Saving env "${envName}" globally.`);
|
|
305
|
+
await upsertEnv(envName, envConfig, { scope: resolveDefaultConfigScope() });
|
|
321
306
|
if (results.authType === 'oauth') {
|
|
322
307
|
await this.config.runCommand('env:auth', [envName]);
|
|
323
308
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { Args, Command, Flags } from '@oclif/core';
|
|
10
10
|
import { getCurrentEnvName } from '../../lib/auth-store.js';
|
|
11
|
-
import {
|
|
11
|
+
import { resolveDefaultConfigScope } from '../../lib/cli-home.js';
|
|
12
12
|
import { authenticateEnvWithOauth } from '../../lib/env-auth.js';
|
|
13
13
|
import { failTask, startTask, succeedTask } from '../../lib/ui.js';
|
|
14
14
|
export default class EnvAuth extends Command {
|
|
@@ -16,7 +16,6 @@ export default class EnvAuth extends Command {
|
|
|
16
16
|
static examples = [
|
|
17
17
|
'<%= config.bin %> <%= command.id %>',
|
|
18
18
|
'<%= config.bin %> <%= command.id %> prod',
|
|
19
|
-
'<%= config.bin %> <%= command.id %> --scope global',
|
|
20
19
|
];
|
|
21
20
|
static args = {
|
|
22
21
|
name: Args.string({
|
|
@@ -31,31 +30,25 @@ export default class EnvAuth extends Command {
|
|
|
31
30
|
deprecated: true,
|
|
32
31
|
description: 'Environment name (same as the optional positional argument; for compatibility with -e/--env on other commands)',
|
|
33
32
|
}),
|
|
34
|
-
scope: Flags.string({
|
|
35
|
-
char: 's',
|
|
36
|
-
description: 'Config scope',
|
|
37
|
-
options: ['project', 'global'],
|
|
38
|
-
}),
|
|
39
33
|
};
|
|
40
34
|
async run() {
|
|
41
35
|
const { args, flags } = await this.parse(EnvAuth);
|
|
42
|
-
const scope = flags.scope;
|
|
43
36
|
const nameArg = args.name?.trim();
|
|
44
37
|
const nameFlag = flags.env?.trim() || undefined;
|
|
45
38
|
if (nameArg && nameFlag && nameArg !== nameFlag) {
|
|
46
39
|
this.error(`Environment name was provided both as the argument ("${nameArg}") and as --env ("${nameFlag}"). Please use only one.`);
|
|
47
40
|
}
|
|
48
|
-
const envName = nameArg || nameFlag || (await getCurrentEnvName({ scope }));
|
|
49
|
-
startTask(`Starting browser sign-in for "${envName}"
|
|
41
|
+
const envName = nameArg || nameFlag || (await getCurrentEnvName({ scope: resolveDefaultConfigScope() }));
|
|
42
|
+
startTask(`Starting browser sign-in for "${envName}"...`);
|
|
50
43
|
try {
|
|
51
44
|
await authenticateEnvWithOauth({
|
|
52
45
|
envName,
|
|
53
|
-
scope,
|
|
46
|
+
scope: resolveDefaultConfigScope(),
|
|
54
47
|
});
|
|
55
|
-
succeedTask(`Signed in to "${envName}"
|
|
48
|
+
succeedTask(`Signed in to "${envName}".`);
|
|
56
49
|
}
|
|
57
50
|
catch (error) {
|
|
58
|
-
failTask(`Sign-in failed for "${envName}"
|
|
51
|
+
failTask(`Sign-in failed for "${envName}".`);
|
|
59
52
|
throw error;
|
|
60
53
|
}
|
|
61
54
|
}
|
|
@@ -6,35 +6,30 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import { Command
|
|
9
|
+
import { Command } from '@oclif/core';
|
|
10
10
|
import { listEnvs } from '../../lib/auth-store.js';
|
|
11
|
-
import {
|
|
11
|
+
import { resolveDefaultConfigScope } from '../../lib/cli-home.js';
|
|
12
12
|
import { renderTable } from '../../lib/ui.js';
|
|
13
|
+
function resolveApiBaseUrl(config) {
|
|
14
|
+
return String(config.apiBaseUrl ?? config.baseUrl ?? config.apibaseUrl ?? '').trim();
|
|
15
|
+
}
|
|
13
16
|
export default class EnvList extends Command {
|
|
14
17
|
static summary = 'List configured environments';
|
|
15
18
|
static examples = [
|
|
16
19
|
'<%= config.bin %> <%= command.id %>',
|
|
17
20
|
];
|
|
18
|
-
static flags = {
|
|
19
|
-
scope: Flags.string({
|
|
20
|
-
char: 's',
|
|
21
|
-
description: 'Config scope',
|
|
22
|
-
options: ['project', 'global'],
|
|
23
|
-
}),
|
|
24
|
-
};
|
|
25
21
|
async run() {
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const { currentEnv, envs } = await listEnvs({ scope });
|
|
22
|
+
await this.parse(EnvList);
|
|
23
|
+
const { currentEnv, envs } = await listEnvs({ scope: resolveDefaultConfigScope() });
|
|
29
24
|
const names = Object.keys(envs).sort();
|
|
30
25
|
if (!names.length) {
|
|
31
|
-
this.log(
|
|
32
|
-
this.log('Run `nb env add <name> --base-url <url>` to add one.');
|
|
26
|
+
this.log('No envs configured.');
|
|
27
|
+
this.log('Run `nb env add <name> --api-base-url <url>` to add one.');
|
|
33
28
|
return;
|
|
34
29
|
}
|
|
35
30
|
const rows = names.map((name) => {
|
|
36
31
|
const env = envs[name];
|
|
37
|
-
return [name === currentEnv ? '*' : '', name, env
|
|
32
|
+
return [name === currentEnv ? '*' : '', name, resolveApiBaseUrl(env), env.auth?.type ?? '', env.runtime?.version ?? ''];
|
|
38
33
|
});
|
|
39
34
|
this.log(renderTable(['Current', 'Name', 'Base URL', 'Auth', 'Runtime'], rows));
|
|
40
35
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { Args, Command, Flags } from '@oclif/core';
|
|
10
10
|
import { getCurrentEnvName, removeEnv } from '../../lib/auth-store.js';
|
|
11
|
-
import {
|
|
11
|
+
import { resolveDefaultConfigScope } from '../../lib/cli-home.js';
|
|
12
12
|
import { confirmAction, isInteractiveTerminal, printVerbose, setVerboseMode } from '../../lib/ui.js';
|
|
13
13
|
export default class EnvRemove extends Command {
|
|
14
14
|
static summary = 'Remove a configured environment';
|
|
@@ -26,11 +26,6 @@ export default class EnvRemove extends Command {
|
|
|
26
26
|
description: 'Show detailed progress output',
|
|
27
27
|
default: false,
|
|
28
28
|
}),
|
|
29
|
-
scope: Flags.string({
|
|
30
|
-
char: 's',
|
|
31
|
-
description: 'Config scope',
|
|
32
|
-
options: ['project', 'global'],
|
|
33
|
-
}),
|
|
34
29
|
};
|
|
35
30
|
static args = {
|
|
36
31
|
name: Args.string({
|
|
@@ -41,8 +36,7 @@ export default class EnvRemove extends Command {
|
|
|
41
36
|
async run() {
|
|
42
37
|
const { args, flags } = await this.parse(EnvRemove);
|
|
43
38
|
setVerboseMode(flags.verbose);
|
|
44
|
-
const
|
|
45
|
-
const currentEnv = await getCurrentEnvName({ scope });
|
|
39
|
+
const currentEnv = await getCurrentEnvName({ scope: resolveDefaultConfigScope() });
|
|
46
40
|
if (args.name === currentEnv && !flags.force) {
|
|
47
41
|
if (!isInteractiveTerminal()) {
|
|
48
42
|
this.error('Refusing to remove the current env without confirmation. Re-run with `--force`.');
|
|
@@ -54,8 +48,8 @@ export default class EnvRemove extends Command {
|
|
|
54
48
|
}
|
|
55
49
|
}
|
|
56
50
|
printVerbose(`Removing env "${args.name}"`);
|
|
57
|
-
const result = await removeEnv(args.name, { scope });
|
|
58
|
-
this.log(`Removed env "${result.removed}"
|
|
51
|
+
const result = await removeEnv(args.name, { scope: resolveDefaultConfigScope() });
|
|
52
|
+
this.log(`Removed env "${result.removed}".`);
|
|
59
53
|
if (result.hasEnvs) {
|
|
60
54
|
this.log(`Current env: ${result.currentEnv}`);
|
|
61
55
|
return;
|
|
@@ -11,7 +11,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
11
11
|
import { Args, Command, Flags } from '@oclif/core';
|
|
12
12
|
import { getCurrentEnvName } from '../../lib/auth-store.js';
|
|
13
13
|
import { updateEnvRuntime } from '../../lib/bootstrap.js';
|
|
14
|
-
import {
|
|
14
|
+
import { resolveDefaultConfigScope } from '../../lib/cli-home.js';
|
|
15
15
|
import { failTask, startTask, succeedTask } from '../../lib/ui.js';
|
|
16
16
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
17
17
|
export default class EnvUpdate extends Command {
|
|
@@ -31,12 +31,7 @@ export default class EnvUpdate extends Command {
|
|
|
31
31
|
description: 'Show detailed progress output',
|
|
32
32
|
default: false,
|
|
33
33
|
}),
|
|
34
|
-
|
|
35
|
-
char: 's',
|
|
36
|
-
description: 'Config scope',
|
|
37
|
-
options: ['project', 'global'],
|
|
38
|
-
}),
|
|
39
|
-
'base-url': Flags.string({
|
|
34
|
+
'api-base-url': Flags.string({
|
|
40
35
|
description: 'NocoBase API base URL override. When provided, persist it to the target env before saving the refreshed runtime.',
|
|
41
36
|
}),
|
|
42
37
|
role: Flags.string({
|
|
@@ -49,21 +44,20 @@ export default class EnvUpdate extends Command {
|
|
|
49
44
|
};
|
|
50
45
|
async run() {
|
|
51
46
|
const { args, flags } = await this.parse(EnvUpdate);
|
|
52
|
-
const scope = flags.scope;
|
|
53
47
|
const envName = args.name;
|
|
54
|
-
const envLabel = envName ?? (await getCurrentEnvName({ scope }));
|
|
55
|
-
startTask(`Updating env runtime: ${envLabel}
|
|
48
|
+
const envLabel = envName ?? (await getCurrentEnvName({ scope: resolveDefaultConfigScope() }));
|
|
49
|
+
startTask(`Updating env runtime: ${envLabel}`);
|
|
56
50
|
try {
|
|
57
51
|
const runtime = await updateEnvRuntime({
|
|
58
52
|
envName,
|
|
59
|
-
scope,
|
|
60
|
-
baseUrl: flags['base-url'],
|
|
53
|
+
scope: resolveDefaultConfigScope(),
|
|
54
|
+
baseUrl: flags['api-base-url'],
|
|
61
55
|
role: flags.role,
|
|
62
56
|
token: flags.token,
|
|
63
57
|
configFile: path.join(path.dirname(path.dirname(path.dirname(__dirname))), 'nocobase-ctl.config.json'),
|
|
64
58
|
verbose: flags.verbose,
|
|
65
59
|
});
|
|
66
|
-
succeedTask(`Updated env "${envLabel}" to runtime "${runtime.version}"
|
|
60
|
+
succeedTask(`Updated env "${envLabel}" to runtime "${runtime.version}".`);
|
|
67
61
|
}
|
|
68
62
|
catch (error) {
|
|
69
63
|
failTask(`Failed to update env "${envLabel}".`);
|
package/dist/commands/env/use.js
CHANGED
|
@@ -6,21 +6,14 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import { Args, Command
|
|
9
|
+
import { Args, Command } from '@oclif/core';
|
|
10
10
|
import { setCurrentEnv } from '../../lib/auth-store.js';
|
|
11
|
-
import {
|
|
11
|
+
import { resolveDefaultConfigScope } from '../../lib/cli-home.js';
|
|
12
12
|
export default class EnvUse extends Command {
|
|
13
13
|
static summary = 'Switch the current environment';
|
|
14
14
|
static examples = [
|
|
15
15
|
'<%= config.bin %> <%= command.id %> local',
|
|
16
16
|
];
|
|
17
|
-
static flags = {
|
|
18
|
-
scope: Flags.string({
|
|
19
|
-
char: 's',
|
|
20
|
-
description: 'Config scope',
|
|
21
|
-
options: ['project', 'global'],
|
|
22
|
-
}),
|
|
23
|
-
};
|
|
24
17
|
static args = {
|
|
25
18
|
name: Args.string({
|
|
26
19
|
description: 'Configured environment name',
|
|
@@ -28,9 +21,8 @@ export default class EnvUse extends Command {
|
|
|
28
21
|
}),
|
|
29
22
|
};
|
|
30
23
|
async run() {
|
|
31
|
-
const { args
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.log(`Current env: ${args.name}${scope ? ` (${formatCliHomeScope(scope)} scope)` : ''}`);
|
|
24
|
+
const { args } = await this.parse(EnvUse);
|
|
25
|
+
await setCurrentEnv(args.name, { scope: resolveDefaultConfigScope() });
|
|
26
|
+
this.log(`Current env: ${args.name}`);
|
|
35
27
|
}
|
|
36
28
|
}
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { Args, Command, Flags } from '@oclif/core';
|
|
10
|
-
import { runPromptCatalog, } from "
|
|
11
|
-
import { applyCliLocale, CLI_LOCALE_FLAG_DESCRIPTION, CLI_LOCALE_FLAG_OPTIONS, } from "
|
|
12
|
-
import { runPromptCatalogWebUI } from "
|
|
10
|
+
import { runPromptCatalog, } from "../../lib/prompt-catalog.js";
|
|
11
|
+
import { applyCliLocale, CLI_LOCALE_FLAG_DESCRIPTION, CLI_LOCALE_FLAG_OPTIONS, } from "../../lib/cli-locale.js";
|
|
12
|
+
import { runPromptCatalogWebUI } from "../../lib/prompt-web-ui.js";
|
|
13
13
|
import PromptsTest from "./prompts-test.js";
|
|
14
14
|
function buildWebUiStagesFromTestPrompts(c) {
|
|
15
15
|
return [
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import * as p from '@clack/prompts';
|
|
10
10
|
import { Args, Command, Flags } from '@oclif/core';
|
|
11
|
-
import { runPromptCatalog, } from "
|
|
12
|
-
import { applyCliLocale, CLI_LOCALE_FLAG_DESCRIPTION, CLI_LOCALE_FLAG_OPTIONS, } from "
|
|
13
|
-
import { runPromptCatalogWebUI, } from "
|
|
11
|
+
import { runPromptCatalog, } from "../../lib/prompt-catalog.js";
|
|
12
|
+
import { applyCliLocale, CLI_LOCALE_FLAG_DESCRIPTION, CLI_LOCALE_FLAG_OPTIONS, } from "../../lib/cli-locale.js";
|
|
13
|
+
import { runPromptCatalogWebUI, } from "../../lib/prompt-web-ui.js";
|
|
14
14
|
export default class PromptsTest extends Command {
|
|
15
15
|
static hidden = true;
|
|
16
16
|
static args = {
|