@contentstack/apps-cli 1.3.0 → 1.3.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 +34 -23
- package/lib/base-command.js +4 -4
- package/lib/commands/app/create.js +16 -12
- package/lib/commands/app/delete.js +2 -4
- package/lib/commands/app/deploy.js +10 -13
- package/lib/commands/app/get.js +4 -8
- package/lib/commands/app/index.js +4 -3
- package/lib/commands/app/install.js +3 -6
- package/lib/commands/app/reinstall.js +7 -13
- package/lib/commands/app/uninstall.js +4 -8
- package/lib/commands/app/update.js +2 -4
- package/lib/util/common-utils.d.ts +3 -9
- package/lib/util/common-utils.js +16 -35
- package/lib/util/inquirer.js +3 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @contentstack/apps-cli
|
|
|
20
20
|
$ csdx COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ csdx (--version|-v)
|
|
23
|
-
@contentstack/apps-cli/1.3.
|
|
23
|
+
@contentstack/apps-cli/1.3.2 darwin-arm64 node-v18.20.2
|
|
24
24
|
$ csdx --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ csdx COMMAND
|
|
@@ -54,20 +54,22 @@ DESCRIPTION
|
|
|
54
54
|
EXAMPLES
|
|
55
55
|
$ csdx app:create
|
|
56
56
|
|
|
57
|
-
$ csdx app:
|
|
57
|
+
$ csdx app:delete
|
|
58
58
|
|
|
59
|
-
$ csdx app:
|
|
59
|
+
$ csdx app:deploy
|
|
60
60
|
|
|
61
|
-
$ csdx app:
|
|
61
|
+
$ csdx app:get
|
|
62
62
|
|
|
63
63
|
$ csdx app:install
|
|
64
64
|
|
|
65
|
+
$ csdx app:reinstall
|
|
66
|
+
|
|
65
67
|
$ csdx app:uninstall
|
|
66
68
|
|
|
67
|
-
$ csdx app:
|
|
69
|
+
$ csdx app:update
|
|
68
70
|
```
|
|
69
71
|
|
|
70
|
-
_See code: [src/commands/app/index.ts](https://github.com/contentstack/apps-cli/blob/v1.3.
|
|
72
|
+
_See code: [src/commands/app/index.ts](https://github.com/contentstack/apps-cli/blob/v1.3.2/src/commands/app/index.ts)_
|
|
71
73
|
|
|
72
74
|
## `csdx app:create`
|
|
73
75
|
|
|
@@ -76,7 +78,7 @@ Create a new app in Developer Hub and optionally clone a boilerplate locally.
|
|
|
76
78
|
```
|
|
77
79
|
USAGE
|
|
78
80
|
$ csdx app:create [-n <value>] [--app-type stack|organization] [-c <value>] [-d <value>] [--boilerplate
|
|
79
|
-
<value>]
|
|
81
|
+
<value>] [--org <value>]
|
|
80
82
|
|
|
81
83
|
FLAGS
|
|
82
84
|
-c, --config=<value> Path of the external config
|
|
@@ -84,7 +86,9 @@ FLAGS
|
|
|
84
86
|
-n, --name=<value> Name of the app to be created
|
|
85
87
|
--app-type=<option> [default: stack] Type of app
|
|
86
88
|
<options: stack|organization>
|
|
87
|
-
--boilerplate=<value> Provide a boilerplate. <options: App Boilerplate|DAM App Boilerplate|Ecommerce App
|
|
89
|
+
--boilerplate=<value> Provide a boilerplate. <options: App Boilerplate|DAM App Boilerplate|Ecommerce App
|
|
90
|
+
Boilerplate>
|
|
91
|
+
--org=<value> Provide the organization UID to fetch the app details for the operation.
|
|
88
92
|
|
|
89
93
|
DESCRIPTION
|
|
90
94
|
Create a new app in Developer Hub and optionally clone a boilerplate locally.
|
|
@@ -105,7 +109,7 @@ EXAMPLES
|
|
|
105
109
|
$ csdx app:create --name App-4 --app-type organization --org <UID> --boilerplate <Ecommerce App Boilerplate>
|
|
106
110
|
```
|
|
107
111
|
|
|
108
|
-
_See code: [src/commands/app/create.ts](https://github.com/contentstack/apps-cli/blob/v1.3.
|
|
112
|
+
_See code: [src/commands/app/create.ts](https://github.com/contentstack/apps-cli/blob/v1.3.2/src/commands/app/create.ts)_
|
|
109
113
|
|
|
110
114
|
## `csdx app:delete`
|
|
111
115
|
|
|
@@ -113,10 +117,11 @@ Delete app from marketplace
|
|
|
113
117
|
|
|
114
118
|
```
|
|
115
119
|
USAGE
|
|
116
|
-
$ csdx app:delete [--app-uid <value>]
|
|
120
|
+
$ csdx app:delete [--app-uid <value>] [--org <value>]
|
|
117
121
|
|
|
118
122
|
FLAGS
|
|
119
123
|
--app-uid=<value> Provide the app UID of an existing app.
|
|
124
|
+
--org=<value> Provide the organization UID to fetch the app details for the operation.
|
|
120
125
|
|
|
121
126
|
DESCRIPTION
|
|
122
127
|
Delete app from marketplace
|
|
@@ -129,7 +134,7 @@ EXAMPLES
|
|
|
129
134
|
$ csdx app:delete --app-uid <value> --org <value> -d ./boilerplate
|
|
130
135
|
```
|
|
131
136
|
|
|
132
|
-
_See code: [src/commands/app/delete.ts](https://github.com/contentstack/apps-cli/blob/v1.3.
|
|
137
|
+
_See code: [src/commands/app/delete.ts](https://github.com/contentstack/apps-cli/blob/v1.3.2/src/commands/app/delete.ts)_
|
|
133
138
|
|
|
134
139
|
## `csdx app:deploy`
|
|
135
140
|
|
|
@@ -138,7 +143,7 @@ Deploy an app
|
|
|
138
143
|
```
|
|
139
144
|
USAGE
|
|
140
145
|
$ csdx app:deploy [--app-uid <value>] [--hosting-type Hosting with Launch|Custom Hosting] [--app-url <value>]
|
|
141
|
-
[--launch-project existing|new] [-c <value>]
|
|
146
|
+
[--launch-project existing|new] [-c <value>] [--org <value>]
|
|
142
147
|
|
|
143
148
|
FLAGS
|
|
144
149
|
-c, --config=<value> [optional] Please enter the path of the config file.
|
|
@@ -148,6 +153,7 @@ FLAGS
|
|
|
148
153
|
<options: Hosting with Launch|Custom Hosting>
|
|
149
154
|
--launch-project=<option> Choose a new or an existing Launch project.
|
|
150
155
|
<options: existing|new>
|
|
156
|
+
--org=<value> Provide the organization UID to fetch the app details for the operation.
|
|
151
157
|
|
|
152
158
|
DESCRIPTION
|
|
153
159
|
Deploy an app
|
|
@@ -166,7 +172,7 @@ EXAMPLES
|
|
|
166
172
|
$ csdx app:deploy --org <UID> --app-uid <APP-UID-1> --hosting-type <Hosting with Launch> --launch-project <new> --config <config-path>
|
|
167
173
|
```
|
|
168
174
|
|
|
169
|
-
_See code: [src/commands/app/deploy.ts](https://github.com/contentstack/apps-cli/blob/v1.3.
|
|
175
|
+
_See code: [src/commands/app/deploy.ts](https://github.com/contentstack/apps-cli/blob/v1.3.2/src/commands/app/deploy.ts)_
|
|
170
176
|
|
|
171
177
|
## `csdx app:get`
|
|
172
178
|
|
|
@@ -174,13 +180,14 @@ Get details of an app in developer hub
|
|
|
174
180
|
|
|
175
181
|
```
|
|
176
182
|
USAGE
|
|
177
|
-
$ csdx app:get [--app-uid <value>] [--app-type stack|organization] [-d <value>]
|
|
183
|
+
$ csdx app:get [--app-uid <value>] [--app-type stack|organization] [-d <value>] [--org <value>]
|
|
178
184
|
|
|
179
185
|
FLAGS
|
|
180
186
|
-d, --data-dir=<value> Current working directory.
|
|
181
187
|
--app-type=<option> [default: stack] Type of app
|
|
182
188
|
<options: stack|organization>
|
|
183
189
|
--app-uid=<value> Provide the app UID of an existing app.
|
|
190
|
+
--org=<value> Provide the organization UID to fetch the app details for the operation.
|
|
184
191
|
|
|
185
192
|
DESCRIPTION
|
|
186
193
|
Get details of an app in developer hub
|
|
@@ -195,7 +202,7 @@ EXAMPLES
|
|
|
195
202
|
$ csdx app:get --org <value> --app-uid <value> --app-type organization
|
|
196
203
|
```
|
|
197
204
|
|
|
198
|
-
_See code: [src/commands/app/get.ts](https://github.com/contentstack/apps-cli/blob/v1.3.
|
|
205
|
+
_See code: [src/commands/app/get.ts](https://github.com/contentstack/apps-cli/blob/v1.3.2/src/commands/app/get.ts)_
|
|
199
206
|
|
|
200
207
|
## `csdx app:install`
|
|
201
208
|
|
|
@@ -203,10 +210,11 @@ Install an app from the marketplace
|
|
|
203
210
|
|
|
204
211
|
```
|
|
205
212
|
USAGE
|
|
206
|
-
$ csdx app:install [--app-uid <value>] [--stack-api-key <value>]
|
|
213
|
+
$ csdx app:install [--app-uid <value>] [--stack-api-key <value>] [--org <value>]
|
|
207
214
|
|
|
208
215
|
FLAGS
|
|
209
216
|
--app-uid=<value> Provide the app UID of an existing app.
|
|
217
|
+
--org=<value> Provide the organization UID to fetch the app details for the operation.
|
|
210
218
|
--stack-api-key=<value> API key of the stack where the app operation is to be performed.
|
|
211
219
|
|
|
212
220
|
DESCRIPTION
|
|
@@ -220,7 +228,7 @@ EXAMPLES
|
|
|
220
228
|
$ csdx app:install --org <UID> --app-uid <APP-UID-1> --stack-api-key <STACK-API-KEY-1>
|
|
221
229
|
```
|
|
222
230
|
|
|
223
|
-
_See code: [src/commands/app/install.ts](https://github.com/contentstack/apps-cli/blob/v1.3.
|
|
231
|
+
_See code: [src/commands/app/install.ts](https://github.com/contentstack/apps-cli/blob/v1.3.2/src/commands/app/install.ts)_
|
|
224
232
|
|
|
225
233
|
## `csdx app:reinstall`
|
|
226
234
|
|
|
@@ -228,10 +236,11 @@ Reinstall an app from the marketplace
|
|
|
228
236
|
|
|
229
237
|
```
|
|
230
238
|
USAGE
|
|
231
|
-
$ csdx app:reinstall [--app-uid <value>] [--stack-api-key <value>]
|
|
239
|
+
$ csdx app:reinstall [--app-uid <value>] [--stack-api-key <value>] [--org <value>]
|
|
232
240
|
|
|
233
241
|
FLAGS
|
|
234
242
|
--app-uid=<value> Provide the app UID of an existing app.
|
|
243
|
+
--org=<value> Provide the organization UID to fetch the app details for the operation.
|
|
235
244
|
--stack-api-key=<value> API key of the stack where the app operation is to be performed.
|
|
236
245
|
|
|
237
246
|
DESCRIPTION
|
|
@@ -245,7 +254,7 @@ EXAMPLES
|
|
|
245
254
|
$ csdx app:reinstall --org <UID> --app-uid <APP-UID-1> --stack-api-key <STACK-API-KEY-1>
|
|
246
255
|
```
|
|
247
256
|
|
|
248
|
-
_See code: [src/commands/app/reinstall.ts](https://github.com/contentstack/apps-cli/blob/v1.3.
|
|
257
|
+
_See code: [src/commands/app/reinstall.ts](https://github.com/contentstack/apps-cli/blob/v1.3.2/src/commands/app/reinstall.ts)_
|
|
249
258
|
|
|
250
259
|
## `csdx app:uninstall`
|
|
251
260
|
|
|
@@ -253,11 +262,12 @@ Uninstall an app
|
|
|
253
262
|
|
|
254
263
|
```
|
|
255
264
|
USAGE
|
|
256
|
-
$ csdx app:uninstall [--app-uid <value>] [--installation-uid <value>] [--uninstall-all]
|
|
265
|
+
$ csdx app:uninstall [--app-uid <value>] [--installation-uid <value>] [--uninstall-all] [--org <value>]
|
|
257
266
|
|
|
258
267
|
FLAGS
|
|
259
268
|
--app-uid=<value> Provide the app UID of an existing app.
|
|
260
269
|
--installation-uid=<value> Provide the installation ID of the app that needs to be uninstalled.
|
|
270
|
+
--org=<value> Provide the organization UID to fetch the app details for the operation.
|
|
261
271
|
--uninstall-all Please select stacks from where the app must be uninstalled.
|
|
262
272
|
|
|
263
273
|
DESCRIPTION
|
|
@@ -271,7 +281,7 @@ EXAMPLES
|
|
|
271
281
|
$ csdx app:uninstall --org <UID> --app-uid <APP-UID-1> --installation-uid <INSTALLATION-UID-1>
|
|
272
282
|
```
|
|
273
283
|
|
|
274
|
-
_See code: [src/commands/app/uninstall.ts](https://github.com/contentstack/apps-cli/blob/v1.3.
|
|
284
|
+
_See code: [src/commands/app/uninstall.ts](https://github.com/contentstack/apps-cli/blob/v1.3.2/src/commands/app/uninstall.ts)_
|
|
275
285
|
|
|
276
286
|
## `csdx app:update`
|
|
277
287
|
|
|
@@ -279,10 +289,11 @@ Update the existing app in developer hub
|
|
|
279
289
|
|
|
280
290
|
```
|
|
281
291
|
USAGE
|
|
282
|
-
$ csdx app:update [--app-manifest <value>]
|
|
292
|
+
$ csdx app:update [--app-manifest <value>] [--org <value>]
|
|
283
293
|
|
|
284
294
|
FLAGS
|
|
285
295
|
--app-manifest=<value> Path to the app manifest.json file:
|
|
296
|
+
--org=<value> Provide the organization UID to fetch the app details for the operation.
|
|
286
297
|
|
|
287
298
|
DESCRIPTION
|
|
288
299
|
Update the existing app in developer hub
|
|
@@ -293,5 +304,5 @@ EXAMPLES
|
|
|
293
304
|
$ csdx app:update --app-manifest ./boilerplate/manifest.json
|
|
294
305
|
```
|
|
295
306
|
|
|
296
|
-
_See code: [src/commands/app/update.ts](https://github.com/contentstack/apps-cli/blob/v1.3.
|
|
307
|
+
_See code: [src/commands/app/update.ts](https://github.com/contentstack/apps-cli/blob/v1.3.2/src/commands/app/update.ts)_
|
|
297
308
|
<!-- commandsstop -->
|
package/lib/base-command.js
CHANGED
|
@@ -29,14 +29,14 @@ class BaseCommand extends cli_command_1.Command {
|
|
|
29
29
|
this.args = args;
|
|
30
30
|
cli_utilities_1.cliux.registerSearchPlugin();
|
|
31
31
|
this.registerConfig();
|
|
32
|
-
this.developerHubBaseUrl =
|
|
33
|
-
this.sharedConfig.developerHubBaseUrl || (0, util_1.getDeveloperHubUrl)();
|
|
34
|
-
await this.initCmaSDK();
|
|
35
|
-
await this.initMarketplaceSDK();
|
|
36
32
|
// Init logger
|
|
37
33
|
const logger = new util_1.Logger(this.sharedConfig);
|
|
38
34
|
this.log = logger.log.bind(logger);
|
|
39
35
|
this.validateRegionAndAuth();
|
|
36
|
+
this.developerHubBaseUrl =
|
|
37
|
+
this.sharedConfig.developerHubBaseUrl || (0, util_1.getDeveloperHubUrl)();
|
|
38
|
+
await this.initCmaSDK();
|
|
39
|
+
await this.initMarketplaceSDK();
|
|
40
40
|
}
|
|
41
41
|
async catch(err) {
|
|
42
42
|
// add any custom logic to handle errors from the command
|
|
@@ -25,6 +25,7 @@ class Create extends base_command_1.BaseCommand {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
async run() {
|
|
28
|
+
var _a;
|
|
28
29
|
this.sharedConfig.org = this.flags.org;
|
|
29
30
|
this.sharedConfig.appName = this.flags.name;
|
|
30
31
|
this.sharedConfig.boilerplateName = this.flags.boilerplate;
|
|
@@ -44,6 +45,15 @@ class Create extends base_command_1.BaseCommand {
|
|
|
44
45
|
await this.boilerplateFlow();
|
|
45
46
|
}
|
|
46
47
|
else {
|
|
48
|
+
if (this.sharedConfig.folderPath === undefined) {
|
|
49
|
+
const dataDir = (_a = this.flags["data-dir"]) !== null && _a !== void 0 ? _a : process.cwd();
|
|
50
|
+
let targetPath = (0, path_1.resolve)(dataDir, this.sharedConfig.defaultAppName);
|
|
51
|
+
if ((0, fs_1.existsSync)(targetPath)) {
|
|
52
|
+
this.log(this.messages.DIR_EXIST, "warn");
|
|
53
|
+
targetPath = await (0, util_1.getDirName)(targetPath);
|
|
54
|
+
}
|
|
55
|
+
this.sharedConfig.folderPath = targetPath;
|
|
56
|
+
}
|
|
47
57
|
this.manageManifestToggeling();
|
|
48
58
|
await this.registerTheAppOnDeveloperHub(false);
|
|
49
59
|
}
|
|
@@ -325,26 +335,20 @@ Create.examples = [
|
|
|
325
335
|
"$ <%= config.bin %> <%= command.id %> --name App-4 --app-type organization --org <UID> --boilerplate <DAM App Boilerplate>",
|
|
326
336
|
"$ <%= config.bin %> <%= command.id %> --name App-4 --app-type organization --org <UID> --boilerplate <Ecommerce App Boilerplate>",
|
|
327
337
|
];
|
|
328
|
-
Create.flags = {
|
|
329
|
-
name: cli_utilities_1.flags.string({
|
|
338
|
+
Create.flags = Object.assign({ name: cli_utilities_1.flags.string({
|
|
330
339
|
char: "n",
|
|
331
340
|
description: messages_1.appCreate.NAME_DESCRIPTION,
|
|
332
|
-
}),
|
|
333
|
-
"app-type": cli_utilities_1.flags.string({
|
|
341
|
+
}), "app-type": cli_utilities_1.flags.string({
|
|
334
342
|
default: "stack",
|
|
335
343
|
options: ["stack", "organization"],
|
|
336
344
|
description: messages_1.appCreate.APP_TYPE_DESCRIPTION,
|
|
337
|
-
}),
|
|
338
|
-
config: cli_utilities_1.flags.string({
|
|
345
|
+
}), config: cli_utilities_1.flags.string({
|
|
339
346
|
char: "c",
|
|
340
347
|
description: messages_1.commonMsg.CONFIG,
|
|
341
|
-
}),
|
|
342
|
-
"data-dir": cli_utilities_1.flags.string({
|
|
348
|
+
}), "data-dir": cli_utilities_1.flags.string({
|
|
343
349
|
char: "d",
|
|
344
350
|
description: messages_1.commonMsg.CURRENT_WORKING_DIR,
|
|
345
|
-
}),
|
|
346
|
-
boilerplate: cli_utilities_1.flags.string({
|
|
351
|
+
}), boilerplate: cli_utilities_1.flags.string({
|
|
347
352
|
description: messages_1.appCreate.BOILERPLATE_TEMPLATES,
|
|
348
|
-
}),
|
|
349
|
-
};
|
|
353
|
+
}) }, base_command_1.BaseCommand.baseFlags);
|
|
350
354
|
exports.default = Create;
|
|
@@ -67,9 +67,7 @@ Delete.examples = [
|
|
|
67
67
|
"$ <%= config.bin %> <%= command.id %> --app-uid <value>",
|
|
68
68
|
"$ <%= config.bin %> <%= command.id %> --app-uid <value> --org <value> -d ./boilerplate",
|
|
69
69
|
];
|
|
70
|
-
Delete.flags = {
|
|
71
|
-
"app-uid": cli_utilities_1.flags.string({
|
|
70
|
+
Delete.flags = Object.assign({ "app-uid": cli_utilities_1.flags.string({
|
|
72
71
|
description: messages_1.commonMsg.APP_UID,
|
|
73
|
-
}),
|
|
74
|
-
};
|
|
72
|
+
}) }, app_cli_base_command_1.AppCLIBaseCommand.baseFlags);
|
|
75
73
|
exports.default = Delete;
|
|
@@ -195,7 +195,10 @@ class Deploy extends app_cli_base_command_1.AppCLIBaseCommand {
|
|
|
195
195
|
if (!this.flags["yes"]) {
|
|
196
196
|
throw new Error(messages_1.deployAppMsg.APP_UPDATE_TERMINATION_MSG);
|
|
197
197
|
}
|
|
198
|
-
await (0, util_2.disconnectApp)(this.flags, this.sharedConfig.org,
|
|
198
|
+
await (0, util_2.disconnectApp)(this.flags, this.sharedConfig.org, {
|
|
199
|
+
marketplaceSdk: this.marketplaceAppSdk,
|
|
200
|
+
log: this.log,
|
|
201
|
+
});
|
|
199
202
|
}
|
|
200
203
|
}
|
|
201
204
|
}
|
|
@@ -208,26 +211,20 @@ Deploy.examples = [
|
|
|
208
211
|
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1> --hosting-type <Hosting with Launch> --launch-project <new>",
|
|
209
212
|
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1> --hosting-type <Hosting with Launch> --launch-project <new> --config <config-path>",
|
|
210
213
|
];
|
|
211
|
-
Deploy.flags = {
|
|
212
|
-
"app-uid": cli_utilities_1.Flags.string({
|
|
214
|
+
Deploy.flags = Object.assign({ "app-uid": cli_utilities_1.Flags.string({
|
|
213
215
|
description: messages_1.commonMsg.APP_UID,
|
|
214
|
-
}),
|
|
215
|
-
"hosting-type": cli_utilities_1.Flags.string({
|
|
216
|
+
}), "hosting-type": cli_utilities_1.Flags.string({
|
|
216
217
|
multiple: false,
|
|
217
218
|
options: ["Hosting with Launch", "Custom Hosting"],
|
|
218
219
|
description: messages_1.deployAppMsg.HOSTING_TYPE,
|
|
219
|
-
}),
|
|
220
|
-
"app-url": cli_utilities_1.Flags.string({
|
|
220
|
+
}), "app-url": cli_utilities_1.Flags.string({
|
|
221
221
|
description: messages_1.deployAppMsg.APP_URL,
|
|
222
|
-
}),
|
|
223
|
-
"launch-project": cli_utilities_1.Flags.string({
|
|
222
|
+
}), "launch-project": cli_utilities_1.Flags.string({
|
|
224
223
|
multiple: false,
|
|
225
224
|
options: ["existing", "new"],
|
|
226
225
|
description: messages_1.deployAppMsg.LAUNCH_PROJECT,
|
|
227
|
-
}),
|
|
228
|
-
config: cli_utilities_1.Flags.string({
|
|
226
|
+
}), config: cli_utilities_1.Flags.string({
|
|
229
227
|
char: "c",
|
|
230
228
|
description: messages_1.deployAppMsg.CONFIG_FILE,
|
|
231
|
-
}),
|
|
232
|
-
};
|
|
229
|
+
}) }, app_cli_base_command_1.AppCLIBaseCommand.baseFlags);
|
|
233
230
|
exports.default = Deploy;
|
package/lib/commands/app/get.js
CHANGED
|
@@ -42,18 +42,14 @@ Get.examples = [
|
|
|
42
42
|
"$ <%= config.bin %> <%= command.id %> --org <value> --app-uid <value> --app-type stack",
|
|
43
43
|
"$ <%= config.bin %> <%= command.id %> --org <value> --app-uid <value> --app-type organization",
|
|
44
44
|
];
|
|
45
|
-
Get.flags = {
|
|
46
|
-
"app-uid": cli_utilities_1.flags.string({
|
|
45
|
+
Get.flags = Object.assign({ "app-uid": cli_utilities_1.flags.string({
|
|
47
46
|
description: messages_1.commonMsg.APP_UID,
|
|
48
|
-
}),
|
|
49
|
-
"app-type": cli_utilities_1.flags.string({
|
|
47
|
+
}), "app-type": cli_utilities_1.flags.string({
|
|
50
48
|
default: "stack",
|
|
51
49
|
options: ["stack", "organization"],
|
|
52
50
|
description: messages_1.commonMsg.APP_TYPE_DESCRIPTION,
|
|
53
|
-
}),
|
|
54
|
-
"data-dir": cli_utilities_1.flags.string({
|
|
51
|
+
}), "data-dir": cli_utilities_1.flags.string({
|
|
55
52
|
char: "d",
|
|
56
53
|
description: messages_1.commonMsg.CURRENT_WORKING_DIR,
|
|
57
|
-
}),
|
|
58
|
-
};
|
|
54
|
+
}) }, app_cli_base_command_1.AppCLIBaseCommand.baseFlags);
|
|
59
55
|
exports.default = Get;
|
|
@@ -25,11 +25,12 @@ class App extends cli_utilities_1.Command {
|
|
|
25
25
|
App.description = "Apps CLI plugin";
|
|
26
26
|
App.examples = [
|
|
27
27
|
"$ <%= config.bin %> <%= command.id %>:create",
|
|
28
|
-
"$ <%= config.bin %> <%= command.id %>:get",
|
|
29
|
-
"$ <%= config.bin %> <%= command.id %>:update",
|
|
30
28
|
"$ <%= config.bin %> <%= command.id %>:delete",
|
|
29
|
+
"$ <%= config.bin %> <%= command.id %>:deploy",
|
|
30
|
+
"$ <%= config.bin %> <%= command.id %>:get",
|
|
31
31
|
"$ <%= config.bin %> <%= command.id %>:install",
|
|
32
|
-
"$ <%= config.bin %> <%= command.id %>:uninstall",
|
|
33
32
|
"$ <%= config.bin %> <%= command.id %>:reinstall",
|
|
33
|
+
"$ <%= config.bin %> <%= command.id %>:uninstall",
|
|
34
|
+
"$ <%= config.bin %> <%= command.id %>:update",
|
|
34
35
|
];
|
|
35
36
|
exports.default = App;
|
|
@@ -109,12 +109,9 @@ Install.examples = [
|
|
|
109
109
|
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1>",
|
|
110
110
|
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1> --stack-api-key <STACK-API-KEY-1>",
|
|
111
111
|
];
|
|
112
|
-
Install.flags = {
|
|
113
|
-
"app-uid": cli_utilities_1.flags.string({
|
|
112
|
+
Install.flags = Object.assign({ "app-uid": cli_utilities_1.flags.string({
|
|
114
113
|
description: messages_1.commonMsg.APP_UID,
|
|
115
|
-
}),
|
|
116
|
-
"stack-api-key": cli_utilities_1.flags.string({
|
|
114
|
+
}), "stack-api-key": cli_utilities_1.flags.string({
|
|
117
115
|
description: messages_1.commonMsg.STACK_API_KEY,
|
|
118
|
-
}),
|
|
119
|
-
};
|
|
116
|
+
}) }, app_cli_base_command_1.AppCLIBaseCommand.baseFlags);
|
|
120
117
|
exports.default = Install;
|
|
@@ -65,12 +65,9 @@ class Reinstall extends app_cli_base_command_1.AppCLIBaseCommand {
|
|
|
65
65
|
type: appType,
|
|
66
66
|
target: this.flags["stack-api-key"] || this.sharedConfig.org,
|
|
67
67
|
}), "info");
|
|
68
|
-
await (0, util_1.reinstallApp)({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
developerHubBaseUrl: this.developerHubBaseUrl,
|
|
72
|
-
orgUid: this.sharedConfig.org,
|
|
73
|
-
manifestUid: this.flags["app-uid"],
|
|
68
|
+
await (0, util_1.reinstallApp)(this.flags, this.sharedConfig.org, appType, {
|
|
69
|
+
marketplaceSdk: this.marketplaceAppSdk,
|
|
70
|
+
log: this.log,
|
|
74
71
|
});
|
|
75
72
|
this.log((0, messages_1.$t)(messages_1.reinstallAppMsg.APP_REINSTALLED_SUCCESSFULLY, {
|
|
76
73
|
app: (app === null || app === void 0 ? void 0 : app.name) || this.flags["app-uid"],
|
|
@@ -80,7 +77,7 @@ class Reinstall extends app_cli_base_command_1.AppCLIBaseCommand {
|
|
|
80
77
|
}
|
|
81
78
|
catch (error) {
|
|
82
79
|
this.log((error === null || error === void 0 ? void 0 : error.errorMessage) || (error === null || error === void 0 ? void 0 : error.message) || error, "error");
|
|
83
|
-
|
|
80
|
+
this.exit(1);
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
83
|
displayStackUrl() {
|
|
@@ -94,12 +91,9 @@ Reinstall.examples = [
|
|
|
94
91
|
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1>",
|
|
95
92
|
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1> --stack-api-key <STACK-API-KEY-1>",
|
|
96
93
|
];
|
|
97
|
-
Reinstall.flags = {
|
|
98
|
-
"app-uid": cli_utilities_1.flags.string({
|
|
94
|
+
Reinstall.flags = Object.assign({ "app-uid": cli_utilities_1.flags.string({
|
|
99
95
|
description: messages_1.commonMsg.APP_UID,
|
|
100
|
-
}),
|
|
101
|
-
"stack-api-key": cli_utilities_1.flags.string({
|
|
96
|
+
}), "stack-api-key": cli_utilities_1.flags.string({
|
|
102
97
|
description: messages_1.commonMsg.STACK_API_KEY,
|
|
103
|
-
}),
|
|
104
|
-
};
|
|
98
|
+
}) }, app_cli_base_command_1.AppCLIBaseCommand.baseFlags);
|
|
105
99
|
exports.default = Reinstall;
|
|
@@ -39,15 +39,11 @@ Uninstall.examples = [
|
|
|
39
39
|
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1>",
|
|
40
40
|
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1> --installation-uid <INSTALLATION-UID-1>",
|
|
41
41
|
];
|
|
42
|
-
Uninstall.flags = {
|
|
43
|
-
'app-uid': cli_utilities_1.flags.string({
|
|
42
|
+
Uninstall.flags = Object.assign({ 'app-uid': cli_utilities_1.flags.string({
|
|
44
43
|
description: messages_1.commonMsg.APP_UID,
|
|
45
|
-
}),
|
|
46
|
-
'installation-uid': cli_utilities_1.flags.string({
|
|
44
|
+
}), 'installation-uid': cli_utilities_1.flags.string({
|
|
47
45
|
description: messages_1.uninstallAppMsg.INSTALLATION_UID
|
|
48
|
-
}),
|
|
49
|
-
'uninstall-all': cli_utilities_1.flags.boolean({
|
|
46
|
+
}), 'uninstall-all': cli_utilities_1.flags.boolean({
|
|
50
47
|
description: messages_1.uninstallAppMsg.UNINSTALL_ALL,
|
|
51
|
-
}),
|
|
52
|
-
};
|
|
48
|
+
}) }, app_cli_base_command_1.AppCLIBaseCommand.baseFlags);
|
|
53
49
|
exports.default = Uninstall;
|
|
@@ -187,9 +187,7 @@ Update.examples = [
|
|
|
187
187
|
"$ <%= config.bin %> <%= command.id %>",
|
|
188
188
|
"$ <%= config.bin %> <%= command.id %> --app-manifest ./boilerplate/manifest.json",
|
|
189
189
|
];
|
|
190
|
-
Update.flags = {
|
|
191
|
-
"app-manifest": cli_utilities_1.flags.string({
|
|
190
|
+
Update.flags = Object.assign({ "app-manifest": cli_utilities_1.flags.string({
|
|
192
191
|
description: (0, messages_1.$t)(messages_1.appUpdate.FILE_PATH, { fileName: "app manifest.json" }),
|
|
193
|
-
}),
|
|
194
|
-
};
|
|
192
|
+
}) }, app_cli_base_command_1.AppCLIBaseCommand.baseFlags);
|
|
195
193
|
exports.default = Update;
|
|
@@ -16,14 +16,8 @@ declare function fetchApp(flags: FlagInput, orgUid: string, options: MarketPlace
|
|
|
16
16
|
declare function fetchAppInstallations(flags: FlagInput, orgUid: string, options: CommonOptions): Promise<import("@contentstack/management/types/contentstackCollection").ContentstackCollection<import("@contentstack/management/types/app/installation").Installation>>;
|
|
17
17
|
declare function deleteApp(flags: FlagInput, orgUid: string, options: MarketPlaceOptions): Promise<import("@contentstack/cli-utilities").App>;
|
|
18
18
|
declare function installApp(flags: FlagInput, orgUid: string, type: string, options: MarketPlaceOptions): Promise<import("@contentstack/cli-utilities").Installation>;
|
|
19
|
-
declare function reinstallApp(
|
|
20
|
-
|
|
21
|
-
type: string;
|
|
22
|
-
developerHubBaseUrl: string;
|
|
23
|
-
orgUid: string;
|
|
24
|
-
manifestUid: string;
|
|
25
|
-
}): Promise<void>;
|
|
26
|
-
declare function fetchStack(flags: FlagInput, options: CommonOptions): Promise<import("@contentstack/management/types/stack").Stack>;
|
|
19
|
+
declare function reinstallApp(flags: FlagInput, orgUid: string, type: string, options: MarketPlaceOptions): Promise<import("@contentstack/cli-utilities").Installation>;
|
|
20
|
+
declare function fetchStack(flags: FlagInput, options: CommonOptions): Promise<any>;
|
|
27
21
|
declare function getStacks(options: CommonOptions, orgUid: string, skip?: number, stacks?: Stack[]): Promise<Stack[]>;
|
|
28
22
|
declare function uninstallApp(flags: FlagInput, orgUid: string, options: CommonOptions, installationUid: string): Promise<import("@contentstack/management/types/utility/fields").AnyProperty>;
|
|
29
23
|
declare function fetchInstalledApps(flags: FlagInput, orgUid: string, options: MarketPlaceOptions): Promise<Record<string, any>[]>;
|
|
@@ -32,7 +26,7 @@ declare function updateApp(flags: FlagInput, orgUid: string, options: CommonOpti
|
|
|
32
26
|
declare function getProjects(apolloClient: ApolloClient<any>): Promise<LaunchProjectRes[]>;
|
|
33
27
|
declare function getManifestDetails(flags: FlagInput, orgUid: string, options: CommonOptions): import("@contentstack/management/types/app/hosting").Hosting;
|
|
34
28
|
declare function setupConfig(configPath: string): Record<string, string>;
|
|
35
|
-
declare function disconnectApp(flags: FlagInput, orgUid: string,
|
|
29
|
+
declare function disconnectApp(flags: FlagInput, orgUid: string, options: MarketPlaceOptions): Promise<any>;
|
|
36
30
|
declare function formatUrl(url: string): string;
|
|
37
31
|
declare const handleProjectNameConflict: (projectName: string, projects: any[], retry?: number) => Promise<string>;
|
|
38
32
|
declare function fetchBoilerplateDetails(): Promise<Record<string, any>[]>;
|
package/lib/util/common-utils.js
CHANGED
|
@@ -5,7 +5,6 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const map_1 = tslib_1.__importDefault(require("lodash/map"));
|
|
6
6
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
7
7
|
const queries_1 = require("../graphql/queries");
|
|
8
|
-
const api_request_handler_1 = require("./api-request-handler");
|
|
9
8
|
const types_1 = require("../types");
|
|
10
9
|
const inquirer_1 = require("./inquirer");
|
|
11
10
|
const messages_1 = require("../messages");
|
|
@@ -114,25 +113,15 @@ function installApp(flags, orgUid, type, options) {
|
|
|
114
113
|
});
|
|
115
114
|
}
|
|
116
115
|
exports.installApp = installApp;
|
|
117
|
-
|
|
118
|
-
const {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
orgUid,
|
|
127
|
-
payload,
|
|
128
|
-
url,
|
|
129
|
-
method: "PUT",
|
|
130
|
-
});
|
|
131
|
-
return result;
|
|
132
|
-
}
|
|
133
|
-
catch (err) {
|
|
134
|
-
throw err;
|
|
135
|
-
}
|
|
116
|
+
function reinstallApp(flags, orgUid, type, options) {
|
|
117
|
+
const { marketplaceSdk } = options;
|
|
118
|
+
return marketplaceSdk
|
|
119
|
+
.marketplace(orgUid)
|
|
120
|
+
.app(flags["app-uid"])
|
|
121
|
+
.reinstall({
|
|
122
|
+
targetUid: flags["stack-api-key"] || orgUid,
|
|
123
|
+
targetType: type,
|
|
124
|
+
});
|
|
136
125
|
}
|
|
137
126
|
exports.reinstallApp = reinstallApp;
|
|
138
127
|
function fetchStack(flags, options) {
|
|
@@ -265,21 +254,13 @@ function setupConfig(configPath) {
|
|
|
265
254
|
return configDetails;
|
|
266
255
|
}
|
|
267
256
|
exports.setupConfig = setupConfig;
|
|
268
|
-
async function disconnectApp(flags, orgUid,
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
url,
|
|
276
|
-
method: "PATCH",
|
|
277
|
-
});
|
|
278
|
-
return result;
|
|
279
|
-
}
|
|
280
|
-
catch (err) {
|
|
281
|
-
throw err;
|
|
282
|
-
}
|
|
257
|
+
async function disconnectApp(flags, orgUid, options) {
|
|
258
|
+
const { marketplaceSdk } = options;
|
|
259
|
+
return marketplaceSdk
|
|
260
|
+
.marketplace(orgUid)
|
|
261
|
+
.app(flags["app-uid"])
|
|
262
|
+
.hosting()
|
|
263
|
+
.disconnect({ provider: "launch" });
|
|
283
264
|
}
|
|
284
265
|
exports.disconnectApp = disconnectApp;
|
|
285
266
|
function formatUrl(url) {
|
package/lib/util/inquirer.js
CHANGED
|
@@ -126,6 +126,9 @@ exports.getInstalledApps = getInstalledApps;
|
|
|
126
126
|
*/
|
|
127
127
|
function getDeveloperHubUrl() {
|
|
128
128
|
const { cma } = cli_utilities_1.configHandler.get("region") || {};
|
|
129
|
+
if (!cma) {
|
|
130
|
+
throw new Error("Region not configured. Please set the region with command $ csdx config:set:region");
|
|
131
|
+
}
|
|
129
132
|
let developerHubBaseUrl = cma.replace("api", "developerhub-api");
|
|
130
133
|
if (developerHubBaseUrl.startsWith("http")) {
|
|
131
134
|
developerHubBaseUrl = developerHubBaseUrl.split("//")[1];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/apps-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "App ClI",
|
|
5
5
|
"author": "Contentstack CLI",
|
|
6
6
|
"homepage": "https://github.com/contentstack/contentstack-apps-cli",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@apollo/client": "^3.7.9",
|
|
24
24
|
"@contentstack/cli-command": "^1.2.18",
|
|
25
25
|
"@contentstack/cli-launch": "^1.0.18",
|
|
26
|
-
"@contentstack/cli-utilities": "^1.
|
|
26
|
+
"@contentstack/cli-utilities": "^1.7.0",
|
|
27
27
|
"adm-zip": "^0.5.10",
|
|
28
28
|
"chalk": "^4.1.2",
|
|
29
29
|
"lodash": "^4.17.21",
|