@adobe/aio-cli-plugin-app 10.7.2 → 11.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/README.md CHANGED
@@ -39,7 +39,6 @@ $ aio app --help
39
39
  * [`aio app delete`](#aio-app-delete)
40
40
  * [`aio app delete action [ACTION-NAME]`](#aio-app-delete-action-action-name)
41
41
  * [`aio app delete ci`](#aio-app-delete-ci)
42
- * [`aio app delete event [EVENT-ACTION-NAME]`](#aio-app-delete-event-event-action-name)
43
42
  * [`aio app delete extension`](#aio-app-delete-extension)
44
43
  * [`aio app delete service`](#aio-app-delete-service)
45
44
  * [`aio app delete web-assets`](#aio-app-delete-web-assets)
@@ -71,7 +70,7 @@ DESCRIPTION
71
70
  Create, run, test, and deploy Adobe I/O Apps
72
71
  ```
73
72
 
74
- _See code: [src/commands/app/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/index.ts)_
73
+ _See code: [src/commands/app/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/index.ts)_
75
74
 
76
75
  ## `aio app add`
77
76
 
@@ -89,7 +88,7 @@ DESCRIPTION
89
88
  Add a new component to an existing Adobe I/O App
90
89
  ```
91
90
 
92
- _See code: [src/commands/app/add/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/add/index.ts)_
91
+ _See code: [src/commands/app/add/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/add/index.ts)_
93
92
 
94
93
  ## `aio app add action`
95
94
 
@@ -114,7 +113,7 @@ ALIASES
114
113
  $ aio app add actions
115
114
  ```
116
115
 
117
- _See code: [src/commands/app/add/action.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/add/action.ts)_
116
+ _See code: [src/commands/app/add/action.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/add/action.ts)_
118
117
 
119
118
  ## `aio app add ci`
120
119
 
@@ -132,7 +131,7 @@ DESCRIPTION
132
131
  Add CI files
133
132
  ```
134
133
 
135
- _See code: [src/commands/app/add/ci.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/add/ci.ts)_
134
+ _See code: [src/commands/app/add/ci.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/add/ci.ts)_
136
135
 
137
136
  ## `aio app add event`
138
137
 
@@ -140,16 +139,14 @@ Add a new Adobe I/O Events action
140
139
 
141
140
  ```
142
141
  USAGE
143
- $ aio app add event [-v] [--version] [--install] [-y] [-e <value>] [--experimental-allow-events-templates]
142
+ $ aio app add event [-v] [--version] [--install] [-y] [-e <value>]
144
143
 
145
144
  FLAGS
146
- -e, --extension=<value> Add events to a specific extension
147
- -v, --verbose Verbose output
148
- -y, --yes Skip questions, and use all default values
149
- --experimental-allow-events-templates Feature flag to enable events templates. NOTE: skip-prompt will have no effect
150
- if this flag is enabled.
151
- --[no-]install [default: true] Run npm installation after files are created
152
- --version Show version
145
+ -e, --extension=<value> Add events to a specific extension
146
+ -v, --verbose Verbose output
147
+ -y, --yes Skip questions, and use all default values
148
+ --[no-]install [default: true] Run npm installation after files are created
149
+ --version Show version
153
150
 
154
151
  DESCRIPTION
155
152
  Add a new Adobe I/O Events action
@@ -159,7 +156,7 @@ ALIASES
159
156
  $ aio app add events
160
157
  ```
161
158
 
162
- _See code: [src/commands/app/add/event.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/add/event.ts)_
159
+ _See code: [src/commands/app/add/event.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/add/event.ts)_
163
160
 
164
161
  ## `aio app add extension`
165
162
 
@@ -185,7 +182,7 @@ ALIASES
185
182
  $ aio app add extensions
186
183
  ```
187
184
 
188
- _See code: [src/commands/app/add/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/add/extension.ts)_
185
+ _See code: [src/commands/app/add/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/add/extension.ts)_
189
186
 
190
187
  ## `aio app add service`
191
188
 
@@ -209,7 +206,7 @@ ALIASES
209
206
  $ aio app add services
210
207
  ```
211
208
 
212
- _See code: [src/commands/app/add/service.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/add/service.ts)_
209
+ _See code: [src/commands/app/add/service.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/add/service.ts)_
213
210
 
214
211
  ## `aio app add web-assets`
215
212
 
@@ -230,7 +227,7 @@ DESCRIPTION
230
227
  Add web assets support
231
228
  ```
232
229
 
233
- _See code: [src/commands/app/add/web-assets.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/add/web-assets.ts)_
230
+ _See code: [src/commands/app/add/web-assets.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/add/web-assets.ts)_
234
231
 
235
232
  ## `aio app build`
236
233
 
@@ -259,7 +256,7 @@ DESCRIPTION
259
256
  This will always force a rebuild unless --no-force-build is set.
260
257
  ```
261
258
 
262
- _See code: [src/commands/app/build.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/build.ts)_
259
+ _See code: [src/commands/app/build.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/build.ts)_
263
260
 
264
261
  ## `aio app create [PATH]`
265
262
 
@@ -281,7 +278,7 @@ DESCRIPTION
281
278
  Create a new Adobe I/O App with default parameters
282
279
  ```
283
280
 
284
- _See code: [src/commands/app/create.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/create.ts)_
281
+ _See code: [src/commands/app/create.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/create.ts)_
285
282
 
286
283
  ## `aio app delete`
287
284
 
@@ -299,7 +296,7 @@ DESCRIPTION
299
296
  Delete a component from an existing Adobe I/O App
300
297
  ```
301
298
 
302
- _See code: [src/commands/app/delete/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/delete/index.ts)_
299
+ _See code: [src/commands/app/delete/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/delete/index.ts)_
303
300
 
304
301
  ## `aio app delete action [ACTION-NAME]`
305
302
 
@@ -325,7 +322,7 @@ ALIASES
325
322
  $ aio app delete actions
326
323
  ```
327
324
 
328
- _See code: [src/commands/app/delete/action.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/delete/action.ts)_
325
+ _See code: [src/commands/app/delete/action.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/delete/action.ts)_
329
326
 
330
327
  ## `aio app delete ci`
331
328
 
@@ -344,33 +341,7 @@ DESCRIPTION
344
341
  Delete existing CI files
345
342
  ```
346
343
 
347
- _See code: [src/commands/app/delete/ci.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/delete/ci.ts)_
348
-
349
- ## `aio app delete event [EVENT-ACTION-NAME]`
350
-
351
- Delete existing Adobe I/O Events actions
352
-
353
- ```
354
- USAGE
355
- $ aio app delete event [EVENT-ACTION-NAME] [-v] [--version] [-y]
356
-
357
- ARGUMENTS
358
- EVENT-ACTION-NAME Action `pkg/name` to delete, you can specify multiple actions via a comma separated list
359
-
360
- FLAGS
361
- -v, --verbose Verbose output
362
- -y, --yes Skip questions, and use all default values
363
- --version Show version
364
-
365
- DESCRIPTION
366
- Delete existing Adobe I/O Events actions
367
-
368
-
369
- ALIASES
370
- $ aio app delete events
371
- ```
372
-
373
- _See code: [src/commands/app/delete/event.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/delete/event.ts)_
344
+ _See code: [src/commands/app/delete/ci.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/delete/ci.ts)_
374
345
 
375
346
  ## `aio app delete extension`
376
347
 
@@ -396,7 +367,7 @@ ALIASES
396
367
  $ aio app delete extensions
397
368
  ```
398
369
 
399
- _See code: [src/commands/app/delete/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/delete/extension.ts)_
370
+ _See code: [src/commands/app/delete/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/delete/extension.ts)_
400
371
 
401
372
  ## `aio app delete service`
402
373
 
@@ -420,7 +391,7 @@ ALIASES
420
391
  $ aio app delete services
421
392
  ```
422
393
 
423
- _See code: [src/commands/app/delete/service.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/delete/service.ts)_
394
+ _See code: [src/commands/app/delete/service.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/delete/service.ts)_
424
395
 
425
396
  ## `aio app delete web-assets`
426
397
 
@@ -439,7 +410,7 @@ DESCRIPTION
439
410
  Delete existing web assets
440
411
  ```
441
412
 
442
- _See code: [src/commands/app/delete/web-assets.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/delete/web-assets.ts)_
413
+ _See code: [src/commands/app/delete/web-assets.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/delete/web-assets.ts)_
443
414
 
444
415
  ## `aio app deploy`
445
416
 
@@ -449,7 +420,7 @@ Build and deploy an Adobe I/O App
449
420
  USAGE
450
421
  $ aio app deploy [-v] [--version] [--actions | -a <value>] [--web-assets] [--force-build | ] [--content-hash]
451
422
  [--web-optimize] [-e <value> | ] [--build] [--open] [--force-deploy] [--force-publish | | --publish]
452
- [--force-events ] [--log-forwarding-update]
423
+ [--force-events | | ] [--log-forwarding-update]
453
424
 
454
425
  FLAGS
455
426
  -a, --action=<value>... Deploy only a specific action, the flags can be specified multiple times, this will set
@@ -462,7 +433,8 @@ FLAGS
462
433
  --[no-]force-build [default: true] Force a build even if one already exists
463
434
  --force-deploy [default: false] Force deploy changes, regardless of production Workspace being
464
435
  published in Exchange.
465
- --[no-]force-events [default: false] Force event registrations and overwrite any previous registrations
436
+ --[no-]force-events [default: false] Force event registrations and delete any registrations not part of the
437
+ config file
466
438
  --force-publish [default: false] Force publish extension(s) to Exchange, delete previously published
467
439
  extension points
468
440
  --[no-]log-forwarding-update [default: true] Update log forwarding configuration on server
@@ -479,7 +451,7 @@ DESCRIPTION
479
451
  This will always force a rebuild unless --no-force-build is set.
480
452
  ```
481
453
 
482
- _See code: [src/commands/app/deploy.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/deploy.ts)_
454
+ _See code: [src/commands/app/deploy.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/deploy.ts)_
483
455
 
484
456
  ## `aio app get-url [ACTION]`
485
457
 
@@ -502,7 +474,7 @@ DESCRIPTION
502
474
  Get action URLs
503
475
  ```
504
476
 
505
- _See code: [src/commands/app/get-url.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/get-url.ts)_
477
+ _See code: [src/commands/app/get-url.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/get-url.ts)_
506
478
 
507
479
  ## `aio app info`
508
480
 
@@ -524,7 +496,7 @@ DESCRIPTION
524
496
  Display settings/configuration in use by an Adobe I/O App
525
497
  ```
526
498
 
527
- _See code: [src/commands/app/info.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/info.ts)_
499
+ _See code: [src/commands/app/info.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/info.ts)_
528
500
 
529
501
  ## `aio app init [PATH]`
530
502
 
@@ -532,8 +504,8 @@ Create a new Adobe I/O App
532
504
 
533
505
  ```
534
506
  USAGE
535
- $ aio app init [PATH] [-v] [--version] [--install] [-y] [--login] [-e <value> | -t <value>]
536
- [--standalone-app | ] [-w <value> | -i <value>] [--confirm-new-workspace] [--use-jwt]
507
+ $ aio app init [PATH] [-v] [--version] [--install] [-y] [--login] [-e <value> | -t <value> | --repo <value>]
508
+ [--standalone-app | | ] [-w <value> | -i <value>] [--confirm-new-workspace] [--use-jwt]
537
509
 
538
510
  ARGUMENTS
539
511
  PATH [default: .] Path to the app directory
@@ -549,6 +521,7 @@ FLAGS
549
521
  --confirm-new-workspace Skip and confirm prompt for creating a new workspace
550
522
  --[no-]install [default: true] Run npm installation after files are created
551
523
  --[no-]login Login using your Adobe ID for interacting with Adobe I/O Developer Console
524
+ --repo=<value> Init from gh quick-start repo. Expected to be of the form <owner>/<repo>/<path>
552
525
  --standalone-app Create a stand-alone application
553
526
  --use-jwt if the config has both jwt and OAuth Server to Server Credentials (while migrating),
554
527
  prefer the JWT credentials
@@ -558,7 +531,7 @@ DESCRIPTION
558
531
  Create a new Adobe I/O App
559
532
  ```
560
533
 
561
- _See code: [src/commands/app/init.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/init.ts)_
534
+ _See code: [src/commands/app/init.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/init.ts)_
562
535
 
563
536
  ## `aio app list`
564
537
 
@@ -576,7 +549,7 @@ DESCRIPTION
576
549
  List components for Adobe I/O App
577
550
  ```
578
551
 
579
- _See code: [src/commands/app/list/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/list/index.ts)_
552
+ _See code: [src/commands/app/list/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/list/index.ts)_
580
553
 
581
554
  ## `aio app list extension`
582
555
 
@@ -601,7 +574,7 @@ ALIASES
601
574
  $ aio app list extensions
602
575
  ```
603
576
 
604
- _See code: [src/commands/app/list/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/list/extension.ts)_
577
+ _See code: [src/commands/app/list/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/list/extension.ts)_
605
578
 
606
579
  ## `aio app logs`
607
580
 
@@ -625,7 +598,7 @@ DESCRIPTION
625
598
  Fetch logs for an Adobe I/O App
626
599
  ```
627
600
 
628
- _See code: [src/commands/app/logs.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/logs.ts)_
601
+ _See code: [src/commands/app/logs.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/logs.ts)_
629
602
 
630
603
  ## `aio app run`
631
604
 
@@ -648,7 +621,7 @@ DESCRIPTION
648
621
  Run an Adobe I/O App
649
622
  ```
650
623
 
651
- _See code: [src/commands/app/run.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/run.ts)_
624
+ _See code: [src/commands/app/run.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/run.ts)_
652
625
 
653
626
  ## `aio app test`
654
627
 
@@ -676,7 +649,7 @@ DESCRIPTION
676
649
  If the extension has a hook called 'test' in its 'ext.config.yaml', the script specified will be run instead.
677
650
  ```
678
651
 
679
- _See code: [src/commands/app/test.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/test.ts)_
652
+ _See code: [src/commands/app/test.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/test.ts)_
680
653
 
681
654
  ## `aio app undeploy`
682
655
 
@@ -701,7 +674,7 @@ DESCRIPTION
701
674
  Undeploys an Adobe I/O App
702
675
  ```
703
676
 
704
- _See code: [src/commands/app/undeploy.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/undeploy.ts)_
677
+ _See code: [src/commands/app/undeploy.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/undeploy.ts)_
705
678
 
706
679
  ## `aio app use [CONFIG_FILE_PATH]`
707
680
 
@@ -749,5 +722,5 @@ DESCRIPTION
749
722
  page in https://developer.adobe.com/console/
750
723
  ```
751
724
 
752
- _See code: [src/commands/app/use.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.2/src/commands/app/use.ts)_
725
+ _See code: [src/commands/app/use.ts](https://github.com/adobe/aio-cli-plugin-app/blob/11.1.0/src/commands/app/use.ts)_
753
726
  <!-- commandsstop -->
@@ -17,37 +17,39 @@ const DOCKER_REPOS = { // repo-name:kind
17
17
  'adobe-action-nodejs-v12': 'nodejs:12',
18
18
  'adobe-action-nodejs-v14': 'nodejs:14',
19
19
  'adobe-action-nodejs-v16': 'nodejs:16',
20
- 'adobe-action-nodejs-v18': 'nodejs:18'
20
+ 'adobe-action-nodejs-v18': 'nodejs:18',
21
+ 'adobe-action-nodejs-v20': 'nodejs:20'
21
22
  }
22
23
 
23
24
  const DEFAULT_KIND = 'nodejs:18'
24
25
 
25
- async function main() {
26
- const nodejs = []
27
-
28
- for ([repoName, kind] of Object.entries(DOCKER_REPOS)) {
29
- const data = await fetch(`https://registry.hub.docker.com/v2/repositories/${DOCKER_ORG}/${repoName}/tags`)
30
- const json = await data.json()
31
- const defaultKind = (kind === DEFAULT_KIND)? true : undefined
32
-
33
- nodejs.push({
34
- kind,
35
- default: defaultKind,
36
- image: {
37
- prefix: DOCKER_ORG,
38
- name: repoName,
39
- tag: json.results[0].name
40
- }
41
- })
42
- }
43
-
44
- const output = {
45
- runtimes: {
46
- nodejs
26
+ /** @private */
27
+ async function main () {
28
+ const nodejs = []
29
+
30
+ for (const [repoName, kind] of Object.entries(DOCKER_REPOS)) {
31
+ const data = await fetch(`https://registry.hub.docker.com/v2/repositories/${DOCKER_ORG}/${repoName}/tags`)
32
+ const json = await data.json()
33
+ const defaultKind = (kind === DEFAULT_KIND) ? true : undefined
34
+
35
+ nodejs.push({
36
+ kind,
37
+ default: defaultKind,
38
+ image: {
39
+ prefix: DOCKER_ORG,
40
+ name: repoName,
41
+ tag: json.results[0].name
47
42
  }
43
+ })
44
+ }
45
+
46
+ const output = {
47
+ runtimes: {
48
+ nodejs
48
49
  }
49
- console.log(JSON.stringify(output, null, 2))
50
50
  }
51
+ console.log(JSON.stringify(output, null, 2))
52
+ }
51
53
 
52
- main()
53
-
54
+ main()
55
+ .catch(console.error)
@@ -6,7 +6,7 @@
6
6
  "image": {
7
7
  "prefix": "adobeapiplatform",
8
8
  "name": "adobe-action-nodejs-v10",
9
- "tag": "3.0.37"
9
+ "tag": "3.0.39"
10
10
  }
11
11
  },
12
12
  {
@@ -14,7 +14,7 @@
14
14
  "image": {
15
15
  "prefix": "adobeapiplatform",
16
16
  "name": "adobe-action-nodejs-v12",
17
- "tag": "3.0.37"
17
+ "tag": "3.0.39"
18
18
  }
19
19
  },
20
20
  {
@@ -22,7 +22,7 @@
22
22
  "image": {
23
23
  "prefix": "adobeapiplatform",
24
24
  "name": "adobe-action-nodejs-v14",
25
- "tag": "3.0.37"
25
+ "tag": "3.0.39"
26
26
  }
27
27
  },
28
28
  {
@@ -30,7 +30,7 @@
30
30
  "image": {
31
31
  "prefix": "adobeapiplatform",
32
32
  "name": "adobe-action-nodejs-v16",
33
- "tag": "3.0.37"
33
+ "tag": "3.0.39"
34
34
  }
35
35
  },
36
36
  {
@@ -39,7 +39,15 @@
39
39
  "image": {
40
40
  "prefix": "adobeapiplatform",
41
41
  "name": "adobe-action-nodejs-v18",
42
- "tag": "3.0.37"
42
+ "tag": "3.0.39"
43
+ }
44
+ },
45
+ {
46
+ "kind": "nodejs:20",
47
+ "image": {
48
+ "prefix": "adobeapiplatform",
49
+ "name": "adobe-action-nodejs-v20",
50
+ "tag": "3.0.39"
43
51
  }
44
52
  }
45
53
  ]
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "10.7.2",
2
+ "version": "11.1.0",
3
3
  "commands": {
4
4
  "app:build": {
5
5
  "id": "app:build",
@@ -235,11 +235,8 @@
235
235
  "force-events": {
236
236
  "name": "force-events",
237
237
  "type": "boolean",
238
- "description": "[default: false] Force event registrations and overwrite any previous registrations",
238
+ "description": "[default: false] Force event registrations and delete any registrations not part of the config file",
239
239
  "allowNo": true,
240
- "dependsOn": [
241
- "feature-event-hooks"
242
- ],
243
240
  "exclusive": [
244
241
  "action",
245
242
  "publish"
@@ -250,13 +247,6 @@
250
247
  "type": "boolean",
251
248
  "description": "[default: true] Update log forwarding configuration on server",
252
249
  "allowNo": true
253
- },
254
- "feature-event-hooks": {
255
- "name": "feature-event-hooks",
256
- "type": "boolean",
257
- "description": "[default: false] Enable event hooks feature",
258
- "hidden": true,
259
- "allowNo": true
260
250
  }
261
251
  },
262
252
  "args": {}
@@ -467,7 +457,8 @@
467
457
  "description": "Extension point(s) to implement",
468
458
  "multiple": true,
469
459
  "exclusive": [
470
- "template"
460
+ "template",
461
+ "repo"
471
462
  ]
472
463
  },
473
464
  "standalone-app": {
@@ -476,7 +467,8 @@
476
467
  "description": "Create a stand-alone application",
477
468
  "allowNo": false,
478
469
  "exclusive": [
479
- "template"
470
+ "template",
471
+ "repo"
480
472
  ]
481
473
  },
482
474
  "template": {
@@ -486,6 +478,26 @@
486
478
  "description": "Specify a link to a template that will be installed",
487
479
  "multiple": true
488
480
  },
481
+ "org": {
482
+ "name": "org",
483
+ "type": "option",
484
+ "description": "Specify the Adobe Developer Console Org to init from",
485
+ "hidden": true,
486
+ "multiple": false,
487
+ "exclusive": [
488
+ "import"
489
+ ]
490
+ },
491
+ "project": {
492
+ "name": "project",
493
+ "type": "option",
494
+ "description": "Specify the Adobe Developer Console Project to init from",
495
+ "hidden": true,
496
+ "multiple": false,
497
+ "exclusive": [
498
+ "import"
499
+ ]
500
+ },
489
501
  "workspace": {
490
502
  "name": "workspace",
491
503
  "type": "option",
@@ -503,6 +515,17 @@
503
515
  "description": "Skip and confirm prompt for creating a new workspace",
504
516
  "allowNo": false
505
517
  },
518
+ "repo": {
519
+ "name": "repo",
520
+ "type": "option",
521
+ "description": "Init from gh quick-start repo. Expected to be of the form <owner>/<repo>/<path>",
522
+ "multiple": false,
523
+ "exclusive": [
524
+ "template",
525
+ "extension",
526
+ "standalone-app"
527
+ ]
528
+ },
506
529
  "use-jwt": {
507
530
  "name": "use-jwt",
508
531
  "type": "boolean",
@@ -667,7 +690,7 @@
667
690
  "char": "o",
668
691
  "description": "The packaged app output file path",
669
692
  "multiple": false,
670
- "default": "app.zip"
693
+ "default": "dist/app.zip"
671
694
  }
672
695
  },
673
696
  "args": {
@@ -861,13 +884,6 @@
861
884
  "exclusive": [
862
885
  "unpublish"
863
886
  ]
864
- },
865
- "feature-event-hooks": {
866
- "name": "feature-event-hooks",
867
- "type": "boolean",
868
- "description": "[default: false] Enable event hooks feature",
869
- "hidden": true,
870
- "allowNo": true
871
887
  }
872
888
  },
873
889
  "args": {}
@@ -1106,12 +1122,6 @@
1106
1122
  "char": "e",
1107
1123
  "description": "Add events to a specific extension",
1108
1124
  "multiple": false
1109
- },
1110
- "experimental-allow-events-templates": {
1111
- "name": "experimental-allow-events-templates",
1112
- "type": "boolean",
1113
- "description": "Feature flag to enable events templates. NOTE: skip-prompt will have no effect if this flag is enabled.",
1114
- "allowNo": false
1115
1125
  }
1116
1126
  },
1117
1127
  "args": {}
@@ -1368,46 +1378,6 @@
1368
1378
  },
1369
1379
  "args": {}
1370
1380
  },
1371
- "app:delete:event": {
1372
- "id": "app:delete:event",
1373
- "description": "Delete existing Adobe I/O Events actions\n",
1374
- "strict": true,
1375
- "pluginName": "@adobe/aio-cli-plugin-app",
1376
- "pluginAlias": "@adobe/aio-cli-plugin-app",
1377
- "pluginType": "core",
1378
- "aliases": [
1379
- "app:delete:events"
1380
- ],
1381
- "flags": {
1382
- "verbose": {
1383
- "name": "verbose",
1384
- "type": "boolean",
1385
- "char": "v",
1386
- "description": "Verbose output",
1387
- "allowNo": false
1388
- },
1389
- "version": {
1390
- "name": "version",
1391
- "type": "boolean",
1392
- "description": "Show version",
1393
- "allowNo": false
1394
- },
1395
- "yes": {
1396
- "name": "yes",
1397
- "type": "boolean",
1398
- "char": "y",
1399
- "description": "Skip questions, and use all default values",
1400
- "allowNo": false
1401
- }
1402
- },
1403
- "args": {
1404
- "event-action-name": {
1405
- "name": "event-action-name",
1406
- "description": "Action `pkg/name` to delete, you can specify multiple actions via a comma separated list",
1407
- "required": false
1408
- }
1409
- }
1410
- },
1411
1381
  "app:delete:extension": {
1412
1382
  "id": "app:delete:extension",
1413
1383
  "description": "Delete existing extensions\n",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adobe/aio-cli-plugin-app",
3
3
  "description": "Create, Build and Deploy Adobe I/O Applications",
4
- "version": "10.7.2",
4
+ "version": "11.1.0",
5
5
  "author": "Adobe Inc.",
6
6
  "bugs": "https://github.com/adobe/aio-cli-plugin-app/issues",
7
7
  "dependencies": {
@@ -16,9 +16,10 @@
16
16
  "@adobe/aio-lib-runtime": "^5.0.0",
17
17
  "@adobe/aio-lib-templates": "^2.2.0",
18
18
  "@adobe/aio-lib-web": "^6.1.0",
19
- "@adobe/generator-aio-app": "^5.1.0",
20
- "@adobe/generator-app-common-lib": "^0.4.5",
19
+ "@adobe/generator-aio-app": "^6.0.0",
20
+ "@adobe/generator-app-common-lib": "^1.0.0",
21
21
  "@adobe/inquirer-table-checkbox": "^1.2.0",
22
+ "@octokit/rest": "^19.0.11",
22
23
  "@oclif/core": "^2.11.6",
23
24
  "@parcel/core": "^2.7.0",
24
25
  "@parcel/reporter-cli": "^2.7.0",
@@ -48,12 +49,13 @@
48
49
  "term-size": "^2.2.1",
49
50
  "unzipper": "^0.10.11",
50
51
  "upath": "^2",
52
+ "junk": "^3.1.0",
51
53
  "which": "^3.0.0",
52
54
  "yeoman-environment": "^3.2.0"
53
55
  },
54
56
  "devDependencies": {
55
57
  "@adobe/aio-lib-test-proxy": "^1.0.0",
56
- "@adobe/eslint-config-aio-lib-config": "^2.0.1",
58
+ "@adobe/eslint-config-aio-lib-config": "^2.0.2",
57
59
  "@types/jest": "^29",
58
60
  "babel-runtime": "^6.26.0",
59
61
  "core-js": "^3",
@@ -11,12 +11,9 @@ governing permissions and limitations under the License.
11
11
 
12
12
  const AddCommand = require('../../../AddCommand')
13
13
  const TemplatesCommand = require('../../../TemplatesCommand')
14
- const yeoman = require('yeoman-environment')
15
14
  const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:add:event', { provider: 'debug' })
16
15
  const { Flags } = require('@oclif/core')
17
- const ora = require('ora')
18
16
  const path = require('path')
19
- const generators = require('@adobe/generator-aio-app')
20
17
  const TemplateRegistryAPI = require('@adobe/aio-lib-templates')
21
18
 
22
19
  class AddEventCommand extends TemplatesCommand {
@@ -24,7 +21,6 @@ class AddEventCommand extends TemplatesCommand {
24
21
  const { flags } = await this.parse(AddEventCommand)
25
22
 
26
23
  aioLogger.debug(`add events with flags: ${JSON.stringify(flags)}`)
27
- const spinner = ora()
28
24
 
29
25
  // guaranteed to have at least one, otherwise would throw in config load or in matching the ext name
30
26
  const entries = Object.entries(this.getAppExtConfigs(flags))
@@ -36,42 +32,27 @@ class AddEventCommand extends TemplatesCommand {
36
32
  const config = entries[0][1]
37
33
  const actionFolder = path.relative(config.root, config.actions.src)
38
34
  const runtimeManifestData = this.getRuntimeManifestConfigFile(configName)
39
-
35
+ const eventsData = this.getEventsConfigFile(configName)
40
36
  const templateOptions = {
41
37
  'skip-prompt': false,
42
38
  'action-folder': actionFolder,
43
39
  'config-path': runtimeManifestData.file,
44
- 'full-key-to-manifest': runtimeManifestData.key
40
+ 'full-key-to-manifest': runtimeManifestData.key,
41
+ 'full-key-to-events-manifest': eventsData.key,
42
+ 'events-config-path': eventsData.file
45
43
  }
46
44
 
47
- if (flags['experimental-allow-events-templates']) {
48
- const eventsData = this.getEventsConfigFile(configName)
49
- templateOptions['full-key-to-events-manifest'] = eventsData.key
50
- templateOptions['events-config-path'] = eventsData.file
51
- const [searchCriteria, orderByCriteria] = await this.getSearchCriteria()
52
- const templates = await this.selectTemplates(searchCriteria, orderByCriteria)
53
- if (templates.length === 0) {
54
- this.error('No events templates were chosen to be installed.')
55
- } else {
56
- await this.installTemplates({
57
- useDefaultValues: flags.yes,
58
- installNpm: flags.install,
59
- templateOptions,
60
- templates
61
- })
62
- }
63
- // by default yeoman runs the install, we control installation from the app plugin
45
+ const [searchCriteria, orderByCriteria] = await this.getSearchCriteria()
46
+ const templates = await this.selectTemplates(searchCriteria, orderByCriteria)
47
+ if (templates.length === 0) {
48
+ this.error('No events templates were chosen to be installed.')
64
49
  } else {
65
- templateOptions['skip-prompt'] = flags.yes
66
- templateOptions.force = true
67
- const env = yeoman.createEnv()
68
- env.options = { skipInstall: true }
69
- const eventsGen = env.instantiate(generators['add-events'], {
70
- options: templateOptions
50
+ await this.installTemplates({
51
+ useDefaultValues: flags.yes,
52
+ installNpm: flags.install,
53
+ templateOptions,
54
+ templates
71
55
  })
72
- await env.runGenerator(eventsGen)
73
-
74
- await this.runInstallPackages(flags, spinner)
75
56
  }
76
57
  }
77
58
 
@@ -107,10 +88,6 @@ AddEventCommand.flags = {
107
88
  multiple: false,
108
89
  parse: str => [str]
109
90
  }),
110
- 'experimental-allow-events-templates': Flags.boolean({
111
- description: 'Feature flag to enable events templates. NOTE: skip-prompt will have no effect if this flag is enabled.',
112
- default: false
113
- }),
114
91
  ...AddCommand.flags
115
92
  }
116
93
 
@@ -22,6 +22,9 @@ const { createWebExportFilter, runInProcess, buildExtensionPointPayloadWoMetadat
22
22
  const rtLib = require('@adobe/aio-lib-runtime')
23
23
  const LogForwarding = require('../../lib/log-forwarding')
24
24
 
25
+ const PRE_DEPLOY_EVENT_REG = 'pre-deploy-event-reg'
26
+ const POST_DEPLOY_EVENT_REG = 'post-deploy-event-reg'
27
+
25
28
  class Deploy extends BuildCommand {
26
29
  async run () {
27
30
  // cli input
@@ -142,13 +145,10 @@ class Deploy extends BuildCommand {
142
145
 
143
146
  try {
144
147
  await runInProcess(config.hooks['pre-app-deploy'], config)
145
- if (flags['feature-event-hooks']) {
146
- this.log('feature-event-hooks is enabled, running pre-deploy-event-reg hook')
147
- const hookResults = await this.config.runHook('pre-deploy-event-reg', { appConfig: config, force: flags['force-events'] })
148
- if (hookResults?.failures?.length > 0) {
149
- // output should be "Error : <plugin-name> : <error-message>\n" for each failure
150
- this.error(hookResults.failures.map(f => `${f.plugin.name} : ${f.error.message}`).join('\nError: '), { exit: 1 })
151
- }
148
+ const hookResults = await this.config.runHook(PRE_DEPLOY_EVENT_REG, { appConfig: config, force: flags['force-events'] })
149
+ if (hookResults?.failures?.length > 0) {
150
+ // output should be "Error : <plugin-name> : <error-message>\n" for each failure
151
+ this.error(hookResults.failures.map(f => `${f.plugin.name} : ${f.error.message}`).join('\nError: '), { exit: 1 })
152
152
  }
153
153
  } catch (err) {
154
154
  this.error(err)
@@ -250,13 +250,10 @@ class Deploy extends BuildCommand {
250
250
 
251
251
  try {
252
252
  await runInProcess(config.hooks['post-app-deploy'], config)
253
- if (flags['feature-event-hooks']) {
254
- this.log('feature-event-hooks is enabled, running post-deploy-event-reg hook')
255
- const hookResults = await this.config.runHook('post-deploy-event-reg', { appConfig: config, force: flags['force-events'] })
256
- if (hookResults?.failures?.length > 0) {
257
- // output should be "Error : <plugin-name> : <error-message>\n" for each failure
258
- this.error(hookResults.failures.map(f => `${f.plugin.name} : ${f.error.message}`).join('\nError: '), { exit: 1 })
259
- }
253
+ const hookResults = await this.config.runHook(POST_DEPLOY_EVENT_REG, { appConfig: config, force: flags['force-events'] })
254
+ if (hookResults?.failures?.length > 0) {
255
+ // output should be "Error : <plugin-name> : <error-message>\n" for each failure
256
+ this.error(hookResults.failures.map(f => `${f.plugin.name} : ${f.error.message}`).join('\nError: '), { exit: 1 })
260
257
  }
261
258
  } catch (err) {
262
259
  this.error(err)
@@ -353,10 +350,9 @@ Deploy.flags = {
353
350
  exclusive: ['action', 'publish'] // no-publish is excluded
354
351
  }),
355
352
  'force-events': Flags.boolean({
356
- description: '[default: false] Force event registrations and overwrite any previous registrations',
353
+ description: '[default: false] Force event registrations and delete any registrations not part of the config file',
357
354
  default: false,
358
355
  allowNo: true,
359
- dependsOn: ['feature-event-hooks'],
360
356
  exclusive: ['action', 'publish'] // no-publish is excluded
361
357
  }),
362
358
  'web-optimize': Flags.boolean({
@@ -367,12 +363,6 @@ Deploy.flags = {
367
363
  description: '[default: true] Update log forwarding configuration on server',
368
364
  default: true,
369
365
  allowNo: true
370
- }),
371
- 'feature-event-hooks': Flags.boolean({
372
- description: '[default: false] Enable event hooks feature',
373
- default: false,
374
- allowNo: true,
375
- hidden: true
376
366
  })
377
367
  }
378
368
 
@@ -20,9 +20,10 @@ const generators = require('@adobe/generator-aio-app')
20
20
  const TemplateRegistryAPI = require('@adobe/aio-lib-templates')
21
21
  const inquirer = require('inquirer')
22
22
  const hyperlinker = require('hyperlinker')
23
-
24
23
  const { importConsoleConfig } = require('../../lib/import')
25
24
  const { loadAndValidateConfigFile } = require('../../lib/import-helper')
25
+ const { Octokit } = require('@octokit/rest')
26
+ const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:init', { provider: 'debug' })
26
27
 
27
28
  const DEFAULT_WORKSPACE = 'Stage'
28
29
 
@@ -102,24 +103,28 @@ class InitCommand extends TemplatesCommand {
102
103
  this.log(chalk.green(`Loaded Adobe Developer Console configuration file for the Project '${consoleConfig.project.title}' in the Organization '${consoleConfig.project.org.name}'`))
103
104
  }
104
105
 
105
- // 2. prompt for templates to be installed
106
- const templates = await this.getTemplatesForFlags(flags)
107
- // If no templates selected, init a standalone app
108
- if (templates.length <= 0) {
109
- flags['standalone-app'] = true
110
- }
106
+ if (flags.repo) {
107
+ await this.withQuickstart(flags.repo)
108
+ } else {
109
+ // 2. prompt for templates to be installed
110
+ const templates = await this.getTemplatesForFlags(flags)
111
+ // If no templates selected, init a standalone app
112
+ if (templates.length <= 0) {
113
+ flags['standalone-app'] = true
114
+ }
111
115
 
112
- // 3. run base code generators
113
- const projectName = (consoleConfig && consoleConfig.project.name) || path.basename(process.cwd())
114
- await this.runCodeGenerators(this.getInitialGenerators(flags), flags.yes, projectName)
116
+ // 3. run base code generators
117
+ const projectName = (consoleConfig && consoleConfig.project.name) || path.basename(process.cwd())
118
+ await this.runCodeGenerators(this.getInitialGenerators(flags), flags.yes, projectName)
115
119
 
116
- // 4. install templates
117
- await this.installTemplates({
118
- useDefaultValues: flags.yes,
119
- installNpm: flags.install,
120
- installConfig: flags.login,
121
- templates
122
- })
120
+ // 4. install templates
121
+ await this.installTemplates({
122
+ useDefaultValues: flags.yes,
123
+ installNpm: flags.install,
124
+ installConfig: flags.login,
125
+ templates
126
+ })
127
+ }
123
128
 
124
129
  // 5. import config - if any
125
130
  if (flags.import) {
@@ -128,40 +133,50 @@ class InitCommand extends TemplatesCommand {
128
133
  }
129
134
 
130
135
  async initWithLogin (flags) {
136
+ if (flags.repo) {
137
+ await this.withQuickstart(flags.repo)
138
+ }
131
139
  // this will trigger a login
132
140
  const consoleCLI = await this.getLibConsoleCLI()
133
141
 
134
142
  // 1. select org
135
- const org = await this.selectConsoleOrg(consoleCLI)
143
+ const org = await this.selectConsoleOrg(consoleCLI, flags)
136
144
  // 2. get supported services
137
145
  const orgSupportedServices = await consoleCLI.getEnabledServicesForOrg(org.id)
138
146
  // 3. select or create project
139
- const project = await this.selectOrCreateConsoleProject(consoleCLI, org)
147
+ const project = await this.selectOrCreateConsoleProject(consoleCLI, org, flags)
140
148
  // 4. retrieve workspace details, defaults to Stage
141
149
  const workspace = await this.retrieveWorkspaceFromName(consoleCLI, org, project, flags)
142
150
 
143
- // 5. get list of templates to install
144
- const templates = await this.getTemplatesForFlags(flags, orgSupportedServices)
145
- // If no templates selected, init a standalone app
146
- if (templates.length <= 0) {
147
- flags['standalone-app'] = true
151
+ let templates
152
+ if (!flags.repo) {
153
+ // 5. get list of templates to install
154
+ templates = await this.getTemplatesForFlags(flags, orgSupportedServices)
155
+ // If no templates selected, init a standalone app
156
+ if (templates.length <= 0) {
157
+ flags['standalone-app'] = true
158
+ }
148
159
  }
149
160
 
150
161
  // 6. download workspace config
151
162
  const consoleConfig = await consoleCLI.getWorkspaceConfig(org.id, project.id, workspace.id, orgSupportedServices)
152
163
 
153
164
  // 7. run base code generators
154
- await this.runCodeGenerators(this.getInitialGenerators(flags), flags.yes, consoleConfig.project.name)
165
+ if (!flags.repo) {
166
+ await this.runCodeGenerators(this.getInitialGenerators(flags), flags.yes, consoleConfig.project.name)
167
+ }
155
168
 
156
169
  // 8. import config
157
170
  await this.importConsoleConfig(consoleConfig, flags)
158
171
 
159
172
  // 9. install templates
160
- await this.installTemplates({
161
- useDefaultValues: flags.yes,
162
- installNpm: flags.install,
163
- templates
164
- })
173
+ if (!flags.repo) {
174
+ await this.installTemplates({
175
+ useDefaultValues: flags.yes,
176
+ installNpm: flags.install,
177
+ templates
178
+ })
179
+ }
165
180
 
166
181
  this.log(chalk.blue(chalk.bold(`Project initialized for Workspace ${workspace.name}, you can run 'aio app use -w <workspace>' to switch workspace.`)))
167
182
  }
@@ -275,21 +290,24 @@ class InitCommand extends TemplatesCommand {
275
290
  return [searchCriteria, orderByCriteria, selection, selectionLabel]
276
291
  }
277
292
 
278
- async selectConsoleOrg (consoleCLI) {
293
+ async selectConsoleOrg (consoleCLI, flags) {
279
294
  const organizations = await consoleCLI.getOrganizations()
280
- const selectedOrg = await consoleCLI.promptForSelectOrganization(organizations)
295
+ const selectedOrg = await consoleCLI.promptForSelectOrganization(organizations, { orgId: flags.org, orgCode: flags.org })
281
296
  await this.ensureDevTermAccepted(consoleCLI, selectedOrg.id)
282
297
  return selectedOrg
283
298
  }
284
299
 
285
- async selectOrCreateConsoleProject (consoleCLI, org) {
300
+ async selectOrCreateConsoleProject (consoleCLI, org, flags) {
286
301
  const projects = await consoleCLI.getProjects(org.id)
287
302
  let project = await consoleCLI.promptForSelectProject(
288
303
  projects,
289
- {},
304
+ { projectId: flags.project, projectName: flags.project },
290
305
  { allowCreate: true }
291
306
  )
292
307
  if (!project) {
308
+ if (flags.project) {
309
+ this.error(`--project ${flags.project} not found`)
310
+ }
293
311
  // user has escaped project selection prompt, let's create a new one
294
312
  const projectDetails = await consoleCLI.promptForCreateProjectDetails()
295
313
  project = await consoleCLI.createProject(org.id, projectDetails)
@@ -348,7 +366,56 @@ class InitCommand extends TemplatesCommand {
348
366
  }
349
367
  )
350
368
  }
369
+
370
+ async withQuickstart (fullRepo) {
371
+ const octokit = new Octokit({
372
+ auth: ''
373
+ })
374
+ const spinner = ora('Downloading quickstart repo').start()
375
+ /** @private */
376
+ async function downloadRepoDirRecursive (owner, repo, filePath, basePath) {
377
+ const { data } = await octokit.repos.getContent({ owner, repo, path: filePath })
378
+ for (const fileOrDir of data) {
379
+ if (fileOrDir.type === 'dir') {
380
+ const destDir = path.relative(basePath, fileOrDir.path)
381
+ fs.ensureDirSync(destDir)
382
+ await downloadRepoDirRecursive(owner, repo, fileOrDir.path, basePath)
383
+ } else {
384
+ // todo: use a spinner
385
+ spinner.text = `Downloading ${fileOrDir.path}`
386
+ const response = await fetch(fileOrDir.download_url)
387
+ const jsonResponse = await response.text()
388
+ fs.writeFileSync(path.relative(basePath, fileOrDir.path), jsonResponse)
389
+ }
390
+ }
391
+ }
392
+ // we need to handle n-deep paths, <owner>/<repo>/<path>/<path>
393
+ const [owner, repo, ...restOfPath] = fullRepo.split('/')
394
+ const basePath = restOfPath.join('/')
395
+ try {
396
+ const response = await octokit.repos.getContent({ owner, repo, path: `${basePath}/app.config.yaml` })
397
+ aioLogger.debug(`github headers: ${JSON.stringify(response.headers, 0, 2)}`)
398
+ await downloadRepoDirRecursive(owner, repo, basePath, basePath)
399
+ spinner.succeed('Downloaded quickstart repo')
400
+ } catch (e) {
401
+ if (e.status === 404) {
402
+ spinner.fail('Quickstart repo not found')
403
+ this.error('--repo does not point to a valid Adobe App Builder app')
404
+ }
405
+ if (e.status === 403) {
406
+ // This is helpful for debugging, but by default we don't show it
407
+ // github rate limit is 60 requests per hour for unauthenticated users
408
+ const resetTime = new Date(e.response.headers['x-ratelimit-reset'] * 1000)
409
+ aioLogger.debug(`too many requests, resetTime : ${resetTime.toLocaleTimeString()}`)
410
+ spinner.fail()
411
+ this.error('too many requests, please try again later')
412
+ } else {
413
+ this.error(e)
414
+ }
415
+ }
416
+ }
351
417
  }
418
+
352
419
  InitCommand.description = `Create a new Adobe I/O App
353
420
  `
354
421
 
@@ -372,18 +439,28 @@ InitCommand.flags = {
372
439
  description: 'Extension point(s) to implement',
373
440
  char: 'e',
374
441
  multiple: true,
375
- exclusive: ['template']
442
+ exclusive: ['template', 'repo']
376
443
  }),
377
444
  'standalone-app': Flags.boolean({
378
445
  description: 'Create a stand-alone application',
379
446
  default: false,
380
- exclusive: ['template']
447
+ exclusive: ['template', 'repo']
381
448
  }),
382
449
  template: Flags.string({
383
450
  description: 'Specify a link to a template that will be installed',
384
451
  char: 't',
385
452
  multiple: true
386
453
  }),
454
+ org: Flags.string({
455
+ description: 'Specify the Adobe Developer Console Org to init from',
456
+ hidden: true,
457
+ exclusive: ['import'] // also no-login
458
+ }),
459
+ project: Flags.string({
460
+ description: 'Specify the Adobe Developer Console Project to init from',
461
+ hidden: true,
462
+ exclusive: ['import'] // also no-login
463
+ }),
387
464
  workspace: Flags.string({
388
465
  description: 'Specify the Adobe Developer Console Workspace to init from, defaults to Stage',
389
466
  default: DEFAULT_WORKSPACE,
@@ -394,6 +471,10 @@ InitCommand.flags = {
394
471
  description: 'Skip and confirm prompt for creating a new workspace',
395
472
  default: false
396
473
  }),
474
+ repo: Flags.string({
475
+ description: 'Init from gh quick-start repo. Expected to be of the form <owner>/<repo>/<path>',
476
+ exclusive: ['template', 'extension', 'standalone-app']
477
+ }),
397
478
  'use-jwt': Flags.boolean({
398
479
  description: 'if the config has both jwt and OAuth Server to Server Credentials (while migrating), prefer the JWT credentials',
399
480
  default: false
@@ -21,14 +21,16 @@ const { loadConfigFile, writeFile } = require('../../lib/import-helper')
21
21
  const { getObjectValue } = require('../../lib/app-helper')
22
22
  const ora = require('ora')
23
23
  const chalk = require('chalk')
24
+ const junk = require('junk')
24
25
 
25
26
  // eslint-disable-next-line node/no-missing-require
26
27
  const libConfigNext = require('@adobe/aio-cli-lib-app-config-next')
27
28
 
29
+ const DIST_FOLDER = 'dist'
28
30
  const DEFAULTS = {
29
- OUTPUT_ZIP_FILE: 'app.zip',
30
- ARTIFACTS_FOLDER: 'app-package',
31
- DEPLOY_YAML_FILE: 'deploy.yaml'
31
+ OUTPUT_ZIP_FILE_PATH: path.join(DIST_FOLDER, 'app.zip'),
32
+ ARTIFACTS_FOLDER_PATH: path.join(DIST_FOLDER, 'app-package'),
33
+ DEPLOY_YAML_FILE_NAME: 'deploy.yaml'
32
34
  }
33
35
 
34
36
  class Pack extends BaseCommand {
@@ -53,20 +55,37 @@ class Pack extends BaseCommand {
53
55
  aioLogger.debug(`changed current working directory to: ${resolvedPath}`)
54
56
  }
55
57
 
58
+ // get all 'dist' locations of all extensions (relative to the current working directory)
59
+ const distLocations = Object.entries(appConfig.all)
60
+ .map(([, extConfig]) => path.relative(process.cwd(), extConfig.app.dist))
61
+
56
62
  try {
57
63
  // 1. create artifacts phase
58
- this.spinner.start(`Creating package artifacts folder '${DEFAULTS.ARTIFACTS_FOLDER}'...`)
59
- await fs.emptyDir(DEFAULTS.ARTIFACTS_FOLDER)
60
- this.spinner.succeed(`Created package artifacts folder '${DEFAULTS.ARTIFACTS_FOLDER}'`)
64
+ this.spinner.start(`Creating package artifacts folder '${DEFAULTS.ARTIFACTS_FOLDER_PATH}'...`)
65
+ await fs.emptyDir(DEFAULTS.ARTIFACTS_FOLDER_PATH)
66
+ this.spinner.succeed(`Created package artifacts folder '${DEFAULTS.ARTIFACTS_FOLDER_PATH}'`)
61
67
 
62
68
  // ACNA-2038
63
69
  // not artifacts folder should exist before we fire the event
64
- await this.config.runHook('pre-pack', { appConfig, artifactsFolder: DEFAULTS.ARTIFACTS_FOLDER })
70
+
71
+ const hookResults = await this.config.runHook('pre-pack', { appConfig, artifactsFolder: DEFAULTS.ARTIFACTS_FOLDER_PATH })
72
+ if (hookResults?.failures?.length > 0) {
73
+ // output should be "Error : <plugin-name> : <error-message>\n" for each failure
74
+ this.error(hookResults.failures.map(f => `${f.plugin.name} : ${f.error.message}`).join('\nError: '), { exit: 1 })
75
+ }
76
+
77
+ // 1a. Get file list to pack
78
+ const fileList = await this.filesToPack({ filesToExclude: [flags.output, DEFAULTS.DIST_FOLDER, ...distLocations] })
79
+ this.log('=== Files to pack ===')
80
+ fileList.forEach((file) => {
81
+ this.log(` ${file}`)
82
+ })
83
+ this.log('=====================')
65
84
 
66
85
  // 2. copy files to package phase
67
86
  this.spinner.start('Copying project files...')
68
- const fileList = await this.filesToPack([flags.output])
69
- await this.copyPackageFiles(DEFAULTS.ARTIFACTS_FOLDER, fileList)
87
+
88
+ await this.copyPackageFiles(DEFAULTS.ARTIFACTS_FOLDER_PATH, fileList)
70
89
  this.spinner.succeed('Copied project files')
71
90
 
72
91
  // 3. add/modify artifacts phase
@@ -79,13 +98,18 @@ class Pack extends BaseCommand {
79
98
  this.spinner.succeed('Added code-download annotations')
80
99
 
81
100
  // doing this before zip so other things can be added to the zip
82
- await this.config.runHook('post-pack', { appConfig, artifactsFolder: DEFAULTS.ARTIFACTS_FOLDER })
101
+ await this.config.runHook('post-pack', { appConfig, artifactsFolder: DEFAULTS.ARTIFACTS_FOLDER_PATH })
83
102
 
84
103
  // 4. zip package phase
85
- this.spinner.start(`Zipping package artifacts folder '${DEFAULTS.ARTIFACTS_FOLDER}' to '${outputZipFile}'...`)
104
+ this.spinner.start(`Zipping package artifacts folder '${DEFAULTS.ARTIFACTS_FOLDER_PATH}' to '${outputZipFile}'...`)
86
105
  await fs.remove(outputZipFile)
87
- await this.zipHelper(DEFAULTS.ARTIFACTS_FOLDER, outputZipFile)
88
- this.spinner.succeed(`Zipped package artifacts folder '${DEFAULTS.ARTIFACTS_FOLDER}' to '${outputZipFile}'`)
106
+ await this.zipHelper(DEFAULTS.ARTIFACTS_FOLDER_PATH, outputZipFile)
107
+ this.spinner.succeed(`Zipped package artifacts folder '${DEFAULTS.ARTIFACTS_FOLDER_PATH}' to '${outputZipFile}'`)
108
+
109
+ // 5. finally delete the artifacts folder
110
+ this.spinner.start(`Deleting package artifacts folder '${DEFAULTS.ARTIFACTS_FOLDER_PATH}'...`)
111
+ await fs.remove(DEFAULTS.ARTIFACTS_FOLDER_PATH)
112
+ this.spinner.succeed(`Deleted package artifacts folder '${DEFAULTS.ARTIFACTS_FOLDER_PATH}'`)
89
113
  } catch (e) {
90
114
  this.spinner.fail(e.message)
91
115
  this.error(flags.verbose ? e : e.message)
@@ -176,7 +200,7 @@ class Pack extends BaseCommand {
176
200
  }
177
201
 
178
202
  await writeFile(
179
- path.join(DEFAULTS.ARTIFACTS_FOLDER, DEFAULTS.DEPLOY_YAML_FILE),
203
+ path.join(DEFAULTS.ARTIFACTS_FOLDER_PATH, DEFAULTS.DEPLOY_YAML_FILE_NAME),
180
204
  yaml.dump(deployJson),
181
205
  { overwrite: true })
182
206
  }
@@ -239,17 +263,38 @@ class Pack extends BaseCommand {
239
263
  *
240
264
  * This runs `npm pack` to get the list.
241
265
  *
242
- * @param {Array<string>} filesToExclude a list of files to exclude
243
- * @param {string} workingDirectory the working directory to run `npm pack` in
266
+ * @param {object} options the options for the method
267
+ * @param {Array<string>} options.filesToExclude a list of files to exclude
268
+ * @param {string} options.workingDirectory the working directory to run `npm pack` in
244
269
  * @returns {Array<string>} a list of files that are to be packed
245
270
  */
246
- async filesToPack (filesToExclude = [], workingDirectory = process.cwd()) {
271
+ async filesToPack ({ filesToExclude = [], workingDirectory = process.cwd() } = {}) {
247
272
  const { stdout } = await execa('npm', ['pack', '--dry-run', '--json'], { cwd: workingDirectory })
248
273
 
274
+ const noJunkFiles = (file) => {
275
+ const isJunkFile = junk.is(file)
276
+ if (isJunkFile) {
277
+ aioLogger.debug(`junk file (omitted from pack): ${file}`)
278
+ }
279
+
280
+ return !isJunkFile
281
+ }
282
+
283
+ const noDotFiles = (file) => {
284
+ const isDotFile = /^\..*/.test(file)
285
+ if (isDotFile) {
286
+ aioLogger.debug(`hidden dotfile (omitted from pack): ${file}`)
287
+ }
288
+
289
+ return !isDotFile
290
+ }
291
+
249
292
  const { files } = JSON.parse(stdout)[0]
250
293
  return files
251
294
  .map(file => file.path)
252
295
  .filter(file => !filesToExclude.includes(file))
296
+ .filter(noJunkFiles) // no junk files like .DS_Store
297
+ .filter(noDotFiles) // no files that start with a '.'
253
298
  }
254
299
 
255
300
  /**
@@ -291,7 +336,7 @@ class Pack extends BaseCommand {
291
336
 
292
337
  // rewrite config files
293
338
  for (const [file, keys] of Object.entries(fileToAnnotationKey)) {
294
- const configFilePath = path.join(DEFAULTS.ARTIFACTS_FOLDER, file)
339
+ const configFilePath = path.join(DEFAULTS.ARTIFACTS_FOLDER_PATH, file)
295
340
  const { values } = loadConfigFile(configFilePath)
296
341
 
297
342
  keys.forEach(key => {
@@ -321,7 +366,7 @@ Pack.flags = {
321
366
  output: Flags.string({
322
367
  description: 'The packaged app output file path',
323
368
  char: 'o',
324
- default: DEFAULTS.OUTPUT_ZIP_FILE
369
+ default: DEFAULTS.OUTPUT_ZIP_FILE_PATH
325
370
  })
326
371
  }
327
372
 
@@ -78,13 +78,10 @@ class Undeploy extends BaseCommand {
78
78
  // undeploy
79
79
  try {
80
80
  await runInProcess(config.hooks['pre-app-undeploy'], config)
81
- if (flags['feature-event-hooks'] && flags.events) {
82
- this.log('feature-event-hooks is enabled, running pre-undeploy-event-reg hook')
83
- const hookResults = await this.config.runHook('pre-undeploy-event-reg', { appConfig: config })
84
- if (hookResults?.failures?.length > 0) {
85
- // output should be "Error : <plugin-name> : <error-message>\n" for each failure
86
- this.error(hookResults.failures.map(f => `${f.plugin.name} : ${f.error.message}`).join('\nError: '), { exit: 1 })
87
- }
81
+ const hookResults = await this.config.runHook('pre-undeploy-event-reg', { appConfig: config })
82
+ if (hookResults?.failures?.length > 0) {
83
+ // output should be "Error : <plugin-name> : <error-message>\n" for each failure
84
+ this.error(hookResults.failures.map(f => `${f.plugin.name} : ${f.error.message}`).join('\nError: '), { exit: 1 })
88
85
  }
89
86
  } catch (err) {
90
87
  this.log(err)
@@ -178,12 +175,6 @@ Undeploy.flags = {
178
175
  description: 'Force unpublish extension(s) from Exchange, will delete all extension points',
179
176
  default: false,
180
177
  exclusive: ['unpublish'] // unpublish is excluded
181
- }),
182
- 'feature-event-hooks': Flags.boolean({
183
- description: '[default: false] Enable event hooks feature',
184
- default: false,
185
- allowNo: true,
186
- hidden: true
187
178
  })
188
179
  }
189
180
 
@@ -1,67 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- Unless required by applicable law or agreed to in writing, software distributed under
7
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
8
- OF ANY KIND, either express or implied. See the License for the specific language
9
- governing permissions and limitations under the License.
10
- */
11
-
12
- const BaseCommand = require('../../../BaseCommand')
13
- const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:delete:event', { provider: 'debug' })
14
- const { Flags, Args } = require('@oclif/core')
15
- const DeleteActionCommand = require('./action')
16
- const chalk = require('chalk')
17
-
18
- class DeleteEventCommand extends BaseCommand {
19
- async run () {
20
- const { args, flags } = await this.parse(DeleteEventCommand)
21
-
22
- aioLogger.debug(`deleting events from the project, with args ${JSON.stringify(args)}, and flags: ${JSON.stringify(flags)}`)
23
-
24
- // NOTE: this command only wraps app delete action, events will have more than actions later on
25
- if (flags.yes && !args['event-action-name']) {
26
- this.error('<event-action-name> must also be provided when using --yes')
27
- }
28
-
29
- if (!args['event-action-name']) {
30
- this.log(chalk.bold(chalk.blue('NOTE: this is running the \'app delete action\' command, please select events actions.')))
31
- this.log()
32
- }
33
-
34
- const cmdLineArgs = []
35
- if (args['event-action-name']) {
36
- cmdLineArgs.push(args['event-action-name'])
37
- }
38
- if (flags.yes) {
39
- cmdLineArgs.push('--yes')
40
- }
41
- await DeleteActionCommand.run(cmdLineArgs)
42
- }
43
- }
44
-
45
- DeleteEventCommand.description = `Delete existing Adobe I/O Events actions
46
- `
47
-
48
- DeleteEventCommand.flags = {
49
- yes: Flags.boolean({
50
- description: 'Skip questions, and use all default values',
51
- char: 'y',
52
- default: false
53
- }),
54
- ...BaseCommand.flags
55
- }
56
-
57
- DeleteEventCommand.args =
58
- {
59
- 'event-action-name': Args.string({
60
- description: 'Action `pkg/name` to delete, you can specify multiple actions via a comma separated list',
61
- required: false
62
- })
63
- }
64
-
65
- DeleteEventCommand.aliases = ['app:delete:events']
66
-
67
- module.exports = DeleteEventCommand