@contentstack/cli 1.8.0 → 1.8.2
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 +2 -2
- package/package.json +5 -5
- package/lib/config/index.d.ts +0 -8
- package/lib/config/index.js +0 -9
- package/lib/help.d.ts +0 -7
- package/lib/help.js +0 -57
- package/lib/hooks/init/context-init.d.ts +0 -4
- package/lib/hooks/init/context-init.js +0 -10
- package/lib/hooks/init/utils-init.d.ts +0 -4
- package/lib/hooks/init/utils-init.js +0 -14
- package/lib/hooks/prerun/auth-guard.d.ts +0 -1
- package/lib/hooks/prerun/auth-guard.js +0 -39
- package/lib/hooks/prerun/command-deprecation-check.d.ts +0 -1
- package/lib/hooks/prerun/command-deprecation-check.js +0 -10
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -3
- package/lib/interfaces/index.d.ts +0 -31
- package/lib/interfaces/index.js +0 -2
- package/lib/utils/context-handler.d.ts +0 -16
- package/lib/utils/context-handler.js +0 -55
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -8
- package/oclif.manifest.json +0 -4
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli
|
|
|
18
18
|
$ csdx COMMAND
|
|
19
19
|
running command...
|
|
20
20
|
$ csdx (--version|-v)
|
|
21
|
-
@contentstack/cli/1.8.
|
|
21
|
+
@contentstack/cli/1.8.2 darwin-arm64 node-v20.3.1
|
|
22
22
|
$ csdx --help [COMMAND]
|
|
23
23
|
USAGE
|
|
24
24
|
$ csdx COMMAND
|
|
@@ -2807,7 +2807,7 @@ DESCRIPTION
|
|
|
2807
2807
|
Display help for csdx.
|
|
2808
2808
|
```
|
|
2809
2809
|
|
|
2810
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.
|
|
2810
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.14/src/commands/help.ts)_
|
|
2811
2811
|
|
|
2812
2812
|
## `csdx launch`
|
|
2813
2813
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli",
|
|
3
3
|
"description": "Command-line tool (CLI) to interact with Contentstack",
|
|
4
|
-
"version": "1.8.
|
|
4
|
+
"version": "1.8.2",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bin": {
|
|
7
7
|
"csdx": "./bin/run"
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"@contentstack/cli-cm-bulk-publish": "~1.3.10",
|
|
28
28
|
"@contentstack/cli-cm-clone": "~1.4.15",
|
|
29
29
|
"@contentstack/cli-cm-export": "~1.8.0",
|
|
30
|
-
"@contentstack/cli-cm-export-to-csv": "~1.
|
|
31
|
-
"@contentstack/cli-cm-import": "~1.8.
|
|
30
|
+
"@contentstack/cli-cm-export-to-csv": "~1.4.0",
|
|
31
|
+
"@contentstack/cli-cm-import": "~1.8.2",
|
|
32
32
|
"@contentstack/cli-cm-migrate-rte": "~1.4.10",
|
|
33
33
|
"@contentstack/cli-cm-seed": "~1.4.14",
|
|
34
34
|
"@contentstack/cli-command": "~1.2.11",
|
|
35
35
|
"@contentstack/cli-config": "~1.4.10",
|
|
36
36
|
"@contentstack/cli-launch": "~1.0.10",
|
|
37
|
-
"@contentstack/cli-migration": "~1.3.
|
|
37
|
+
"@contentstack/cli-migration": "~1.3.11",
|
|
38
38
|
"@contentstack/cli-utilities": "~1.5.1",
|
|
39
39
|
"@contentstack/management": "~1.10.0",
|
|
40
|
-
"@contentstack/cli-cm-branches": "~1.0.
|
|
40
|
+
"@contentstack/cli-cm-branches": "~1.0.11",
|
|
41
41
|
"@oclif/plugin-help": "^5",
|
|
42
42
|
"@oclif/plugin-not-found": "^2.3.9",
|
|
43
43
|
"@oclif/plugin-plugins": "^2.1.7",
|
package/lib/config/index.d.ts
DELETED
package/lib/config/index.js
DELETED
package/lib/help.d.ts
DELETED
package/lib/help.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const figlet = tslib_1.__importStar(require("figlet"));
|
|
5
|
-
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
6
|
-
class MyHelpClass extends cli_utilities_1.Help {
|
|
7
|
-
constructor(config, opts) {
|
|
8
|
-
super(config, opts);
|
|
9
|
-
}
|
|
10
|
-
showRootHelp() {
|
|
11
|
-
// Shows Contentstack graphics
|
|
12
|
-
cli_utilities_1.cliux.print(figlet.textSync('Contentstack', {
|
|
13
|
-
horizontalLayout: 'default',
|
|
14
|
-
verticalLayout: 'default',
|
|
15
|
-
}));
|
|
16
|
-
super.showRootHelp();
|
|
17
|
-
}
|
|
18
|
-
showCommandHelp(command) {
|
|
19
|
-
if (command.id === 'cm:bulk-publish') {
|
|
20
|
-
let { context: { plugin: { commands = [] } = {} } = {} } = this.config;
|
|
21
|
-
commands = commands.map((c) => {
|
|
22
|
-
return Object.assign(Object.assign({}, c), { name: c.id });
|
|
23
|
-
});
|
|
24
|
-
const title = command.description && this.render(command.description).split('\n')[0];
|
|
25
|
-
if (title)
|
|
26
|
-
console.log(title + '\n');
|
|
27
|
-
console.log(this.formatCommand(command));
|
|
28
|
-
console.log('');
|
|
29
|
-
if (commands.length > 0) {
|
|
30
|
-
console.log(this.formatCommands(commands));
|
|
31
|
-
console.log('');
|
|
32
|
-
}
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
super.showCommandHelp(command);
|
|
36
|
-
}
|
|
37
|
-
formatCommands(commands) {
|
|
38
|
-
if (commands.length === 0)
|
|
39
|
-
return '';
|
|
40
|
-
const body = this.renderList(commands
|
|
41
|
-
// if aliases do not contain the current command's id it is the main command
|
|
42
|
-
.filter(c => !c.aliases.some(a => a === c.id))
|
|
43
|
-
.map(c => {
|
|
44
|
-
if (this.config.topicSeparator !== ':')
|
|
45
|
-
c.id = c.id.replace(/:/g, this.config.topicSeparator);
|
|
46
|
-
// Add aliases at the end of summary
|
|
47
|
-
const summary = c.aliases.length > 0 ? `${this.summary(c)} (ALIASES: ${c.aliases.join(', ')})` : this.summary(c);
|
|
48
|
-
return [c.id, summary];
|
|
49
|
-
}), {
|
|
50
|
-
spacer: '\n',
|
|
51
|
-
stripAnsi: this.opts.stripAnsi,
|
|
52
|
-
indentation: 2
|
|
53
|
-
});
|
|
54
|
-
return this.section('COMMANDS', body);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.default = MyHelpClass;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../../utils");
|
|
4
|
-
/**
|
|
5
|
-
* Set the cli context
|
|
6
|
-
*/
|
|
7
|
-
function default_1(opts) {
|
|
8
|
-
this.config.context = new utils_1.CsdxContext(opts, this.config);
|
|
9
|
-
}
|
|
10
|
-
exports.default = default_1;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
4
|
-
/**
|
|
5
|
-
* Initialize the utilities
|
|
6
|
-
*/
|
|
7
|
-
function default_1(_opts) {
|
|
8
|
-
const { context } = this.config;
|
|
9
|
-
cli_utilities_1.logger.init(context);
|
|
10
|
-
cli_utilities_1.messageHandler.init(context);
|
|
11
|
-
cli_utilities_1.cliux.init(context);
|
|
12
|
-
cli_utilities_1.managementSDKInitiator.init(context);
|
|
13
|
-
}
|
|
14
|
-
exports.default = default_1;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function (opts: any): Promise<void>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
4
|
-
// TBD: run region command if region is not there
|
|
5
|
-
async function default_1(opts) {
|
|
6
|
-
const { context: { plugin: { config: { protectedCommands = {} } = {} } = {}, region = null } = {} } = this.config;
|
|
7
|
-
if (opts.Command.id !== 'config:set:region') {
|
|
8
|
-
if (!region) {
|
|
9
|
-
cli_utilities_1.cliux.error('No region found, please set a region $config:set:region');
|
|
10
|
-
this.exit();
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
cli_utilities_1.cliux.print(`\n Currently using ${region.name} region \n`, { color: 'grey' });
|
|
14
|
-
}
|
|
15
|
-
// Auth guard
|
|
16
|
-
if (protectedCommands[opts.Command.id]) {
|
|
17
|
-
if (!(0, cli_utilities_1.isAuthenticated)()) {
|
|
18
|
-
cli_utilities_1.logger.error('No auth token found for command', opts.Command.id);
|
|
19
|
-
cli_utilities_1.cliux.error('Please login to execute the command');
|
|
20
|
-
this.exit();
|
|
21
|
-
}
|
|
22
|
-
const client = await (0, cli_utilities_1.managementSDKClient)({ host: region.cma });
|
|
23
|
-
try {
|
|
24
|
-
const result = await client.getUser();
|
|
25
|
-
if (!result) {
|
|
26
|
-
cli_utilities_1.logger.error('error in auth validation');
|
|
27
|
-
cli_utilities_1.cliux.error('Please login to execute the command');
|
|
28
|
-
this.exit();
|
|
29
|
-
}
|
|
30
|
-
cli_utilities_1.logger.debug('logged in user', result.data);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
cli_utilities_1.logger.error('error in auth validation', error);
|
|
34
|
-
cli_utilities_1.cliux.error('Please login to execute the command');
|
|
35
|
-
process.exit();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.default = default_1;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function (_opts: any): Promise<void>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
4
|
-
async function default_1(_opts) {
|
|
5
|
-
const { context: { plugin: { config: { expiredCommands = {} } = {} } = {}, info: { command = null } = {} } = {} } = this.config;
|
|
6
|
-
if (expiredCommands.hasOwnProperty(command)) {
|
|
7
|
-
cli_utilities_1.cliux.print(`WARNING!!! You're using the old (soon to be deprecated) Contentstack CLI command. We recommend you to use the latest ${expiredCommands[command]} command.`, { color: 'yellow' });
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.default = default_1;
|
package/lib/index.d.ts
DELETED
package/lib/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Config, Plugin } from '@contentstack/cli-utilities';
|
|
2
|
-
export interface PrintOptions {
|
|
3
|
-
color?: string;
|
|
4
|
-
}
|
|
5
|
-
export interface InquirePayload {
|
|
6
|
-
type: string;
|
|
7
|
-
name: string;
|
|
8
|
-
message: string;
|
|
9
|
-
choices?: Array<any>;
|
|
10
|
-
transformer?: Function;
|
|
11
|
-
}
|
|
12
|
-
export interface Region {
|
|
13
|
-
name: string;
|
|
14
|
-
cma: string;
|
|
15
|
-
cda: string;
|
|
16
|
-
}
|
|
17
|
-
export interface Context {
|
|
18
|
-
id: string;
|
|
19
|
-
user: {
|
|
20
|
-
authtoken: string;
|
|
21
|
-
email: string;
|
|
22
|
-
};
|
|
23
|
-
region: any;
|
|
24
|
-
plugin: Plugin;
|
|
25
|
-
config: any;
|
|
26
|
-
info: any;
|
|
27
|
-
messageFilePath: any;
|
|
28
|
-
}
|
|
29
|
-
export interface CLIConfig extends Config {
|
|
30
|
-
context: Context;
|
|
31
|
-
}
|
package/lib/interfaces/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export default class CsdxContext {
|
|
2
|
-
readonly sessionId: string;
|
|
3
|
-
readonly clientId: string;
|
|
4
|
-
readonly user?: object;
|
|
5
|
-
readonly region?: object;
|
|
6
|
-
readonly config: object;
|
|
7
|
-
readonly info: any;
|
|
8
|
-
readonly plugin: any;
|
|
9
|
-
readonly pluginConfig: any;
|
|
10
|
-
readonly messageFilePath: string;
|
|
11
|
-
readonly analyticsInfo: string;
|
|
12
|
-
flagWarningPrintState: any;
|
|
13
|
-
flags: any;
|
|
14
|
-
constructor(cliOpts: any, cliConfig: any);
|
|
15
|
-
getToken(alias: string): any;
|
|
16
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const shortUUID = tslib_1.__importStar(require("short-uuid"));
|
|
5
|
-
const path = tslib_1.__importStar(require("path"));
|
|
6
|
-
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
7
|
-
const node_machine_id_1 = require("node-machine-id");
|
|
8
|
-
class CsdxContext {
|
|
9
|
-
constructor(cliOpts, cliConfig) {
|
|
10
|
-
var _a, _b, _c;
|
|
11
|
-
const analyticsInfo = [];
|
|
12
|
-
const command = cliConfig.findCommand(cliOpts.id) || {};
|
|
13
|
-
const config = cli_utilities_1.configHandler;
|
|
14
|
-
const platform = cliConfig.platform && cliConfig.arch ? `${cliConfig.platform}-${cliConfig.arch}` : 'none';
|
|
15
|
-
analyticsInfo.push(platform);
|
|
16
|
-
const nodeVersion = process.versions.node ? `v${process.versions.node}` : process.version;
|
|
17
|
-
analyticsInfo.push(nodeVersion || 'none');
|
|
18
|
-
analyticsInfo.push(cliConfig.version || 'none');
|
|
19
|
-
this.clientId = cli_utilities_1.configHandler.get('clientId');
|
|
20
|
-
if (!this.clientId) {
|
|
21
|
-
this.clientId = (0, node_machine_id_1.machineIdSync)(true);
|
|
22
|
-
cli_utilities_1.configHandler.set('clientId', this.clientId);
|
|
23
|
-
}
|
|
24
|
-
analyticsInfo.push(this.clientId);
|
|
25
|
-
const sessionId = shortUUID.generate();
|
|
26
|
-
cli_utilities_1.configHandler.set('sessionId', sessionId);
|
|
27
|
-
this.sessionId = sessionId;
|
|
28
|
-
analyticsInfo.push(this.sessionId);
|
|
29
|
-
this.user = {
|
|
30
|
-
authtoken: cli_utilities_1.configHandler.get('authtoken'),
|
|
31
|
-
email: cli_utilities_1.configHandler.get('email'),
|
|
32
|
-
};
|
|
33
|
-
this.config = Object.assign({}, config);
|
|
34
|
-
this.region = cli_utilities_1.configHandler.get('region');
|
|
35
|
-
this.info = { command: cliOpts.id };
|
|
36
|
-
if (command.pluginName) {
|
|
37
|
-
this.plugin = (cliConfig.plugins || []).find((p) => p.name === command.pluginName) || {};
|
|
38
|
-
this.plugin.name = command.pluginName;
|
|
39
|
-
this.plugin.config = Object.assign({}, ((this.plugin.pjson && this.plugin.pjson.csdxConfig) || {}));
|
|
40
|
-
this.messageFilePath = path.resolve(this.plugin.root, this.plugin.config.messageFilePath || './messages/index.json');
|
|
41
|
-
this.info.shortCommandName = (_c = (_b = (_a = this.plugin) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.shortCommandName) === null || _c === void 0 ? void 0 : _c[cliOpts.id];
|
|
42
|
-
analyticsInfo.push(this.info.shortCommandName || cliOpts.id);
|
|
43
|
-
}
|
|
44
|
-
this.flagWarningPrintState = {};
|
|
45
|
-
this.analyticsInfo = analyticsInfo.join(';');
|
|
46
|
-
}
|
|
47
|
-
getToken(alias) {
|
|
48
|
-
if (alias) {
|
|
49
|
-
const token = cli_utilities_1.configHandler.get(`tokens.${alias}`);
|
|
50
|
-
if (token)
|
|
51
|
-
return token;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.default = CsdxContext;
|
package/lib/utils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as CsdxContext } from './context-handler';
|
package/lib/utils/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CsdxContext = void 0;
|
|
7
|
-
var context_handler_1 = require("./context-handler");
|
|
8
|
-
Object.defineProperty(exports, "CsdxContext", { enumerable: true, get: function () { return __importDefault(context_handler_1).default; } });
|
package/oclif.manifest.json
DELETED