@contentstack/cli-config 1.3.0 → 1.4.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/README.md CHANGED
@@ -1,33 +1,57 @@
1
- @contentstack/cli-config
2
- ===
1
+ # @contentstack/cli-config
3
2
 
4
3
  The config namespace contains all the commands that you will need to configure the CLI as per your requirements. Contentstack currently supports three regions: North America, Europe and Azure North America. [Configure the CLI documentation](https://www.contentstack.com/docs/developers/cli/configure-the-cli)
5
4
 
6
5
  [![License](https://img.shields.io/npm/l/@contentstack/cli)](https://github.com/contentstack/cli/blob/main/LICENSE)
7
6
 
8
7
  <!-- toc -->
8
+ * [@contentstack/cli-config](#contentstackcli-config)
9
9
  * [Usage](#usage)
10
10
  * [Commands](#commands)
11
11
  <!-- tocstop -->
12
+
12
13
  # Usage
14
+
13
15
  <!-- usage -->
14
16
  ```sh-session
15
17
  $ npm install -g @contentstack/cli-config
16
18
  $ csdx COMMAND
17
19
  running command...
18
20
  $ csdx (--version)
19
- @contentstack/cli-config/1.3.0 linux-x64 node-v16.20.0
21
+ @contentstack/cli-config/1.4.0 linux-x64 node-v16.20.0
20
22
  $ csdx --help [COMMAND]
21
23
  USAGE
22
24
  $ csdx COMMAND
23
25
  ...
24
26
  ```
25
27
  <!-- usagestop -->
28
+
26
29
  # Commands
30
+
27
31
  <!-- commands -->
32
+ * [`csdx config:get:base-branch`](#csdx-configgetbase-branch)
28
33
  * [`csdx config:get:region`](#csdx-configgetregion)
34
+ * [`csdx config:remove:base-branch`](#csdx-configremovebase-branch)
35
+ * [`csdx config:set:base-branch`](#csdx-configsetbase-branch)
29
36
  * [`csdx config:set:region [REGION]`](#csdx-configsetregion-region)
30
37
 
38
+ ## `csdx config:get:base-branch`
39
+
40
+ Get current branch set for CLI
41
+
42
+ ```
43
+ USAGE
44
+ $ csdx config:get:base-branch
45
+
46
+ DESCRIPTION
47
+ Get current branch set for CLI
48
+
49
+ EXAMPLES
50
+ $ csdx config:get:base-branch
51
+ ```
52
+
53
+ _See code: [src/commands/config/get/base-branch.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/get/base-branch.ts)_
54
+
31
55
  ## `csdx config:get:region`
32
56
 
33
57
  Get current region set for CLI
@@ -45,23 +69,70 @@ EXAMPLES
45
69
 
46
70
  _See code: [src/commands/config/get/region.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/get/region.ts)_
47
71
 
72
+ ## `csdx config:remove:base-branch`
73
+
74
+ Remove branch config for CLI
75
+
76
+ ```
77
+ USAGE
78
+ $ csdx config:remove:base-branch [-k <value>] [-y]
79
+
80
+ FLAGS
81
+ -k, --stack-api-key=<value> Stack API Key
82
+ -y, --yes Force Remove
83
+
84
+ DESCRIPTION
85
+ Remove branch config for CLI
86
+
87
+ EXAMPLES
88
+ $ csdx config:remove:base-branch
89
+
90
+ $ csdx config:remove:base-branch --stack-api-key <value>
91
+ ```
92
+
93
+ _See code: [src/commands/config/remove/base-branch.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/remove/base-branch.ts)_
94
+
95
+ ## `csdx config:set:base-branch`
96
+
97
+ Set branch for CLI
98
+
99
+ ```
100
+ USAGE
101
+ $ csdx config:set:base-branch [-k <value>] [--base-branch <value>]
102
+
103
+ FLAGS
104
+ -k, --stack-api-key=<value> Stack API Key
105
+ --base-branch=<value> Base Branch
106
+
107
+ DESCRIPTION
108
+ Set branch for CLI
109
+
110
+ EXAMPLES
111
+ $ csdx config:set:base-branch
112
+
113
+ $ csdx config:set:base-branch --stack-api-key <value> --base-branch <value>
114
+ ```
115
+
116
+ _See code: [src/commands/config/set/base-branch.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/set/base-branch.ts)_
117
+
48
118
  ## `csdx config:set:region [REGION]`
49
119
 
50
120
  Set region for CLI
51
121
 
52
122
  ```
53
123
  USAGE
54
- $ csdx config:set:region [REGION] [-d <value> -m <value> -n <value>]
124
+ $ csdx config:set:region [REGION] [-d <value> -m <value> --ui-host <value> -n <value>]
55
125
 
56
126
  ARGUMENTS
57
127
  REGION Name for the region
58
128
 
59
129
  FLAGS
60
- -d, --cda=<value> Custom host to set for content delivery API, if this flag is added then cma and name flags are
61
- required
62
- -m, --cma=<value> Custom host to set for content management API, , if this flag is added then cda and name flags are
63
- required
64
- -n, --name=<value> Name for the region, if this flag is added then cda and cma flags are required
130
+ -d, --cda=<value> Custom host to set for content delivery API, if this flag is added then cma, ui-host and name
131
+ flags are required
132
+ -m, --cma=<value> Custom host to set for content management API, , if this flag is added then cda, ui-host and name
133
+ flags are required
134
+ -n, --name=<value> Name for the region, if this flag is added then cda, cma and ui-host flags are required
135
+ --ui-host=<value> Custom UI host to set for CLI, if this flag is added then cda, cma and name flags are required
65
136
 
66
137
  DESCRIPTION
67
138
  Set region for CLI
@@ -71,9 +142,9 @@ EXAMPLES
71
142
 
72
143
  $ csdx config:set:region NA
73
144
 
74
- $ csdx config:set:region NA
145
+ $ csdx config:set:region EU
75
146
 
76
- $ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --name "India"
147
+ $ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --ui-host <contentstack_ui_host_endpoint> --name "India"
77
148
  ```
78
149
 
79
150
  _See code: [src/commands/config/set/region.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/set/region.ts)_
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cli_command_1 = require("@contentstack/cli-command");
4
+ const cli_utilities_1 = require("@contentstack/cli-utilities");
5
+ class BranchGetCommand extends cli_command_1.Command {
6
+ async run() {
7
+ try {
8
+ let config = cli_utilities_1.configHandler.get(`baseBranch`);
9
+ if (config && Object.keys(config).length > 0) {
10
+ let configList = Object.keys(config).map((key) => ({ ['Stack API Key']: key, ['Branch']: config[key] }));
11
+ cli_utilities_1.cliux.table(configList, {
12
+ 'Stack API Key': {
13
+ minWidth: 8,
14
+ },
15
+ Branch: {
16
+ minWidth: 8,
17
+ },
18
+ }, {
19
+ printLine: cli_utilities_1.cliux.print,
20
+ });
21
+ }
22
+ else {
23
+ cli_utilities_1.cliux.print(`error: ${cli_utilities_1.messageHandler.parse('CLI_CONFIG_BRANCH_LIST_NO_BRANCHES')}`, { color: 'red' });
24
+ }
25
+ }
26
+ catch (error) {
27
+ cli_utilities_1.cliux.error('error', error);
28
+ }
29
+ }
30
+ }
31
+ exports.default = BranchGetCommand;
32
+ BranchGetCommand.description = 'Get current branch set for CLI';
33
+ BranchGetCommand.examples = ['$ csdx config:get:base-branch'];
@@ -13,6 +13,7 @@ class RegionGetCommand extends cli_command_1.Command {
13
13
  cli_utilities_1.cliux.print(`Currently using ${currentRegion.name} region`);
14
14
  cli_utilities_1.cliux.print(`CDA HOST: ${currentRegion.cda}`);
15
15
  cli_utilities_1.cliux.print(`CMA HOST: ${currentRegion.cma}`);
16
+ cli_utilities_1.cliux.print(`UI HOST: ${currentRegion.uiHost}`);
16
17
  }
17
18
  }
18
19
  exports.default = RegionGetCommand;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cli_command_1 = require("@contentstack/cli-command");
4
+ const cli_utilities_1 = require("@contentstack/cli-utilities");
5
+ const utils_1 = require("../../../utils");
6
+ class RemoveBranchConfigCommand extends cli_command_1.Command {
7
+ async run() {
8
+ try {
9
+ const { flags: configRemoveFlags } = await this.parse(RemoveBranchConfigCommand);
10
+ if (!configRemoveFlags['stack-api-key']) {
11
+ configRemoveFlags['stack-api-key'] = await utils_1.interactive.askStackAPIKey();
12
+ }
13
+ if (cli_utilities_1.configHandler.get(`baseBranch.${configRemoveFlags['stack-api-key']}`) === undefined) {
14
+ cli_utilities_1.cliux.error(`No config set for stack-api-key : ${configRemoveFlags['stack-api-key']}`);
15
+ return;
16
+ }
17
+ else {
18
+ function deleteConfig() {
19
+ cli_utilities_1.configHandler.delete(`baseBranch.${configRemoveFlags['stack-api-key']}`);
20
+ cli_utilities_1.cliux.success(`Base branch configuration for stack-api-key: ${configRemoveFlags['stack-api-key']} removed successfully`);
21
+ }
22
+ cli_utilities_1.cliux.success(`base branch : ${await cli_utilities_1.configHandler.get(`baseBranch.${configRemoveFlags['stack-api-key']}`)}`);
23
+ cli_utilities_1.cliux.success(`stack-api-key: ${configRemoveFlags['stack-api-key']}`);
24
+ if (configRemoveFlags.yes) {
25
+ deleteConfig();
26
+ }
27
+ else {
28
+ const confirmation = await utils_1.interactive.askConfirmation();
29
+ if (!confirmation) {
30
+ return;
31
+ }
32
+ else {
33
+ deleteConfig();
34
+ }
35
+ }
36
+ }
37
+ }
38
+ catch (error) {
39
+ cli_utilities_1.cliux.error('error', error);
40
+ }
41
+ }
42
+ }
43
+ exports.default = RemoveBranchConfigCommand;
44
+ RemoveBranchConfigCommand.description = 'Remove branch config for CLI';
45
+ RemoveBranchConfigCommand.flags = {
46
+ 'stack-api-key': cli_utilities_1.flags.string({ char: 'k', description: 'Stack API Key' }),
47
+ yes: cli_utilities_1.flags.boolean({ char: 'y', description: 'Force Remove' }),
48
+ };
49
+ RemoveBranchConfigCommand.examples = ['$ csdx config:remove:base-branch', '$ csdx config:remove:base-branch --stack-api-key <value>'];
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cli_command_1 = require("@contentstack/cli-command");
4
+ const cli_utilities_1 = require("@contentstack/cli-utilities");
5
+ const utils_1 = require("../../../utils");
6
+ class BranchSetCommand extends cli_command_1.Command {
7
+ async run() {
8
+ try {
9
+ const { flags: branchSetFlags } = await this.parse(BranchSetCommand);
10
+ let apiKey = branchSetFlags['stack-api-key'];
11
+ let baseBranch = branchSetFlags['base-branch'];
12
+ if (!apiKey) {
13
+ apiKey = await utils_1.interactive.askStackAPIKey();
14
+ }
15
+ if (!baseBranch) {
16
+ baseBranch = await utils_1.interactive.askBaseBranch();
17
+ }
18
+ cli_utilities_1.configHandler.set(`baseBranch.${apiKey}`, baseBranch);
19
+ cli_utilities_1.cliux.success(`base branch : ${baseBranch}`);
20
+ cli_utilities_1.cliux.success(`stack-api-key: ${apiKey}`);
21
+ cli_utilities_1.cliux.success(`Base branch configuration for stack-api-key: ${apiKey} and branch: ${baseBranch} set successfully`);
22
+ }
23
+ catch (error) {
24
+ cli_utilities_1.cliux.error('error', error);
25
+ }
26
+ }
27
+ }
28
+ exports.default = BranchSetCommand;
29
+ BranchSetCommand.description = 'Set branch for CLI';
30
+ BranchSetCommand.flags = {
31
+ 'stack-api-key': cli_utilities_1.flags.string({ char: 'k', description: 'Stack API Key' }),
32
+ 'base-branch': cli_utilities_1.flags.string({ description: 'Base Branch' }),
33
+ };
34
+ BranchSetCommand.examples = [
35
+ '$ csdx config:set:base-branch',
36
+ '$ csdx config:set:base-branch --stack-api-key <value> --base-branch <value>',
37
+ ];
@@ -9,8 +9,9 @@ class RegionSetCommand extends cli_command_1.Command {
9
9
  let cda = regionSetFlags.cda;
10
10
  let cma = regionSetFlags.cma;
11
11
  let name = regionSetFlags.name;
12
+ let uiHost = regionSetFlags['ui-host'];
12
13
  let selectedRegion = args.region;
13
- if (!(cda && cma && name) && !selectedRegion) {
14
+ if (!(cda && cma && uiHost && name) && !selectedRegion) {
14
15
  selectedRegion = await utils_1.interactive.askRegions();
15
16
  }
16
17
  if (selectedRegion === 'custom') {
@@ -18,18 +19,21 @@ class RegionSetCommand extends cli_command_1.Command {
18
19
  name = selectedCustomRegion.name;
19
20
  cda = selectedCustomRegion.cda;
20
21
  cma = selectedCustomRegion.cma;
22
+ uiHost = selectedCustomRegion.uiHost;
21
23
  }
22
24
  else if (selectedRegion === 'exit') {
23
25
  this.exit();
24
26
  }
25
27
  // Custom flag will get first priority over region argument
26
- if (cda && cma && name) {
28
+ if (cda && cma && uiHost && name) {
27
29
  try {
28
- let customRegion = { cda, cma, name };
30
+ let customRegion = { cda, cma, uiHost, name };
29
31
  customRegion = utils_1.regionHandler.setCustomRegion(customRegion);
32
+ await cli_utilities_1.authHandler.setConfigData('logout'); //Todo: Handle this logout flow well through logout command call
30
33
  cli_utilities_1.cliux.success(`Custom region has been set to ${customRegion.name}`);
31
34
  cli_utilities_1.cliux.success(`CMA HOST: ${customRegion.cma}`);
32
35
  cli_utilities_1.cliux.success(`CDA HOST: ${customRegion.cda}`);
36
+ cli_utilities_1.cliux.success(`UI HOST: ${customRegion.uiHost}`);
33
37
  }
34
38
  catch (error) {
35
39
  cli_utilities_1.logger.error('failed to set the region', error);
@@ -38,9 +42,11 @@ class RegionSetCommand extends cli_command_1.Command {
38
42
  }
39
43
  else if (['NA', 'EU', 'AZURE-NA'].includes(selectedRegion)) {
40
44
  const regionDetails = utils_1.regionHandler.setRegion(selectedRegion);
45
+ await cli_utilities_1.authHandler.setConfigData('logout'); //Todo: Handle this logout flow well through logout command call
41
46
  cli_utilities_1.cliux.success(`Region has been set to ${regionDetails.name}`);
42
47
  cli_utilities_1.cliux.success(`CDA HOST: ${regionDetails.cda}`);
43
48
  cli_utilities_1.cliux.success(`CMA HOST: ${regionDetails.cma}`);
49
+ cli_utilities_1.cliux.success(`UI HOST: ${regionDetails.uiHost}`);
44
50
  }
45
51
  else {
46
52
  cli_utilities_1.cliux.error(`Invalid region is given`);
@@ -52,28 +58,32 @@ RegionSetCommand.description = 'Set region for CLI';
52
58
  RegionSetCommand.flags = {
53
59
  cda: cli_utilities_1.flags.string({
54
60
  char: 'd',
55
- description: 'Custom host to set for content delivery API, if this flag is added then cma and name flags are required',
56
- dependsOn: ['cma', 'name'],
61
+ description: 'Custom host to set for content delivery API, if this flag is added then cma, ui-host and name flags are required',
62
+ dependsOn: ['cma', 'ui-host', 'name'],
57
63
  parse: (0, cli_utilities_1.printFlagDeprecation)(['-d'], ['--cda']),
58
64
  }),
59
65
  cma: cli_utilities_1.flags.string({
60
66
  char: 'm',
61
- description: 'Custom host to set for content management API, , if this flag is added then cda and name flags are required',
62
- dependsOn: ['cda', 'name'],
67
+ description: 'Custom host to set for content management API, , if this flag is added then cda, ui-host and name flags are required',
68
+ dependsOn: ['cda', 'ui-host', 'name'],
63
69
  parse: (0, cli_utilities_1.printFlagDeprecation)(['-m'], ['--cma']),
64
70
  }),
71
+ 'ui-host': cli_utilities_1.flags.string({
72
+ description: 'Custom UI host to set for CLI, if this flag is added then cda, cma and name flags are required',
73
+ dependsOn: ['cda', 'cma', 'name'],
74
+ }),
65
75
  name: cli_utilities_1.flags.string({
66
76
  char: 'n',
67
- description: 'Name for the region, if this flag is added then cda and cma flags are required',
68
- dependsOn: ['cda', 'cma'],
77
+ description: 'Name for the region, if this flag is added then cda, cma and ui-host flags are required',
78
+ dependsOn: ['cda', 'cma', 'ui-host'],
69
79
  }),
70
80
  };
71
81
  RegionSetCommand.examples = [
72
82
  '$ csdx config:set:region',
73
83
  '$ csdx config:set:region NA',
74
- '$ csdx config:set:region NA',
75
- '$ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --name "India"',
84
+ '$ csdx config:set:region EU',
85
+ '$ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --ui-host <contentstack_ui_host_endpoint> --name "India"',
76
86
  ];
77
87
  RegionSetCommand.args = {
78
- region: cli_utilities_1.args.string({ description: 'Name for the region' })
88
+ region: cli_utilities_1.args.string({ description: 'Name for the region' }),
79
89
  };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.askCustomRegion = exports.askRegions = void 0;
3
+ exports.inquireRequireFieldValidation = exports.askConfirmation = exports.askBaseBranch = exports.askStackAPIKey = exports.askCustomRegion = exports.askRegions = void 0;
4
+ const lodash_1 = require("lodash");
4
5
  const cli_utilities_1 = require("@contentstack/cli-utilities");
5
6
  const askRegions = async () => {
6
7
  return cli_utilities_1.cliux.inquire({
@@ -33,6 +34,44 @@ const askCustomRegion = async () => {
33
34
  name: 'cda',
34
35
  message: 'CLI_CONFIG_INQUIRE_REGION_CDA',
35
36
  });
36
- return { name, cma, cda };
37
+ const uiHost = await cli_utilities_1.cliux.inquire({
38
+ type: 'input',
39
+ name: 'ui-host',
40
+ message: 'CLI_CONFIG_INQUIRE_REGION_UI_HOST',
41
+ });
42
+ return { name, cma, cda, uiHost };
37
43
  };
38
44
  exports.askCustomRegion = askCustomRegion;
45
+ async function askStackAPIKey() {
46
+ return await cli_utilities_1.cliux.inquire({
47
+ type: 'input',
48
+ message: 'CLI_CONFIG_INQUIRE_API_KEY',
49
+ name: 'stack-api-key',
50
+ validate: inquireRequireFieldValidation,
51
+ });
52
+ }
53
+ exports.askStackAPIKey = askStackAPIKey;
54
+ async function askBaseBranch() {
55
+ return await cli_utilities_1.cliux.inquire({
56
+ type: 'input',
57
+ message: 'CLI_CONFIG_INQUIRE_BASE_BRANCH',
58
+ name: 'base-branch',
59
+ validate: inquireRequireFieldValidation,
60
+ });
61
+ }
62
+ exports.askBaseBranch = askBaseBranch;
63
+ async function askConfirmation() {
64
+ return await cli_utilities_1.cliux.inquire({
65
+ type: 'confirm',
66
+ message: 'Are you sure you want to remove this configuration ?',
67
+ name: 'config_remove_confirmation',
68
+ });
69
+ }
70
+ exports.askConfirmation = askConfirmation;
71
+ function inquireRequireFieldValidation(input) {
72
+ if ((0, lodash_1.isEmpty)(input)) {
73
+ return cli_utilities_1.messageHandler.parse('CLI_BRANCH_REQUIRED_FIELD');
74
+ }
75
+ return true;
76
+ }
77
+ exports.inquireRequireFieldValidation = inquireRequireFieldValidation;
@@ -12,11 +12,22 @@ function validURL(str) {
12
12
  }
13
13
  // Available region list
14
14
  const regions = {
15
- NA: { cma: 'https://api.contentstack.io', cda: 'https://cdn.contentstack.io', name: 'NA' },
16
- EU: { cma: 'https://eu-api.contentstack.com', cda: 'https://eu-cdn.contentstack.com', name: 'EU' },
15
+ NA: {
16
+ cma: 'https://api.contentstack.io',
17
+ cda: 'https://cdn.contentstack.io',
18
+ uiHost: 'https://app.contentstack.com',
19
+ name: 'NA',
20
+ },
21
+ EU: {
22
+ cma: 'https://eu-api.contentstack.com',
23
+ cda: 'https://eu-cdn.contentstack.com',
24
+ uiHost: 'https://eu-app.contentstack.com',
25
+ name: 'EU',
26
+ },
17
27
  'AZURE-NA': {
18
28
  cma: 'https://azure-na-api.contentstack.com',
19
29
  cda: 'https://azure-na-cdn.contentstack.com',
30
+ uiHost: 'https://azure-na-app.contentstack.com',
20
31
  name: 'AZURE-NA',
21
32
  },
22
33
  };
@@ -80,7 +91,7 @@ class UserConfig {
80
91
  * @returns {boolean} True if contains cma, cda and region property otherwise false
81
92
  */
82
93
  validateRegion(regionObject) {
83
- if (regionObject.cma && regionObject.cda && regionObject.name) {
94
+ if (regionObject.cma && regionObject.cda && regionObject.uiHost && regionObject.name) {
84
95
  if (validURL(regionObject.cma) && validURL(regionObject.cda))
85
96
  return true;
86
97
  }
@@ -96,6 +107,7 @@ class UserConfig {
96
107
  sanitizedRegion = {
97
108
  cma: regionObject.cma,
98
109
  cda: regionObject.cda,
110
+ uiHost: regionObject.uiHost,
99
111
  name: regionObject.name,
100
112
  };
101
113
  return sanitizedRegion;
@@ -1,6 +1,20 @@
1
1
  {
2
- "version": "1.3.0",
2
+ "version": "1.4.0",
3
3
  "commands": {
4
+ "config:get:base-branch": {
5
+ "id": "config:get:base-branch",
6
+ "description": "Get current branch set for CLI",
7
+ "strict": true,
8
+ "pluginName": "@contentstack/cli-config",
9
+ "pluginAlias": "@contentstack/cli-config",
10
+ "pluginType": "core",
11
+ "aliases": [],
12
+ "examples": [
13
+ "$ csdx config:get:base-branch"
14
+ ],
15
+ "flags": {},
16
+ "args": {}
17
+ },
4
18
  "config:get:region": {
5
19
  "id": "config:get:region",
6
20
  "description": "Get current region set for CLI",
@@ -15,6 +29,65 @@
15
29
  "flags": {},
16
30
  "args": {}
17
31
  },
32
+ "config:remove:base-branch": {
33
+ "id": "config:remove:base-branch",
34
+ "description": "Remove branch config for CLI",
35
+ "strict": true,
36
+ "pluginName": "@contentstack/cli-config",
37
+ "pluginAlias": "@contentstack/cli-config",
38
+ "pluginType": "core",
39
+ "aliases": [],
40
+ "examples": [
41
+ "$ csdx config:remove:base-branch",
42
+ "$ csdx config:remove:base-branch --stack-api-key <value>"
43
+ ],
44
+ "flags": {
45
+ "stack-api-key": {
46
+ "name": "stack-api-key",
47
+ "type": "option",
48
+ "char": "k",
49
+ "description": "Stack API Key",
50
+ "multiple": false
51
+ },
52
+ "yes": {
53
+ "name": "yes",
54
+ "type": "boolean",
55
+ "char": "y",
56
+ "description": "Force Remove",
57
+ "allowNo": false
58
+ }
59
+ },
60
+ "args": {}
61
+ },
62
+ "config:set:base-branch": {
63
+ "id": "config:set:base-branch",
64
+ "description": "Set branch for CLI",
65
+ "strict": true,
66
+ "pluginName": "@contentstack/cli-config",
67
+ "pluginAlias": "@contentstack/cli-config",
68
+ "pluginType": "core",
69
+ "aliases": [],
70
+ "examples": [
71
+ "$ csdx config:set:base-branch",
72
+ "$ csdx config:set:base-branch --stack-api-key <value> --base-branch <value>"
73
+ ],
74
+ "flags": {
75
+ "stack-api-key": {
76
+ "name": "stack-api-key",
77
+ "type": "option",
78
+ "char": "k",
79
+ "description": "Stack API Key",
80
+ "multiple": false
81
+ },
82
+ "base-branch": {
83
+ "name": "base-branch",
84
+ "type": "option",
85
+ "description": "Base Branch",
86
+ "multiple": false
87
+ }
88
+ },
89
+ "args": {}
90
+ },
18
91
  "config:set:region": {
19
92
  "id": "config:set:region",
20
93
  "description": "Set region for CLI",
@@ -26,18 +99,19 @@
26
99
  "examples": [
27
100
  "$ csdx config:set:region",
28
101
  "$ csdx config:set:region NA",
29
- "$ csdx config:set:region NA",
30
- "$ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --name \"India\""
102
+ "$ csdx config:set:region EU",
103
+ "$ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --ui-host <contentstack_ui_host_endpoint> --name \"India\""
31
104
  ],
32
105
  "flags": {
33
106
  "cda": {
34
107
  "name": "cda",
35
108
  "type": "option",
36
109
  "char": "d",
37
- "description": "Custom host to set for content delivery API, if this flag is added then cma and name flags are required",
110
+ "description": "Custom host to set for content delivery API, if this flag is added then cma, ui-host and name flags are required",
38
111
  "multiple": false,
39
112
  "dependsOn": [
40
113
  "cma",
114
+ "ui-host",
41
115
  "name"
42
116
  ]
43
117
  },
@@ -45,10 +119,22 @@
45
119
  "name": "cma",
46
120
  "type": "option",
47
121
  "char": "m",
48
- "description": "Custom host to set for content management API, , if this flag is added then cda and name flags are required",
122
+ "description": "Custom host to set for content management API, , if this flag is added then cda, ui-host and name flags are required",
123
+ "multiple": false,
124
+ "dependsOn": [
125
+ "cda",
126
+ "ui-host",
127
+ "name"
128
+ ]
129
+ },
130
+ "ui-host": {
131
+ "name": "ui-host",
132
+ "type": "option",
133
+ "description": "Custom UI host to set for CLI, if this flag is added then cda, cma and name flags are required",
49
134
  "multiple": false,
50
135
  "dependsOn": [
51
136
  "cda",
137
+ "cma",
52
138
  "name"
53
139
  ]
54
140
  },
@@ -56,11 +142,12 @@
56
142
  "name": "name",
57
143
  "type": "option",
58
144
  "char": "n",
59
- "description": "Name for the region, if this flag is added then cda and cma flags are required",
145
+ "description": "Name for the region, if this flag is added then cda, cma and ui-host flags are required",
60
146
  "multiple": false,
61
147
  "dependsOn": [
62
148
  "cda",
63
- "cma"
149
+ "cma",
150
+ "ui-host"
64
151
  ]
65
152
  }
66
153
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contentstack/cli-config",
3
3
  "description": "Contentstack CLI plugin for configuration",
4
- "version": "1.3.0",
4
+ "version": "1.4.0",
5
5
  "author": "Contentstack",
6
6
  "scripts": {
7
7
  "build": "npm run clean && npm run compile",
@@ -17,15 +17,17 @@
17
17
  "lint": "eslint src/**/*.ts",
18
18
  "format": "eslint src/**/*.ts --fix",
19
19
  "test:integration": "mocha --forbid-only \"test/run.test.ts\" --integration-test",
20
- "test:unit": "mocha --forbid-only \"test/unit/*.test.ts\" --unit-test"
20
+ "test:unit": "mocha --forbid-only \"test/unit/**/*.test.ts\" --unit-test",
21
+ "test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
21
22
  },
22
23
  "dependencies": {
23
- "@contentstack/cli-command": "^1.2.1",
24
- "@contentstack/cli-utilities": "^1.2.1",
24
+ "@contentstack/cli-command": "^1.2.3",
25
+ "@contentstack/cli-utilities": "^1.4.0",
25
26
  "chalk": "^4.0.0",
26
27
  "debug": "^4.1.1",
27
28
  "inquirer": "8.2.4",
28
- "winston": "^3.7.2"
29
+ "winston": "^3.7.2",
30
+ "lodash": "^4.17.20"
29
31
  },
30
32
  "devDependencies": {
31
33
  "@oclif/test": "^2.2.10",
@@ -42,7 +44,7 @@
42
44
  "globby": "^10.0.2",
43
45
  "mocha": "10.1.0",
44
46
  "nyc": "^15.1.0",
45
- "oclif": "^3.1.2",
47
+ "oclif": "^3.8.1",
46
48
  "rimraf": "^2.7.1",
47
49
  "sinon": "^15.0.1",
48
50
  "tmp": "^0.2.1",
@@ -79,4 +81,4 @@
79
81
  }
80
82
  },
81
83
  "repository": "contentstack/cli"
82
- }
84
+ }