@adobe/aio-cli-plugin-app 10.4.0 → 10.6.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.
Files changed (35) hide show
  1. package/README.md +64 -8
  2. package/oclif.manifest.json +9 -3
  3. package/package.json +17 -14
  4. package/src/BaseCommand.js +21 -1
  5. package/src/commands/app/add/action.js +1 -1
  6. package/src/commands/app/add/ci.js +1 -1
  7. package/src/commands/app/add/event.js +60 -18
  8. package/src/commands/app/add/extension.js +1 -1
  9. package/src/commands/app/add/index.js +1 -1
  10. package/src/commands/app/add/service.js +1 -1
  11. package/src/commands/app/add/web-assets.js +1 -1
  12. package/src/commands/app/create.js +6 -6
  13. package/src/commands/app/delete/action.js +7 -7
  14. package/src/commands/app/delete/ci.js +1 -1
  15. package/src/commands/app/delete/event.js +6 -6
  16. package/src/commands/app/delete/extension.js +1 -1
  17. package/src/commands/app/delete/index.js +1 -1
  18. package/src/commands/app/delete/service.js +1 -1
  19. package/src/commands/app/delete/web-assets.js +1 -1
  20. package/src/commands/app/deploy.js +4 -3
  21. package/src/commands/app/get-url.js +6 -4
  22. package/src/commands/app/index.js +1 -1
  23. package/src/commands/app/info.js +1 -1
  24. package/src/commands/app/init.js +6 -6
  25. package/src/commands/app/install.js +71 -6
  26. package/src/commands/app/list/extension-points.js +1 -1
  27. package/src/commands/app/list/extension.js +1 -1
  28. package/src/commands/app/list/index.js +1 -1
  29. package/src/commands/app/pack.js +24 -55
  30. package/src/commands/app/run.js +10 -7
  31. package/src/commands/app/undeploy.js +9 -12
  32. package/src/commands/app/use.js +7 -7
  33. package/src/lib/app-helper.js +2 -2
  34. package/src/lib/import-helper.js +9 -9
  35. package/src/lib/log-poller.js +1 -0
package/README.md CHANGED
@@ -71,7 +71,7 @@ DESCRIPTION
71
71
  Create, run, test, and deploy Adobe I/O Apps
72
72
  ```
73
73
 
74
- _See code: [src/commands/app/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/10.4.0/src/commands/app/index.js)_
74
+ _See code: [src/commands/app/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/index.ts)_
75
75
 
76
76
  ## `aio app add`
77
77
 
@@ -89,6 +89,8 @@ DESCRIPTION
89
89
  Add a new component to an existing Adobe I/O App
90
90
  ```
91
91
 
92
+ _See code: [src/commands/app/add/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/index.ts)_
93
+
92
94
  ## `aio app add action`
93
95
 
94
96
  Add new actions
@@ -112,6 +114,8 @@ ALIASES
112
114
  $ aio app add actions
113
115
  ```
114
116
 
117
+ _See code: [src/commands/app/add/action.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/action.ts)_
118
+
115
119
  ## `aio app add ci`
116
120
 
117
121
  Add CI files
@@ -128,20 +132,24 @@ DESCRIPTION
128
132
  Add CI files
129
133
  ```
130
134
 
135
+ _See code: [src/commands/app/add/ci.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/ci.ts)_
136
+
131
137
  ## `aio app add event`
132
138
 
133
139
  Add a new Adobe I/O Events action
134
140
 
135
141
  ```
136
142
  USAGE
137
- $ aio app add event [-v] [--version] [--install] [-y] [-e <value>]
143
+ $ aio app add event [-v] [--version] [--install] [-y] [-e <value>] [--experimental-allow-events-templates]
138
144
 
139
145
  FLAGS
140
- -e, --extension=<value> Add actions to a specific extension
141
- -v, --verbose Verbose output
142
- -y, --yes Skip questions, and use all default values
143
- --[no-]install [default: true] Run npm installation after files are created
144
- --version Show version
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
153
 
146
154
  DESCRIPTION
147
155
  Add a new Adobe I/O Events action
@@ -151,6 +159,8 @@ ALIASES
151
159
  $ aio app add events
152
160
  ```
153
161
 
162
+ _See code: [src/commands/app/add/event.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/event.ts)_
163
+
154
164
  ## `aio app add extension`
155
165
 
156
166
  Add new extensions to the project
@@ -175,6 +185,8 @@ ALIASES
175
185
  $ aio app add extensions
176
186
  ```
177
187
 
188
+ _See code: [src/commands/app/add/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/extension.ts)_
189
+
178
190
  ## `aio app add service`
179
191
 
180
192
  Subscribe to Services in the current Workspace
@@ -197,6 +209,8 @@ ALIASES
197
209
  $ aio app add services
198
210
  ```
199
211
 
212
+ _See code: [src/commands/app/add/service.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/service.ts)_
213
+
200
214
  ## `aio app add web-assets`
201
215
 
202
216
  Add web assets support
@@ -216,6 +230,8 @@ DESCRIPTION
216
230
  Add web assets support
217
231
  ```
218
232
 
233
+ _See code: [src/commands/app/add/web-assets.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/web-assets.ts)_
234
+
219
235
  ## `aio app build`
220
236
 
221
237
  Build an Adobe I/O App
@@ -243,6 +259,8 @@ DESCRIPTION
243
259
  This will always force a rebuild unless --no-force-build is set.
244
260
  ```
245
261
 
262
+ _See code: [src/commands/app/build.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/build.ts)_
263
+
246
264
  ## `aio app create [PATH]`
247
265
 
248
266
  Create a new Adobe I/O App with default parameters
@@ -263,6 +281,8 @@ DESCRIPTION
263
281
  Create a new Adobe I/O App with default parameters
264
282
  ```
265
283
 
284
+ _See code: [src/commands/app/create.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/create.ts)_
285
+
266
286
  ## `aio app delete`
267
287
 
268
288
  Delete a component from an existing Adobe I/O App
@@ -279,6 +299,8 @@ DESCRIPTION
279
299
  Delete a component from an existing Adobe I/O App
280
300
  ```
281
301
 
302
+ _See code: [src/commands/app/delete/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/index.ts)_
303
+
282
304
  ## `aio app delete action [ACTION-NAME]`
283
305
 
284
306
  Delete existing actions
@@ -303,6 +325,8 @@ ALIASES
303
325
  $ aio app delete actions
304
326
  ```
305
327
 
328
+ _See code: [src/commands/app/delete/action.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/action.ts)_
329
+
306
330
  ## `aio app delete ci`
307
331
 
308
332
  Delete existing CI files
@@ -320,6 +344,8 @@ DESCRIPTION
320
344
  Delete existing CI files
321
345
  ```
322
346
 
347
+ _See code: [src/commands/app/delete/ci.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/ci.ts)_
348
+
323
349
  ## `aio app delete event [EVENT-ACTION-NAME]`
324
350
 
325
351
  Delete existing Adobe I/O Events actions
@@ -344,6 +370,8 @@ ALIASES
344
370
  $ aio app delete events
345
371
  ```
346
372
 
373
+ _See code: [src/commands/app/delete/event.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/event.ts)_
374
+
347
375
  ## `aio app delete extension`
348
376
 
349
377
  Delete existing extensions
@@ -368,6 +396,8 @@ ALIASES
368
396
  $ aio app delete extensions
369
397
  ```
370
398
 
399
+ _See code: [src/commands/app/delete/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/extension.ts)_
400
+
371
401
  ## `aio app delete service`
372
402
 
373
403
  Delete Services in the current Workspace
@@ -390,6 +420,8 @@ ALIASES
390
420
  $ aio app delete services
391
421
  ```
392
422
 
423
+ _See code: [src/commands/app/delete/service.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/service.ts)_
424
+
393
425
  ## `aio app delete web-assets`
394
426
 
395
427
  Delete existing web assets
@@ -407,6 +439,8 @@ DESCRIPTION
407
439
  Delete existing web assets
408
440
  ```
409
441
 
442
+ _See code: [src/commands/app/delete/web-assets.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/web-assets.ts)_
443
+
410
444
  ## `aio app deploy`
411
445
 
412
446
  Build and deploy an Adobe I/O App
@@ -445,6 +479,8 @@ DESCRIPTION
445
479
  This will always force a rebuild unless --no-force-build is set.
446
480
  ```
447
481
 
482
+ _See code: [src/commands/app/deploy.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/deploy.ts)_
483
+
448
484
  ## `aio app get-url [ACTION]`
449
485
 
450
486
  Get action URLs
@@ -466,6 +502,8 @@ DESCRIPTION
466
502
  Get action URLs
467
503
  ```
468
504
 
505
+ _See code: [src/commands/app/get-url.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/get-url.ts)_
506
+
469
507
  ## `aio app info`
470
508
 
471
509
  Display settings/configuration in use by an Adobe I/O App
@@ -486,6 +524,8 @@ DESCRIPTION
486
524
  Display settings/configuration in use by an Adobe I/O App
487
525
  ```
488
526
 
527
+ _See code: [src/commands/app/info.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/info.ts)_
528
+
489
529
  ## `aio app init [PATH]`
490
530
 
491
531
  Create a new Adobe I/O App
@@ -518,6 +558,8 @@ DESCRIPTION
518
558
  Create a new Adobe I/O App
519
559
  ```
520
560
 
561
+ _See code: [src/commands/app/init.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/init.ts)_
562
+
521
563
  ## `aio app list`
522
564
 
523
565
  List components for Adobe I/O App
@@ -534,6 +576,8 @@ DESCRIPTION
534
576
  List components for Adobe I/O App
535
577
  ```
536
578
 
579
+ _See code: [src/commands/app/list/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/list/index.ts)_
580
+
537
581
  ## `aio app list extension`
538
582
 
539
583
  List implemented extensions
@@ -557,6 +601,8 @@ ALIASES
557
601
  $ aio app list extensions
558
602
  ```
559
603
 
604
+ _See code: [src/commands/app/list/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/list/extension.ts)_
605
+
560
606
  ## `aio app logs`
561
607
 
562
608
  Fetch logs for an Adobe I/O App
@@ -579,6 +625,8 @@ DESCRIPTION
579
625
  Fetch logs for an Adobe I/O App
580
626
  ```
581
627
 
628
+ _See code: [src/commands/app/logs.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/logs.ts)_
629
+
582
630
  ## `aio app run`
583
631
 
584
632
  Run an Adobe I/O App
@@ -600,6 +648,8 @@ DESCRIPTION
600
648
  Run an Adobe I/O App
601
649
  ```
602
650
 
651
+ _See code: [src/commands/app/run.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/run.ts)_
652
+
603
653
  ## `aio app test`
604
654
 
605
655
  Run tests for an Adobe I/O App
@@ -626,6 +676,8 @@ DESCRIPTION
626
676
  If the extension has a hook called 'test' in its 'ext.config.yaml', the script specified will be run instead.
627
677
  ```
628
678
 
679
+ _See code: [src/commands/app/test.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/test.ts)_
680
+
629
681
  ## `aio app undeploy`
630
682
 
631
683
  Undeploys an Adobe I/O App
@@ -649,6 +701,8 @@ DESCRIPTION
649
701
  Undeploys an Adobe I/O App
650
702
  ```
651
703
 
704
+ _See code: [src/commands/app/undeploy.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/undeploy.ts)_
705
+
652
706
  ## `aio app use [CONFIG_FILE_PATH]`
653
707
 
654
708
  Import an Adobe Developer Console configuration file.
@@ -692,6 +746,8 @@ DESCRIPTION
692
746
  To set these global config values, see the help text for 'aio console --help'.
693
747
 
694
748
  To download the configuration file for your project, select the 'Download' button in the toolbar of your project's
695
- page in https://console.adobe.io
749
+ page in https://developer.adobe.com/console/
696
750
  ```
751
+
752
+ _See code: [src/commands/app/use.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/use.ts)_
697
753
  <!-- commandsstop -->
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "10.4.0",
2
+ "version": "10.6.0",
3
3
  "commands": {
4
4
  "app:build": {
5
5
  "id": "app:build",
@@ -874,7 +874,7 @@
874
874
  },
875
875
  "app:use": {
876
876
  "id": "app:use",
877
- "description": "Import an Adobe Developer Console configuration file.\n\nIf the optional configuration file is not set, this command will retrieve the console org, project, and workspace settings from the global config.\n\nTo set these global config values, see the help text for 'aio console --help'.\n\nTo download the configuration file for your project, select the 'Download' button in the toolbar of your project's page in https://console.adobe.io\n",
877
+ "description": "Import an Adobe Developer Console configuration file.\n\nIf the optional configuration file is not set, this command will retrieve the console org, project, and workspace settings from the global config.\n\nTo set these global config values, see the help text for 'aio console --help'.\n\nTo download the configuration file for your project, select the 'Download' button in the toolbar of your project's page in https://developer.adobe.com/console/\n",
878
878
  "strict": true,
879
879
  "pluginName": "@adobe/aio-cli-plugin-app",
880
880
  "pluginAlias": "@adobe/aio-cli-plugin-app",
@@ -1104,8 +1104,14 @@
1104
1104
  "name": "extension",
1105
1105
  "type": "option",
1106
1106
  "char": "e",
1107
- "description": "Add actions to a specific extension",
1107
+ "description": "Add events to a specific extension",
1108
1108
  "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
1109
1115
  }
1110
1116
  },
1111
1117
  "args": {}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@adobe/aio-cli-plugin-app",
3
3
  "description": "Create, Build and Deploy Adobe I/O Applications",
4
- "version": "10.4.0",
4
+ "version": "10.6.0",
5
5
  "author": "Adobe Inc.",
6
6
  "bugs": "https://github.com/adobe/aio-cli-plugin-app/issues",
7
7
  "dependencies": {
8
- "@adobe/aio-cli-lib-app-config": "^1.0.1",
8
+ "@adobe/aio-cli-lib-app-config": "^1.1.0",
9
9
  "@adobe/aio-cli-lib-console": "^4.1.0",
10
- "@adobe/aio-lib-core-config": "^3.0.0",
10
+ "@adobe/aio-lib-core-config": "^4.0.0",
11
11
  "@adobe/aio-lib-core-logging": "^2.0.0",
12
12
  "@adobe/aio-lib-core-networking": "^4.1.0",
13
13
  "@adobe/aio-lib-env": "^2.0.0",
@@ -16,9 +16,9 @@
16
16
  "@adobe/aio-lib-templates": "^2.2.0",
17
17
  "@adobe/aio-lib-web": "^6.1.0",
18
18
  "@adobe/generator-aio-app": "^5.1.0",
19
- "@adobe/generator-app-common-lib": "^0.3.3",
19
+ "@adobe/generator-app-common-lib": "^0.4.0",
20
20
  "@adobe/inquirer-table-checkbox": "^1.2.0",
21
- "@oclif/core": "^1.15.0",
21
+ "@oclif/core": "^2.11.6",
22
22
  "@parcel/core": "^2.7.0",
23
23
  "@parcel/reporter-cli": "^2.7.0",
24
24
  "ajv": "^8",
@@ -38,7 +38,9 @@
38
38
  "inquirer": "^8",
39
39
  "js-yaml": "^4.1.0",
40
40
  "lodash.clonedeep": "^4.5.0",
41
+ "node-abort-controller": "^3.1.1",
41
42
  "node-fetch": "^2.6.7",
43
+ "open": "^8.4.2",
42
44
  "ora": "^5",
43
45
  "pure-http": "^3",
44
46
  "serve-static": "^1.14.1",
@@ -50,23 +52,24 @@
50
52
  },
51
53
  "devDependencies": {
52
54
  "@adobe/aio-lib-test-proxy": "^1.0.0",
53
- "@adobe/eslint-config-aio-lib-config": "^2.0.0",
55
+ "@adobe/eslint-config-aio-lib-config": "^2.0.1",
54
56
  "@types/jest": "^29",
55
57
  "babel-runtime": "^6.26.0",
56
58
  "core-js": "^3",
57
59
  "eol": "^0.9.1",
58
- "eslint": "^8.22.0",
59
- "eslint-config-standard": "^17",
60
- "eslint-plugin-import": "^2.26.0",
61
- "eslint-plugin-jest": "^23",
62
- "eslint-plugin-jsdoc": "^37",
63
- "eslint-plugin-n": "^15.2.5",
60
+ "eslint": "^8.46.0",
61
+ "eslint-config-standard": "^17.1.0",
62
+ "eslint-plugin-import": "^2.28.0",
63
+ "eslint-plugin-jest": "^27.2.3",
64
+ "eslint-plugin-jsdoc": "^42.0.0",
65
+ "eslint-plugin-n": "^16.0.1",
64
66
  "eslint-plugin-node": "^11.1.0",
65
- "eslint-plugin-promise": "^6.0.0",
67
+ "eslint-plugin-promise": "^6.1.1",
66
68
  "jest": "^29.5.0",
67
69
  "nock": "^13.2.9",
68
70
  "oclif": "^3.2.0",
69
- "stdout-stderr": "^0.1.9"
71
+ "stdout-stderr": "^0.1.9",
72
+ "typescript": "^5.1.6"
70
73
  },
71
74
  "engines": {
72
75
  "node": "^14.18 || ^16.13 || >=18"
@@ -9,6 +9,10 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
9
9
  OF ANY KIND, either express or implied. See the License for the specific language
10
10
  governing permissions and limitations under the License.
11
11
  */
12
+
13
+ const { AbortController } = require('node-abort-controller')
14
+ global.AbortController = AbortController
15
+
12
16
  const { Command, Flags } = require('@oclif/core')
13
17
  const chalk = require('chalk')
14
18
  const coreConfig = require('@adobe/aio-lib-core-config')
@@ -114,6 +118,22 @@ class BaseCommand extends Command {
114
118
  return configData
115
119
  }
116
120
 
121
+ getEventsConfigFile (implName) {
122
+ let configKey
123
+ if (implName === APPLICATION_CONFIG_KEY) {
124
+ configKey = APPLICATION_CONFIG_KEY
125
+ } else {
126
+ configKey = `${EXTENSIONS_CONFIG_KEY}.${implName}`
127
+ }
128
+ let configData = this.getConfigFileForKey(`${configKey}.events`)
129
+ if (!configData.file) {
130
+ // first events manifest is not defined
131
+ configData = this.getConfigFileForKey(`${configKey}`)
132
+ configData.key = configData.key + '.events'
133
+ }
134
+ return configData
135
+ }
136
+
117
137
  getConfigFileForKey (fullKey) {
118
138
  // NOTE: the index returns undefined if the key is loaded from a legacy configuration file
119
139
  const fullConfig = this.getFullConfig()
@@ -176,6 +196,6 @@ BaseCommand.flags = {
176
196
  version: Flags.boolean({ description: 'Show version' })
177
197
  }
178
198
 
179
- BaseCommand.args = []
199
+ BaseCommand.args = {}
180
200
 
181
201
  module.exports = BaseCommand
@@ -138,6 +138,6 @@ AddActionCommand.flags = {
138
138
  }
139
139
 
140
140
  AddActionCommand.aliases = ['app:add:actions']
141
- AddActionCommand.args = []
141
+ AddActionCommand.args = {}
142
142
 
143
143
  module.exports = AddActionCommand
@@ -38,6 +38,6 @@ AddCICommand.flags = {
38
38
  ...BaseCommand.flags
39
39
  }
40
40
 
41
- AddCICommand.args = []
41
+ AddCICommand.args = {}
42
42
 
43
43
  module.exports = AddCICommand
@@ -10,14 +10,16 @@ governing permissions and limitations under the License.
10
10
  */
11
11
 
12
12
  const AddCommand = require('../../../AddCommand')
13
+ const TemplatesCommand = require('../../../TemplatesCommand')
13
14
  const yeoman = require('yeoman-environment')
14
15
  const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:add:event', { provider: 'debug' })
15
16
  const { Flags } = require('@oclif/core')
16
17
  const ora = require('ora')
17
18
  const path = require('path')
18
19
  const generators = require('@adobe/generator-aio-app')
20
+ const TemplateRegistryAPI = require('@adobe/aio-lib-templates')
19
21
 
20
- class AddEventCommand extends AddCommand {
22
+ class AddEventCommand extends TemplatesCommand {
21
23
  async run () {
22
24
  const { flags } = await this.parse(AddEventCommand)
23
25
 
@@ -29,27 +31,63 @@ class AddEventCommand extends AddCommand {
29
31
  if (entries.length > 1) {
30
32
  this.error('Please use the \'-e\' flag to specify to which implementation you want to add events to.')
31
33
  }
34
+
32
35
  const configName = entries[0][0]
33
36
  const config = entries[0][1]
34
37
  const actionFolder = path.relative(config.root, config.actions.src)
35
- const configData = this.getRuntimeManifestConfigFile(configName)
38
+ const runtimeManifestData = this.getRuntimeManifestConfigFile(configName)
39
+
40
+ const templateOptions = {
41
+ 'skip-prompt': false,
42
+ 'action-folder': actionFolder,
43
+ 'config-path': runtimeManifestData.file,
44
+ 'full-key-to-manifest': runtimeManifestData.key
45
+ }
36
46
 
37
- const env = yeoman.createEnv()
38
- // by default yeoman runs the install, we control installation from the app plugin
39
- env.options = { skipInstall: true }
40
- const eventsGen = env.instantiate(generators['add-events'], {
41
- options: {
42
- 'skip-prompt': flags.yes,
43
- 'action-folder': actionFolder,
44
- 'config-path': configData.file,
45
- 'full-key-to-manifest': configData.key,
46
- // force overwrites, no useless prompts, this is a feature exposed by yeoman itself
47
- force: true
47
+ if (flags['experimental-allow-events-templates']) {
48
+ const eventsData = this.getEventsConfigFile(configName)
49
+ templateOptions['full-key-to-events-manifest'] = eventsData.key
50
+ const [searchCriteria, orderByCriteria] = await this.getSearchCriteria()
51
+ const templates = await this.selectTemplates(searchCriteria, orderByCriteria)
52
+ if (templates.length === 0) {
53
+ this.error('No events templates were chosen to be installed.')
54
+ } else {
55
+ await this.installTemplates({
56
+ useDefaultValues: flags.yes,
57
+ installNpm: flags.install,
58
+ templateOptions,
59
+ templates
60
+ })
48
61
  }
49
- })
50
- await env.runGenerator(eventsGen)
62
+ // by default yeoman runs the install, we control installation from the app plugin
63
+ } else {
64
+ templateOptions['skip-prompt'] = flags.yes
65
+ templateOptions.force = true
66
+ const env = yeoman.createEnv()
67
+ env.options = { skipInstall: true }
68
+ const eventsGen = env.instantiate(generators['add-events'], {
69
+ options: templateOptions
70
+ })
71
+ await env.runGenerator(eventsGen)
51
72
 
52
- await this.runInstallPackages(flags, spinner)
73
+ await this.runInstallPackages(flags, spinner)
74
+ }
75
+ }
76
+
77
+ async getSearchCriteria () {
78
+ const TEMPLATE_CATEGORIES = ['events', 'helper-template']
79
+ const searchCriteria = {
80
+ [TemplateRegistryAPI.SEARCH_CRITERIA_STATUSES]: TemplateRegistryAPI.TEMPLATE_STATUS_APPROVED,
81
+ [TemplateRegistryAPI.SEARCH_CRITERIA_CATEGORIES]: TEMPLATE_CATEGORIES,
82
+ [TemplateRegistryAPI.SEARCH_CRITERIA_EXTENSIONS]: TemplateRegistryAPI.SEARCH_CRITERIA_FILTER_NONE
83
+ }
84
+
85
+ // an optional OrderBy Criteria object
86
+ const orderByCriteria = {
87
+ [TemplateRegistryAPI.ORDER_BY_CRITERIA_PUBLISH_DATE]: TemplateRegistryAPI.ORDER_BY_CRITERIA_SORT_DESC
88
+ }
89
+
90
+ return [searchCriteria, orderByCriteria]
53
91
  }
54
92
  }
55
93
 
@@ -63,15 +101,19 @@ AddEventCommand.flags = {
63
101
  char: 'y'
64
102
  }),
65
103
  extension: Flags.string({
66
- description: 'Add actions to a specific extension',
104
+ description: 'Add events to a specific extension',
67
105
  char: 'e',
68
106
  multiple: false,
69
107
  parse: str => [str]
70
108
  }),
109
+ 'experimental-allow-events-templates': Flags.boolean({
110
+ description: 'Feature flag to enable events templates. NOTE: skip-prompt will have no effect if this flag is enabled.',
111
+ default: false
112
+ }),
71
113
  ...AddCommand.flags
72
114
  }
73
115
 
74
116
  AddEventCommand.aliases = ['app:add:events']
75
- AddEventCommand.args = []
117
+ AddEventCommand.args = {}
76
118
 
77
119
  module.exports = AddEventCommand
@@ -76,6 +76,6 @@ AddExtensionCommand.flags = {
76
76
  }
77
77
 
78
78
  AddExtensionCommand.aliases = ['app:add:ext', 'app:add:extensions']
79
- AddExtensionCommand.args = []
79
+ AddExtensionCommand.args = {}
80
80
 
81
81
  module.exports = AddExtensionCommand
@@ -21,6 +21,6 @@ class AddCommand extends BaseCommand {
21
21
 
22
22
  AddCommand.description = 'Add a new component to an existing Adobe I/O App'
23
23
 
24
- AddCommand.args = []
24
+ AddCommand.args = {}
25
25
 
26
26
  module.exports = AddCommand
@@ -171,6 +171,6 @@ AddServiceCommand.flags = {
171
171
  }
172
172
 
173
173
  AddServiceCommand.aliases = ['app:add:services']
174
- AddServiceCommand.args = []
174
+ AddServiceCommand.args = {}
175
175
 
176
176
  module.exports = AddServiceCommand
@@ -75,6 +75,6 @@ AddWebAssetsCommand.flags = {
75
75
  ...TemplatesCommand.flags
76
76
  }
77
77
 
78
- AddWebAssetsCommand.args = []
78
+ AddWebAssetsCommand.args = {}
79
79
 
80
80
  module.exports = AddWebAssetsCommand
@@ -11,7 +11,7 @@ governing permissions and limitations under the License.
11
11
 
12
12
  const BaseCommand = require('../../BaseCommand')
13
13
  const InitCommand = require('./init')
14
- const { Flags } = require('@oclif/core')
14
+ const { Flags, Args } = require('@oclif/core')
15
15
 
16
16
  class Create extends BaseCommand {
17
17
  async run () {
@@ -35,12 +35,12 @@ Create.flags = {
35
35
  })
36
36
  }
37
37
 
38
- Create.args = [
38
+ Create.args =
39
39
  {
40
- name: 'path',
41
- description: 'Path to the app directory',
42
- default: '.'
40
+ path: Args.string({
41
+ description: 'Path to the app directory',
42
+ default: '.'
43
+ })
43
44
  }
44
- ]
45
45
 
46
46
  module.exports = Create
@@ -12,7 +12,7 @@ governing permissions and limitations under the License.
12
12
  const BaseCommand = require('../../../BaseCommand')
13
13
  const inquirer = require('inquirer')
14
14
  const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:delete:action', { provider: 'debug' })
15
- const { Flags } = require('@oclif/core')
15
+ const { Flags, Args } = require('@oclif/core')
16
16
  const fs = require('fs-extra')
17
17
  const path = require('path')
18
18
  const chalk = require('chalk')
@@ -153,14 +153,14 @@ DeleteActionCommand.flags = {
153
153
  ...BaseCommand.flags
154
154
  }
155
155
 
156
- DeleteActionCommand.args = [
156
+ DeleteActionCommand.args =
157
157
  {
158
- name: 'action-name',
159
- description: 'Action `pkg/name` to delete, you can specify multiple actions via a comma separated list',
160
- default: '',
161
- required: false
158
+ 'action-name': Args.string({
159
+ description: 'Action `pkg/name` to delete, you can specify multiple actions via a comma separated list',
160
+ default: '',
161
+ required: false
162
+ })
162
163
  }
163
- ]
164
164
 
165
165
  DeleteActionCommand.aliases = ['app:delete:actions']
166
166
 
@@ -60,6 +60,6 @@ DeleteCICommand.flags = {
60
60
  ...BaseCommand.flags
61
61
  }
62
62
 
63
- DeleteCICommand.args = []
63
+ DeleteCICommand.args = {}
64
64
 
65
65
  module.exports = DeleteCICommand