@contentstack/cli-config 1.4.15 → 1.5.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
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config
18
18
  $ csdx COMMAND
19
19
  running command...
20
20
  $ csdx (--version)
21
- @contentstack/cli-config/1.4.15 linux-x64 node-v18.18.2
21
+ @contentstack/cli-config/1.5.0 linux-x64 node-v18.19.0
22
22
  $ csdx --help [COMMAND]
23
23
  USAGE
24
24
  $ csdx COMMAND
@@ -30,9 +30,15 @@ USAGE
30
30
 
31
31
  <!-- commands -->
32
32
  * [`csdx config:get:base-branch`](#csdx-configgetbase-branch)
33
+ * [`csdx config:get:ea-header`](#csdx-configgetea-header)
34
+ * [`csdx config:get:early-access-header`](#csdx-configgetearly-access-header)
33
35
  * [`csdx config:get:region`](#csdx-configgetregion)
34
36
  * [`csdx config:remove:base-branch`](#csdx-configremovebase-branch)
37
+ * [`csdx config:remove:ea-header`](#csdx-configremoveea-header)
38
+ * [`csdx config:remove:early-access-header`](#csdx-configremoveearly-access-header)
35
39
  * [`csdx config:set:base-branch`](#csdx-configsetbase-branch)
40
+ * [`csdx config:set:ea-header`](#csdx-configsetea-header)
41
+ * [`csdx config:set:early-access-header`](#csdx-configsetearly-access-header)
36
42
  * [`csdx config:set:region [REGION]`](#csdx-configsetregion-region)
37
43
 
38
44
  ## `csdx config:get:base-branch`
@@ -52,6 +58,44 @@ EXAMPLES
52
58
 
53
59
  _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
60
 
61
+ ## `csdx config:get:ea-header`
62
+
63
+ Display Early Access Program headers
64
+
65
+ ```
66
+ USAGE
67
+ $ csdx config:get:ea-header
68
+
69
+ DESCRIPTION
70
+ Display Early Access Program headers
71
+
72
+ ALIASES
73
+ $ csdx config:get:ea-header
74
+
75
+ EXAMPLES
76
+ $ csdx config:get:ea-header
77
+ ```
78
+
79
+ ## `csdx config:get:early-access-header`
80
+
81
+ Display Early Access Program headers
82
+
83
+ ```
84
+ USAGE
85
+ $ csdx config:get:early-access-header
86
+
87
+ DESCRIPTION
88
+ Display Early Access Program headers
89
+
90
+ ALIASES
91
+ $ csdx config:get:ea-header
92
+
93
+ EXAMPLES
94
+ $ csdx config:get:early-access-header
95
+ ```
96
+
97
+ _See code: [src/commands/config/get/early-access-header.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/get/early-access-header.ts)_
98
+
55
99
  ## `csdx config:get:region`
56
100
 
57
101
  Get current region set for CLI
@@ -92,6 +136,56 @@ EXAMPLES
92
136
 
93
137
  _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
138
 
139
+ ## `csdx config:remove:ea-header`
140
+
141
+ Remove Early Access Program header
142
+
143
+ ```
144
+ USAGE
145
+ $ csdx config:remove:ea-header [--header-alias <value>] [-y]
146
+
147
+ FLAGS
148
+ -y, --yes Force Remove
149
+ --header-alias=<value> Early access header alias
150
+
151
+ DESCRIPTION
152
+ Remove Early Access Program header
153
+
154
+ ALIASES
155
+ $ csdx config:remove:ea-header
156
+
157
+ EXAMPLES
158
+ $ csdx config:remove:ea-header
159
+
160
+ $ csdx config:remove:ea-header --header-alias <value>
161
+ ```
162
+
163
+ ## `csdx config:remove:early-access-header`
164
+
165
+ Remove Early Access Program header
166
+
167
+ ```
168
+ USAGE
169
+ $ csdx config:remove:early-access-header [--header-alias <value>] [-y]
170
+
171
+ FLAGS
172
+ -y, --yes Force Remove
173
+ --header-alias=<value> Early access header alias
174
+
175
+ DESCRIPTION
176
+ Remove Early Access Program header
177
+
178
+ ALIASES
179
+ $ csdx config:remove:ea-header
180
+
181
+ EXAMPLES
182
+ $ csdx config:remove:early-access-header
183
+
184
+ $ csdx config:remove:early-access-header --header-alias <value>
185
+ ```
186
+
187
+ _See code: [src/commands/config/remove/early-access-header.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/remove/early-access-header.ts)_
188
+
95
189
  ## `csdx config:set:base-branch`
96
190
 
97
191
  Set branch for CLI
@@ -115,6 +209,56 @@ EXAMPLES
115
209
 
116
210
  _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
211
 
212
+ ## `csdx config:set:ea-header`
213
+
214
+ Set Early Access Program header
215
+
216
+ ```
217
+ USAGE
218
+ $ csdx config:set:ea-header [--header-alias <value>] [--header <value>]
219
+
220
+ FLAGS
221
+ --header=<value> Early access header value
222
+ --header-alias=<value> Early access header alias
223
+
224
+ DESCRIPTION
225
+ Set Early Access Program header
226
+
227
+ ALIASES
228
+ $ csdx config:set:ea-header
229
+
230
+ EXAMPLES
231
+ $ csdx config:set:ea-header
232
+
233
+ $ csdx config:set:ea-header --header <value> --header-alias <value>
234
+ ```
235
+
236
+ ## `csdx config:set:early-access-header`
237
+
238
+ Set Early Access Program header
239
+
240
+ ```
241
+ USAGE
242
+ $ csdx config:set:early-access-header [--header-alias <value>] [--header <value>]
243
+
244
+ FLAGS
245
+ --header=<value> Early access header value
246
+ --header-alias=<value> Early access header alias
247
+
248
+ DESCRIPTION
249
+ Set Early Access Program header
250
+
251
+ ALIASES
252
+ $ csdx config:set:ea-header
253
+
254
+ EXAMPLES
255
+ $ csdx config:set:early-access-header
256
+
257
+ $ csdx config:set:early-access-header --header <value> --header-alias <value>
258
+ ```
259
+
260
+ _See code: [src/commands/config/set/early-access-header.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/set/early-access-header.ts)_
261
+
118
262
  ## `csdx config:set:region [REGION]`
119
263
 
120
264
  Set region for CLI
@@ -0,0 +1,7 @@
1
+ import { Command } from '@contentstack/cli-command';
2
+ export default class GetEarlyAccessHeaderCommand extends Command {
3
+ static description: string;
4
+ static aliases: string[];
5
+ static examples: string[];
6
+ run(): Promise<void>;
7
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cli_utilities_1 = require("@contentstack/cli-utilities");
4
+ const cli_command_1 = require("@contentstack/cli-command");
5
+ class GetEarlyAccessHeaderCommand extends cli_command_1.Command {
6
+ async run() {
7
+ try {
8
+ let config = cli_utilities_1.configHandler.get(`earlyAccessHeaders`);
9
+ if (config && Object.keys(config).length > 0) {
10
+ let tableHeaders = Object.keys(config).map((key) => ({
11
+ ['Alias']: key,
12
+ ['Early access header']: config[key],
13
+ }));
14
+ cli_utilities_1.cliux.table(tableHeaders, {
15
+ Alias: {
16
+ minWidth: 8,
17
+ },
18
+ 'Early access header': {
19
+ minWidth: 8,
20
+ },
21
+ }, {
22
+ printLine: cli_utilities_1.cliux.print,
23
+ });
24
+ }
25
+ else {
26
+ cli_utilities_1.cliux.print(`No Early Access Program header found!`, { color: 'red' });
27
+ }
28
+ }
29
+ catch (error) {
30
+ this.log('Unable to retrieve the Early Access Program header config', error instanceof Error ? error.message : error);
31
+ }
32
+ }
33
+ }
34
+ exports.default = GetEarlyAccessHeaderCommand;
35
+ GetEarlyAccessHeaderCommand.description = 'Display Early Access Program headers';
36
+ GetEarlyAccessHeaderCommand.aliases = ['config:get:ea-header'];
37
+ GetEarlyAccessHeaderCommand.examples = ['$ <%= config.bin %> <%= command.id %>'];
@@ -0,0 +1,9 @@
1
+ import { FlagInput } from '@contentstack/cli-utilities';
2
+ import { Command } from '@contentstack/cli-command';
3
+ export default class RemoveEarlyAccessHeader extends Command {
4
+ static description: string;
5
+ static aliases: string[];
6
+ static flags: FlagInput;
7
+ static examples: string[];
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cli_utilities_1 = require("@contentstack/cli-utilities");
4
+ const utils_1 = require("../../../utils");
5
+ const cli_command_1 = require("@contentstack/cli-command");
6
+ class RemoveEarlyAccessHeader extends cli_command_1.Command {
7
+ async run() {
8
+ try {
9
+ let { flags: { 'header-alias': earlyAccessHeaderAlias, yes: skipConfirmation }, } = await this.parse(RemoveEarlyAccessHeader);
10
+ if (!earlyAccessHeaderAlias) {
11
+ earlyAccessHeaderAlias = await utils_1.interactive.askEarlyAccessHeaderAlias();
12
+ }
13
+ if (cli_utilities_1.configHandler.get(`earlyAccessHeaders.${earlyAccessHeaderAlias}`) === undefined) {
14
+ cli_utilities_1.cliux.error(`Early Access Program header not configured for alias: ${earlyAccessHeaderAlias}`);
15
+ return;
16
+ }
17
+ if (!skipConfirmation) {
18
+ const confirmation = await utils_1.interactive.askConfirmation();
19
+ if (!confirmation) {
20
+ return;
21
+ }
22
+ }
23
+ cli_utilities_1.configHandler.delete(`earlyAccessHeaders.${earlyAccessHeaderAlias}`);
24
+ cli_utilities_1.cliux.success(`Early Access Program header '${earlyAccessHeaderAlias}' has been successfully removed`);
25
+ }
26
+ catch (error) {
27
+ this.log('Unable to remove the Early Access Program header config', error instanceof Error ? error.message : error);
28
+ }
29
+ }
30
+ }
31
+ exports.default = RemoveEarlyAccessHeader;
32
+ RemoveEarlyAccessHeader.description = 'Remove Early Access Program header';
33
+ RemoveEarlyAccessHeader.aliases = ['config:remove:ea-header'];
34
+ RemoveEarlyAccessHeader.flags = {
35
+ 'header-alias': cli_utilities_1.flags.string({ description: 'Early access header alias' }),
36
+ yes: cli_utilities_1.flags.boolean({ char: 'y', description: 'Force Remove' }),
37
+ };
38
+ RemoveEarlyAccessHeader.examples = [
39
+ '$ <%= config.bin %> <%= command.id %>',
40
+ '$ <%= config.bin %> <%= command.id %> --header-alias <value>',
41
+ ];
@@ -0,0 +1,9 @@
1
+ import { FlagInput } from '@contentstack/cli-utilities';
2
+ import { Command } from '@contentstack/cli-command';
3
+ export default class SetEarlyAccessHeaderCommand extends Command {
4
+ static description: string;
5
+ static aliases: string[];
6
+ static flags: FlagInput;
7
+ static examples: string[];
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cli_utilities_1 = require("@contentstack/cli-utilities");
4
+ const utils_1 = require("../../../utils");
5
+ const cli_command_1 = require("@contentstack/cli-command");
6
+ class SetEarlyAccessHeaderCommand extends cli_command_1.Command {
7
+ async run() {
8
+ try {
9
+ let { flags: { header: earlyAccessHeader, 'header-alias': earlyAccessHeaderAlias }, } = await this.parse(SetEarlyAccessHeaderCommand);
10
+ if (!earlyAccessHeaderAlias) {
11
+ earlyAccessHeaderAlias = await utils_1.interactive.askEarlyAccessHeaderAlias();
12
+ }
13
+ if (!earlyAccessHeader) {
14
+ earlyAccessHeader = await utils_1.interactive.askEarlyAccessHeaderValue();
15
+ }
16
+ cli_utilities_1.configHandler.set(`earlyAccessHeaders.${earlyAccessHeaderAlias}`, earlyAccessHeader);
17
+ cli_utilities_1.cliux.success(`Early access header '${earlyAccessHeader}' with alias '${earlyAccessHeaderAlias}' has been successfully set `);
18
+ }
19
+ catch (error) {
20
+ this.log('Unable to set the Early Access Program header config', error instanceof Error ? error.message : error);
21
+ }
22
+ }
23
+ }
24
+ exports.default = SetEarlyAccessHeaderCommand;
25
+ SetEarlyAccessHeaderCommand.description = 'Set Early Access Program header';
26
+ SetEarlyAccessHeaderCommand.aliases = ['config:set:ea-header'];
27
+ SetEarlyAccessHeaderCommand.flags = {
28
+ 'header-alias': cli_utilities_1.flags.string({ description: 'Early access header alias' }),
29
+ header: cli_utilities_1.flags.string({ description: 'Early access header value' }),
30
+ };
31
+ SetEarlyAccessHeaderCommand.examples = [
32
+ '$ <%= config.bin %> <%= command.id %>',
33
+ '$ <%= config.bin %> <%= command.id %> --header <value> --header-alias <value>',
34
+ ];
@@ -3,4 +3,6 @@ export declare const askCustomRegion: () => Promise<any>;
3
3
  export declare function askStackAPIKey(): Promise<string>;
4
4
  export declare function askBaseBranch(): Promise<string>;
5
5
  export declare function askConfirmation(): Promise<boolean>;
6
- export declare function inquireRequireFieldValidation(input: any): string | boolean;
6
+ export declare function inquireRequireFieldValidation(input: string): string | boolean;
7
+ export declare function askEarlyAccessHeaderValue(): Promise<string>;
8
+ export declare function askEarlyAccessHeaderAlias(): Promise<string>;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inquireRequireFieldValidation = exports.askConfirmation = exports.askBaseBranch = exports.askStackAPIKey = exports.askCustomRegion = exports.askRegions = void 0;
4
- const lodash_1 = require("lodash");
3
+ exports.askEarlyAccessHeaderAlias = exports.askEarlyAccessHeaderValue = exports.inquireRequireFieldValidation = exports.askConfirmation = exports.askBaseBranch = exports.askStackAPIKey = exports.askCustomRegion = exports.askRegions = void 0;
5
4
  const cli_utilities_1 = require("@contentstack/cli-utilities");
6
5
  const askRegions = async () => {
7
6
  return cli_utilities_1.cliux.inquire({
@@ -70,9 +69,27 @@ async function askConfirmation() {
70
69
  }
71
70
  exports.askConfirmation = askConfirmation;
72
71
  function inquireRequireFieldValidation(input) {
73
- if ((0, lodash_1.isEmpty)(input)) {
72
+ if (!input || input.trim() === '') {
74
73
  return cli_utilities_1.messageHandler.parse('CLI_BRANCH_REQUIRED_FIELD');
75
74
  }
76
75
  return true;
77
76
  }
78
77
  exports.inquireRequireFieldValidation = inquireRequireFieldValidation;
78
+ async function askEarlyAccessHeaderValue() {
79
+ return await cli_utilities_1.cliux.inquire({
80
+ type: 'input',
81
+ message: 'CLI_CONFIG_INQUIRE_EARLY_ACCESS_HEADER_VALUE',
82
+ name: 'header-value',
83
+ validate: inquireRequireFieldValidation,
84
+ });
85
+ }
86
+ exports.askEarlyAccessHeaderValue = askEarlyAccessHeaderValue;
87
+ async function askEarlyAccessHeaderAlias() {
88
+ return await cli_utilities_1.cliux.inquire({
89
+ type: 'input',
90
+ message: 'CLI_CONFIG_INQUIRE_EARLY_ACCESS_HEADER_ALIAS',
91
+ name: 'header-alias',
92
+ validate: inquireRequireFieldValidation,
93
+ });
94
+ }
95
+ exports.askEarlyAccessHeaderAlias = askEarlyAccessHeaderAlias;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.15",
2
+ "version": "1.5.0",
3
3
  "commands": {
4
4
  "config:get:base-branch": {
5
5
  "id": "config:get:base-branch",
@@ -15,6 +15,22 @@
15
15
  "flags": {},
16
16
  "args": {}
17
17
  },
18
+ "config:get:early-access-header": {
19
+ "id": "config:get:early-access-header",
20
+ "description": "Display Early Access Program headers",
21
+ "strict": true,
22
+ "pluginName": "@contentstack/cli-config",
23
+ "pluginAlias": "@contentstack/cli-config",
24
+ "pluginType": "core",
25
+ "aliases": [
26
+ "config:get:ea-header"
27
+ ],
28
+ "examples": [
29
+ "$ <%= config.bin %> <%= command.id %>"
30
+ ],
31
+ "flags": {},
32
+ "args": {}
33
+ },
18
34
  "config:get:region": {
19
35
  "id": "config:get:region",
20
36
  "description": "Get current region set for CLI",
@@ -59,6 +75,37 @@
59
75
  },
60
76
  "args": {}
61
77
  },
78
+ "config:remove:early-access-header": {
79
+ "id": "config:remove:early-access-header",
80
+ "description": "Remove Early Access Program header",
81
+ "strict": true,
82
+ "pluginName": "@contentstack/cli-config",
83
+ "pluginAlias": "@contentstack/cli-config",
84
+ "pluginType": "core",
85
+ "aliases": [
86
+ "config:remove:ea-header"
87
+ ],
88
+ "examples": [
89
+ "$ <%= config.bin %> <%= command.id %>",
90
+ "$ <%= config.bin %> <%= command.id %> --header-alias <value>"
91
+ ],
92
+ "flags": {
93
+ "header-alias": {
94
+ "name": "header-alias",
95
+ "type": "option",
96
+ "description": "Early access header alias",
97
+ "multiple": false
98
+ },
99
+ "yes": {
100
+ "name": "yes",
101
+ "type": "boolean",
102
+ "char": "y",
103
+ "description": "Force Remove",
104
+ "allowNo": false
105
+ }
106
+ },
107
+ "args": {}
108
+ },
62
109
  "config:set:base-branch": {
63
110
  "id": "config:set:base-branch",
64
111
  "description": "Set branch for CLI",
@@ -88,6 +135,36 @@
88
135
  },
89
136
  "args": {}
90
137
  },
138
+ "config:set:early-access-header": {
139
+ "id": "config:set:early-access-header",
140
+ "description": "Set Early Access Program header",
141
+ "strict": true,
142
+ "pluginName": "@contentstack/cli-config",
143
+ "pluginAlias": "@contentstack/cli-config",
144
+ "pluginType": "core",
145
+ "aliases": [
146
+ "config:set:ea-header"
147
+ ],
148
+ "examples": [
149
+ "$ <%= config.bin %> <%= command.id %>",
150
+ "$ <%= config.bin %> <%= command.id %> --header <value> --header-alias <value>"
151
+ ],
152
+ "flags": {
153
+ "header-alias": {
154
+ "name": "header-alias",
155
+ "type": "option",
156
+ "description": "Early access header alias",
157
+ "multiple": false
158
+ },
159
+ "header": {
160
+ "name": "header",
161
+ "type": "option",
162
+ "description": "Early access header value",
163
+ "multiple": false
164
+ }
165
+ },
166
+ "args": {}
167
+ },
91
168
  "config:set:region": {
92
169
  "id": "config:set:region",
93
170
  "description": "Set region for CLI",
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.4.15",
4
+ "version": "1.5.0",
5
5
  "author": "Contentstack",
6
6
  "scripts": {
7
7
  "build": "npm run clean && npm run compile",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@contentstack/cli-command": "~1.2.16",
25
- "@contentstack/cli-utilities": "~1.5.7",
25
+ "@contentstack/cli-utilities": "~1.5.9",
26
26
  "chalk": "^4.0.0",
27
27
  "debug": "^4.1.1",
28
28
  "inquirer": "8.2.4",
@@ -41,7 +41,7 @@
41
41
  "chai": "^4.3.4",
42
42
  "eslint": "^8.18.0",
43
43
  "eslint-config-oclif": "^4.0.0",
44
- "eslint-config-oclif-typescript": "^0.1.0",
44
+ "eslint-config-oclif-typescript": "^3.0.8",
45
45
  "globby": "^10.0.2",
46
46
  "mocha": "10.1.0",
47
47
  "nyc": "^15.1.0",
@@ -84,4 +84,4 @@
84
84
  }
85
85
  },
86
86
  "repository": "contentstack/cli"
87
- }
87
+ }