@memberjunction/cli 5.0.0 → 5.1.0
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/bin/dev.cmd +2 -2
- package/bin/run.cmd +3 -3
- package/dist/commands/app/check-updates.d.ts +13 -0
- package/dist/commands/app/check-updates.d.ts.map +1 -0
- package/dist/commands/app/check-updates.js +54 -0
- package/dist/commands/app/check-updates.js.map +1 -0
- package/dist/commands/app/disable.d.ts +16 -0
- package/dist/commands/app/disable.d.ts.map +1 -0
- package/dist/commands/app/disable.js +47 -0
- package/dist/commands/app/disable.js.map +1 -0
- package/dist/commands/app/enable.d.ts +16 -0
- package/dist/commands/app/enable.d.ts.map +1 -0
- package/dist/commands/app/enable.js +47 -0
- package/dist/commands/app/enable.js.map +1 -0
- package/dist/commands/app/info.d.ts +16 -0
- package/dist/commands/app/info.d.ts.map +1 -0
- package/dist/commands/app/info.js +64 -0
- package/dist/commands/app/info.js.map +1 -0
- package/dist/commands/app/install.d.ts +21 -0
- package/dist/commands/app/install.d.ts.map +1 -0
- package/dist/commands/app/install.js +54 -0
- package/dist/commands/app/install.js.map +1 -0
- package/dist/commands/app/list.d.ts +16 -0
- package/dist/commands/app/list.d.ts.map +1 -0
- package/dist/commands/app/list.js +60 -0
- package/dist/commands/app/list.js.map +1 -0
- package/dist/commands/app/remove.d.ts +22 -0
- package/dist/commands/app/remove.d.ts.map +1 -0
- package/dist/commands/app/remove.js +66 -0
- package/dist/commands/app/remove.js.map +1 -0
- package/dist/commands/app/upgrade.d.ts +20 -0
- package/dist/commands/app/upgrade.d.ts.map +1 -0
- package/dist/commands/app/upgrade.js +52 -0
- package/dist/commands/app/upgrade.js.map +1 -0
- package/dist/config.d.ts +139 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +31 -0
- package/dist/config.js.map +1 -1
- package/dist/utils/open-app-context.d.ts +48 -0
- package/dist/utils/open-app-context.d.ts.map +1 -0
- package/dist/utils/open-app-context.js +143 -0
- package/dist/utils/open-app-context.js.map +1 -0
- package/oclif.manifest.json +515 -217
- package/package.json +11 -11
package/bin/dev.cmd
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
|
|
1
|
+
@echo off
|
|
2
|
+
|
|
3
3
|
node "%~dp0\dev" %*
|
package/bin/run.cmd
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
|
|
3
|
-
node "%~dp0\run" %*
|
|
1
|
+
@echo off
|
|
2
|
+
|
|
3
|
+
node "%~dp0\run" %*
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* CLI command: `mj app check-updates`.
|
|
4
|
+
*
|
|
5
|
+
* Queries GitHub for the latest version tag of each installed Open App
|
|
6
|
+
* and reports which apps have newer versions available.
|
|
7
|
+
*/
|
|
8
|
+
export default class AppCheckUpdates extends Command {
|
|
9
|
+
static description: string;
|
|
10
|
+
static examples: string[];
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=check-updates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-updates.d.ts","sourceRoot":"","sources":["../../../src/commands/app/check-updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAMtC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,MAAM,CAAC,WAAW,SAA6D;IAE/E,MAAM,CAAC,QAAQ,WAEb;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA2C3B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import ora from 'ora-classic';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { buildContextUser } from '../../utils/open-app-context.js';
|
|
5
|
+
import { getValidatedConfig } from '../../config.js';
|
|
6
|
+
/**
|
|
7
|
+
* CLI command: `mj app check-updates`.
|
|
8
|
+
*
|
|
9
|
+
* Queries GitHub for the latest version tag of each installed Open App
|
|
10
|
+
* and reports which apps have newer versions available.
|
|
11
|
+
*/
|
|
12
|
+
export default class AppCheckUpdates extends Command {
|
|
13
|
+
static { this.description = 'Check for available upgrades for installed MJ Open Apps'; }
|
|
14
|
+
static { this.examples = [
|
|
15
|
+
'<%= config.bin %> app check-updates',
|
|
16
|
+
]; }
|
|
17
|
+
async run() {
|
|
18
|
+
const spinner = ora('Checking for updates...').start();
|
|
19
|
+
try {
|
|
20
|
+
const { ListInstalledApps, GetLatestVersion } = await import('@memberjunction/open-app-engine');
|
|
21
|
+
const config = getValidatedConfig();
|
|
22
|
+
const contextUser = await buildContextUser();
|
|
23
|
+
const apps = await ListInstalledApps(contextUser);
|
|
24
|
+
if (apps.length === 0) {
|
|
25
|
+
spinner.info('No Open Apps installed.');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const githubOptions = { Token: config.openApps?.github?.token ?? process.env.GITHUB_TOKEN };
|
|
29
|
+
const updates = [];
|
|
30
|
+
for (const app of apps) {
|
|
31
|
+
const latest = await GetLatestVersion(app.RepositoryURL, githubOptions);
|
|
32
|
+
if (latest && latest !== app.Version) {
|
|
33
|
+
updates.push({ Name: app.Name, Current: app.Version, Latest: latest });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
spinner.stop();
|
|
37
|
+
if (updates.length === 0) {
|
|
38
|
+
this.log(chalk.green('\nAll apps are up to date.'));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.log(chalk.bold('\nUpdates available:\n'));
|
|
42
|
+
for (const update of updates) {
|
|
43
|
+
this.log(` ${update.Name}: ${chalk.yellow(update.Current)} -> ${chalk.green(update.Latest)}`);
|
|
44
|
+
}
|
|
45
|
+
this.log(`\nRun ${chalk.cyan('mj app upgrade <name>')} to upgrade.`);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
spinner.fail('Failed to check for updates');
|
|
49
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
50
|
+
this.error(message);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=check-updates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-updates.js","sourceRoot":"","sources":["../../../src/commands/app/check-updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;aAC3C,gBAAW,GAAG,yDAAyD,CAAC;aAExE,aAAQ,GAAG;QAChB,qCAAqC;KACtC,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,OAAO,GAAG,GAAG,CAAC,yBAAyB,CAAC,CAAC,KAAK,EAAE,CAAC;QAEvD,IAAI,CAAC;YACH,MAAM,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,iCAAiC,CAAC,CAAC;YAChG,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;YAEpC,MAAM,WAAW,GAAG,MAAM,gBAAgB,EAAE,CAAC;YAC7C,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,WAAW,CAAC,CAAC;YAElD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACtB,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;gBACxC,OAAO;YACT,CAAC;YAED,MAAM,aAAa,GAAG,EAAE,KAAK,EAAE,MAA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,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* CLI command: `mj app disable <name>`.
|
|
4
|
+
*
|
|
5
|
+
* Disables an installed Open App by commenting out its config entries and
|
|
6
|
+
* client imports. The app data and packages remain in place.
|
|
7
|
+
*/
|
|
8
|
+
export default class AppDisable extends Command {
|
|
9
|
+
static description: string;
|
|
10
|
+
static examples: string[];
|
|
11
|
+
static args: {
|
|
12
|
+
name: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=disable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disable.d.ts","sourceRoot":"","sources":["../../../src/commands/app/disable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,MAAM,aAAa,CAAC;AAK5C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,MAAM,CAAC,WAAW,SAA0D;IAE5E,MAAM,CAAC,QAAQ,WAEb;IAEF,MAAM,CAAC,IAAI;;MAKT;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAyB3B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Args, Command } from '@oclif/core';
|
|
2
|
+
import ora from 'ora-classic';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { buildOrchestratorContext } from '../../utils/open-app-context.js';
|
|
5
|
+
/**
|
|
6
|
+
* CLI command: `mj app disable <name>`.
|
|
7
|
+
*
|
|
8
|
+
* Disables an installed Open App by commenting out its config entries and
|
|
9
|
+
* client imports. The app data and packages remain in place.
|
|
10
|
+
*/
|
|
11
|
+
export default class AppDisable extends Command {
|
|
12
|
+
static { this.description = 'Disable an installed MJ Open App without removing it'; }
|
|
13
|
+
static { this.examples = [
|
|
14
|
+
'<%= config.bin %> app disable acme-crm',
|
|
15
|
+
]; }
|
|
16
|
+
static { this.args = {
|
|
17
|
+
name: Args.string({
|
|
18
|
+
description: 'Name of the installed app to disable',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
}; }
|
|
22
|
+
async run() {
|
|
23
|
+
const { args } = await this.parse(AppDisable);
|
|
24
|
+
const spinner = ora(`Disabling ${args.name}...`).start();
|
|
25
|
+
try {
|
|
26
|
+
const { DisableApp } = await import('@memberjunction/open-app-engine');
|
|
27
|
+
const context = await buildOrchestratorContext(this);
|
|
28
|
+
const result = await DisableApp(args.name, context);
|
|
29
|
+
if (result.Success) {
|
|
30
|
+
spinner.succeed(chalk.green(`Disabled ${args.name}`));
|
|
31
|
+
if (result.Summary) {
|
|
32
|
+
this.log(`\n${result.Summary}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
spinner.fail(chalk.red(`Failed to disable: ${result.ErrorMessage}`));
|
|
37
|
+
this.exit(1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
spinner.fail('Disable failed');
|
|
42
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
43
|
+
this.error(message);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=disable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disable.js","sourceRoot":"","sources":["../../../src/commands/app/disable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,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IAAI,CAAC,CAAC,CAAC,CAAC;YACf,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC/B,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* CLI command: `mj app enable <name>`.
|
|
4
|
+
*
|
|
5
|
+
* Re-enables a previously disabled Open App by restoring its config
|
|
6
|
+
* entries and client imports.
|
|
7
|
+
*/
|
|
8
|
+
export default class AppEnable extends Command {
|
|
9
|
+
static description: string;
|
|
10
|
+
static examples: string[];
|
|
11
|
+
static args: {
|
|
12
|
+
name: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=enable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enable.d.ts","sourceRoot":"","sources":["../../../src/commands/app/enable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,MAAM,aAAa,CAAC;AAK5C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,OAAO;IAC5C,MAAM,CAAC,WAAW,SAAsC;IAExD,MAAM,CAAC,QAAQ,WAEb;IAEF,MAAM,CAAC,IAAI;;MAKT;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAyB3B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Args, Command } from '@oclif/core';
|
|
2
|
+
import ora from 'ora-classic';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { buildOrchestratorContext } from '../../utils/open-app-context.js';
|
|
5
|
+
/**
|
|
6
|
+
* CLI command: `mj app enable <name>`.
|
|
7
|
+
*
|
|
8
|
+
* Re-enables a previously disabled Open App by restoring its config
|
|
9
|
+
* entries and client imports.
|
|
10
|
+
*/
|
|
11
|
+
export default class AppEnable extends Command {
|
|
12
|
+
static { this.description = 'Re-enable a disabled MJ Open App'; }
|
|
13
|
+
static { this.examples = [
|
|
14
|
+
'<%= config.bin %> app enable acme-crm',
|
|
15
|
+
]; }
|
|
16
|
+
static { this.args = {
|
|
17
|
+
name: Args.string({
|
|
18
|
+
description: 'Name of the installed app to enable',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
}; }
|
|
22
|
+
async run() {
|
|
23
|
+
const { args } = await this.parse(AppEnable);
|
|
24
|
+
const spinner = ora(`Enabling ${args.name}...`).start();
|
|
25
|
+
try {
|
|
26
|
+
const { EnableApp } = await import('@memberjunction/open-app-engine');
|
|
27
|
+
const context = await buildOrchestratorContext(this);
|
|
28
|
+
const result = await EnableApp(args.name, context);
|
|
29
|
+
if (result.Success) {
|
|
30
|
+
spinner.succeed(chalk.green(`Enabled ${args.name}`));
|
|
31
|
+
if (result.Summary) {
|
|
32
|
+
this.log(`\n${result.Summary}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
spinner.fail(chalk.red(`Failed to enable: ${result.ErrorMessage}`));
|
|
37
|
+
this.exit(1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
spinner.fail('Enable failed');
|
|
42
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
43
|
+
this.error(message);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=enable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enable.js","sourceRoot":"","s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AAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,qBAAqB,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;gBACpE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACf,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAC9B,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* CLI command: `mj app info <name>`.
|
|
4
|
+
*
|
|
5
|
+
* Displays detailed metadata about an installed Open App including
|
|
6
|
+
* publisher, version, schema, license, and description.
|
|
7
|
+
*/
|
|
8
|
+
export default class AppInfo extends Command {
|
|
9
|
+
static description: string;
|
|
10
|
+
static examples: string[];
|
|
11
|
+
static args: {
|
|
12
|
+
name: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../src/commands/app/info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,MAAM,aAAa,CAAC;AAI5C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;IAC1C,MAAM,CAAC,WAAW,SAA8D;IAEhF,MAAM,CAAC,QAAQ,WAEb;IAEF,MAAM,CAAC,IAAI;;MAKT;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA+B3B"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Args, Command } from '@oclif/core';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { buildContextUser } from '../../utils/open-app-context.js';
|
|
4
|
+
/**
|
|
5
|
+
* CLI command: `mj app info <name>`.
|
|
6
|
+
*
|
|
7
|
+
* Displays detailed metadata about an installed Open App including
|
|
8
|
+
* publisher, version, schema, license, and description.
|
|
9
|
+
*/
|
|
10
|
+
export default class AppInfo extends Command {
|
|
11
|
+
static { this.description = 'Show detailed information about an installed MJ Open App'; }
|
|
12
|
+
static { this.examples = [
|
|
13
|
+
'<%= config.bin %> app info acme-crm',
|
|
14
|
+
]; }
|
|
15
|
+
static { this.args = {
|
|
16
|
+
name: Args.string({
|
|
17
|
+
description: 'Name of the installed app',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
}; }
|
|
21
|
+
async run() {
|
|
22
|
+
const { args } = await this.parse(AppInfo);
|
|
23
|
+
try {
|
|
24
|
+
const { FindInstalledApp } = await import('@memberjunction/open-app-engine');
|
|
25
|
+
const contextUser = await buildContextUser();
|
|
26
|
+
const app = await FindInstalledApp(contextUser, args.name);
|
|
27
|
+
if (!app) {
|
|
28
|
+
this.error(`App '${args.name}' is not installed.`);
|
|
29
|
+
}
|
|
30
|
+
this.log(chalk.bold(`\n${app.DisplayName}\n`));
|
|
31
|
+
this.log(` Name: ${app.Name}`);
|
|
32
|
+
this.log(` Version: ${app.Version}`);
|
|
33
|
+
this.log(` Status: ${FormatStatus(app.Status)}`);
|
|
34
|
+
this.log(` Publisher: ${app.Publisher}`);
|
|
35
|
+
if (app.PublisherEmail)
|
|
36
|
+
this.log(` Email: ${app.PublisherEmail}`);
|
|
37
|
+
if (app.PublisherURL)
|
|
38
|
+
this.log(` URL: ${app.PublisherURL}`);
|
|
39
|
+
this.log(` Repository: ${app.RepositoryURL}`);
|
|
40
|
+
if (app.SchemaName)
|
|
41
|
+
this.log(` Schema: ${app.SchemaName}`);
|
|
42
|
+
this.log(` MJ Range: ${app.MJVersionRange}`);
|
|
43
|
+
if (app.License)
|
|
44
|
+
this.log(` License: ${app.License}`);
|
|
45
|
+
if (app.Description)
|
|
46
|
+
this.log(`\n ${app.Description}`);
|
|
47
|
+
this.log('');
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
51
|
+
this.error(message);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Returns the status string with color-coding based on app state. */
|
|
56
|
+
function FormatStatus(status) {
|
|
57
|
+
switch (status) {
|
|
58
|
+
case 'Active': return chalk.green(status);
|
|
59
|
+
case 'Error': return chalk.red(status);
|
|
60
|
+
case 'Disabled': return chalk.yellow(status);
|
|
61
|
+
default: return chalk.blue(status);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../../src/commands/app/info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;aACnC,gBAAW,GAAG,0DAA0D,CAAC;aAEzE,aAAQ,GAAG;QAChB,qCAAqC;KACtC,CAAC;aAEK,SAAI,GAAG;QACZ,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YAChB,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI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G,CAAC,kBAAkB,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;YACjD,IAAI,GAAG,CAAC,OAAO;gBAAE,IAAI,CAAC,GAAG,CAAC,kBAAkB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YAC3D,IAAI,GAAG,CAAC,WAAW;gBAAE,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;YACxD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;;AAIH,sEAAsE;AACtE,SAAS,YAAY,CAAC,MAAc;IAClC,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,QAAQ,CAAC,CAAC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1C,KAAK,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvC,KAAK,UAAU,CAAC,CAAC,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7C,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* CLI command: `mj app install <source>`.
|
|
4
|
+
*
|
|
5
|
+
* Installs an Open App from a GitHub repository URL, executing the full
|
|
6
|
+
* install flow (manifest validation, dependency resolution, schema creation,
|
|
7
|
+
* migration execution, npm package management, and config updates).
|
|
8
|
+
*/
|
|
9
|
+
export default class AppInstall extends Command {
|
|
10
|
+
static description: string;
|
|
11
|
+
static examples: string[];
|
|
12
|
+
static args: {
|
|
13
|
+
source: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
14
|
+
};
|
|
15
|
+
static flags: {
|
|
16
|
+
version: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
17
|
+
verbose: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
18
|
+
};
|
|
19
|
+
run(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/app/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAS,MAAM,aAAa,CAAC;AAKnD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,MAAM,CAAC,WAAW,SAAqD;IAEvE,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,IAAI;;MAKT;IAEF,MAAM,CAAC,KAAK;;;MAGV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA4B3B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import ora from 'ora-classic';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { buildOrchestratorContext } from '../../utils/open-app-context.js';
|
|
5
|
+
/**
|
|
6
|
+
* CLI command: `mj app install <source>`.
|
|
7
|
+
*
|
|
8
|
+
* Installs an Open App from a GitHub repository URL, executing the full
|
|
9
|
+
* install flow (manifest validation, dependency resolution, schema creation,
|
|
10
|
+
* migration execution, npm package management, and config updates).
|
|
11
|
+
*/
|
|
12
|
+
export default class AppInstall extends Command {
|
|
13
|
+
static { this.description = 'Install an MJ Open App from a GitHub repository'; }
|
|
14
|
+
static { this.examples = [
|
|
15
|
+
'<%= config.bin %> app install https://github.com/acme/mj-crm',
|
|
16
|
+
'<%= config.bin %> app install https://github.com/acme/mj-crm --version 1.2.0',
|
|
17
|
+
'<%= config.bin %> app install https://github.com/acme/mj-crm --verbose',
|
|
18
|
+
]; }
|
|
19
|
+
static { this.args = {
|
|
20
|
+
source: Args.string({
|
|
21
|
+
description: 'GitHub repository URL of the Open App',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
}; }
|
|
25
|
+
static { this.flags = {
|
|
26
|
+
version: Flags.string({ description: 'Specific version to install (default: latest)' }),
|
|
27
|
+
verbose: Flags.boolean({ char: 'v', description: 'Show detailed output' }),
|
|
28
|
+
}; }
|
|
29
|
+
async run() {
|
|
30
|
+
const { args, flags } = await this.parse(AppInstall);
|
|
31
|
+
const spinner = ora();
|
|
32
|
+
try {
|
|
33
|
+
const { InstallApp } = await import('@memberjunction/open-app-engine');
|
|
34
|
+
const context = await buildOrchestratorContext(this, flags.verbose);
|
|
35
|
+
const result = await InstallApp({ Source: args.source, Version: flags.version, Verbose: flags.verbose }, context);
|
|
36
|
+
if (result.Success) {
|
|
37
|
+
spinner.succeed(chalk.green(`Installed ${result.AppName} v${result.Version}`));
|
|
38
|
+
if (result.Summary) {
|
|
39
|
+
this.log(`\n${result.Summary}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
spinner.fail(chalk.red(`Install failed: ${result.ErrorMessage}`));
|
|
44
|
+
this.exit(1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
spinner.fail('Install failed');
|
|
49
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
50
|
+
this.error(message);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot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OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EACvE,OAAO,CACR,CAAC;YAEF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,OAAO,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;gBAC/E,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;oBACnB,IAAI,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,mBAAmB,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;gBAClE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACf,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC/B,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* CLI command: `mj app list`.
|
|
4
|
+
*
|
|
5
|
+
* Displays a table of all installed Open Apps with name, version, and status.
|
|
6
|
+
* Use `--verbose` to include schema and publisher columns.
|
|
7
|
+
*/
|
|
8
|
+
export default class AppList extends Command {
|
|
9
|
+
static description: string;
|
|
10
|
+
static examples: string[];
|
|
11
|
+
static flags: {
|
|
12
|
+
verbose: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/app/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAa7C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;IAC1C,MAAM,CAAC,WAAW,SAAqC;IAEvD,MAAM,CAAC,QAAQ,WAEb;IAEF,MAAM,CAAC,KAAK;;MAEV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAoB3B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { buildContextUser } from '../../utils/open-app-context.js';
|
|
4
|
+
/**
|
|
5
|
+
* CLI command: `mj app list`.
|
|
6
|
+
*
|
|
7
|
+
* Displays a table of all installed Open Apps with name, version, and status.
|
|
8
|
+
* Use `--verbose` to include schema and publisher columns.
|
|
9
|
+
*/
|
|
10
|
+
export default class AppList extends Command {
|
|
11
|
+
static { this.description = 'List all installed MJ Open Apps'; }
|
|
12
|
+
static { this.examples = [
|
|
13
|
+
'<%= config.bin %> app list',
|
|
14
|
+
]; }
|
|
15
|
+
static { this.flags = {
|
|
16
|
+
verbose: Flags.boolean({ char: 'v', description: 'Show detailed output' }),
|
|
17
|
+
}; }
|
|
18
|
+
async run() {
|
|
19
|
+
const { flags } = await this.parse(AppList);
|
|
20
|
+
try {
|
|
21
|
+
const { ListInstalledApps } = await import('@memberjunction/open-app-engine');
|
|
22
|
+
const contextUser = await buildContextUser();
|
|
23
|
+
const apps = await ListInstalledApps(contextUser);
|
|
24
|
+
if (apps.length === 0) {
|
|
25
|
+
this.log('No Open Apps installed.');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.log(chalk.bold('\nInstalled Open Apps:\n'));
|
|
29
|
+
this.log(FormatAppTable(apps, flags.verbose));
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
33
|
+
this.error(message);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** Formats installed apps into a fixed-width table string with color-coded status. */
|
|
38
|
+
function FormatAppTable(apps, verbose) {
|
|
39
|
+
const lines = [];
|
|
40
|
+
const header = verbose
|
|
41
|
+
? PadColumns(['Name', 'Version', 'Status', 'Schema', 'Publisher'])
|
|
42
|
+
: PadColumns(['Name', 'Version', 'Status']);
|
|
43
|
+
const separator = '-'.repeat(header.length);
|
|
44
|
+
lines.push(header);
|
|
45
|
+
lines.push(separator);
|
|
46
|
+
for (const app of apps) {
|
|
47
|
+
const statusColor = app.Status === 'Active' ? chalk.green : app.Status === 'Error' ? chalk.red : chalk.yellow;
|
|
48
|
+
const row = verbose
|
|
49
|
+
? PadColumns([app.Name, app.Version, statusColor(app.Status), app.SchemaName ?? '-', app.Publisher])
|
|
50
|
+
: PadColumns([app.Name, app.Version, statusColor(app.Status)]);
|
|
51
|
+
lines.push(row);
|
|
52
|
+
}
|
|
53
|
+
return lines.join('\n');
|
|
54
|
+
}
|
|
55
|
+
/** Pads an array of column values to fixed widths for table alignment. */
|
|
56
|
+
function PadColumns(values) {
|
|
57
|
+
const widths = [30, 12, 12, 20, 30];
|
|
58
|
+
return values.map((v, i) => v.padEnd(widths[i] ?? 20)).join(' ');
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/app/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM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MAAM,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* CLI command: `mj app remove <name>`.
|
|
4
|
+
*
|
|
5
|
+
* Removes an installed Open App, optionally preserving its database schema
|
|
6
|
+
* and data. Prompts for confirmation unless `--yes` is passed.
|
|
7
|
+
*/
|
|
8
|
+
export default class AppRemove extends Command {
|
|
9
|
+
static description: string;
|
|
10
|
+
static examples: string[];
|
|
11
|
+
static args: {
|
|
12
|
+
name: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
13
|
+
};
|
|
14
|
+
static flags: {
|
|
15
|
+
'keep-data': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
16
|
+
force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
17
|
+
yes: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
18
|
+
verbose: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
19
|
+
};
|
|
20
|
+
run(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/commands/app/remove.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAS,MAAM,aAAa,CAAC;AAMnD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,OAAO;IAC5C,MAAM,CAAC,WAAW,SAAqC;IAEvD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,IAAI;;MAKT;IAEF,MAAM,CAAC,KAAK;;;;;MAKV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAwC3B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { confirm } from '@inquirer/prompts';
|
|
3
|
+
import ora from 'ora-classic';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { buildOrchestratorContext } from '../../utils/open-app-context.js';
|
|
6
|
+
/**
|
|
7
|
+
* CLI command: `mj app remove <name>`.
|
|
8
|
+
*
|
|
9
|
+
* Removes an installed Open App, optionally preserving its database schema
|
|
10
|
+
* and data. Prompts for confirmation unless `--yes` is passed.
|
|
11
|
+
*/
|
|
12
|
+
export default class AppRemove extends Command {
|
|
13
|
+
static { this.description = 'Remove an installed MJ Open App'; }
|
|
14
|
+
static { this.examples = [
|
|
15
|
+
'<%= config.bin %> app remove acme-crm',
|
|
16
|
+
'<%= config.bin %> app remove acme-crm --keep-data',
|
|
17
|
+
'<%= config.bin %> app remove acme-crm --force',
|
|
18
|
+
]; }
|
|
19
|
+
static { this.args = {
|
|
20
|
+
name: Args.string({
|
|
21
|
+
description: 'Name of the installed app to remove',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
}; }
|
|
25
|
+
static { this.flags = {
|
|
26
|
+
'keep-data': Flags.boolean({ description: 'Keep the database schema and data' }),
|
|
27
|
+
force: Flags.boolean({ description: 'Force removal even if other apps depend on this one' }),
|
|
28
|
+
yes: Flags.boolean({ char: 'y', description: 'Skip confirmation prompt' }),
|
|
29
|
+
verbose: Flags.boolean({ char: 'v', description: 'Show detailed output' }),
|
|
30
|
+
}; }
|
|
31
|
+
async run() {
|
|
32
|
+
const { args, flags } = await this.parse(AppRemove);
|
|
33
|
+
const spinner = ora();
|
|
34
|
+
if (!flags.yes) {
|
|
35
|
+
const confirmed = await confirm({
|
|
36
|
+
message: `Are you sure you want to remove '${args.name}'?${flags['keep-data'] ? ' (data will be kept)' : ' This will DROP the app schema and all data.'}`,
|
|
37
|
+
default: false,
|
|
38
|
+
});
|
|
39
|
+
if (!confirmed) {
|
|
40
|
+
this.log(chalk.yellow('Removal cancelled.'));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const { RemoveApp } = await import('@memberjunction/open-app-engine');
|
|
46
|
+
const context = await buildOrchestratorContext(this, flags.verbose);
|
|
47
|
+
const result = await RemoveApp({ AppName: args.name, KeepData: flags['keep-data'], Force: flags.force, Verbose: flags.verbose }, context);
|
|
48
|
+
if (result.Success) {
|
|
49
|
+
spinner.succeed(chalk.green(`Removed ${result.AppName}`));
|
|
50
|
+
if (result.Summary) {
|
|
51
|
+
this.log(`\n${result.Summary}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
spinner.fail(chalk.red(`Remove failed: ${result.ErrorMessage}`));
|
|
56
|
+
this.exit(1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
spinner.fail('Remove failed');
|
|
61
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
62
|
+
this.error(message);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../src/commands/app/remove.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B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AAC,CAAC;QACtB,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* CLI command: `mj app upgrade <name>`.
|
|
4
|
+
*
|
|
5
|
+
* Upgrades an installed Open App to a newer version, running new migrations,
|
|
6
|
+
* updating packages, and recording upgrade history.
|
|
7
|
+
*/
|
|
8
|
+
export default class AppUpgrade extends Command {
|
|
9
|
+
static description: string;
|
|
10
|
+
static examples: string[];
|
|
11
|
+
static args: {
|
|
12
|
+
name: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
13
|
+
};
|
|
14
|
+
static flags: {
|
|
15
|
+
version: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
16
|
+
verbose: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
17
|
+
};
|
|
18
|
+
run(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=upgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../../src/commands/app/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAS,MAAM,aAAa,CAAC;AAKnD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,MAAM,CAAC,WAAW,SAAyD;IAE3E,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,IAAI;;MAKT;IAEF,MAAM,CAAC,KAAK;;;MAGV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA4B3B"}
|