@adobe/aio-cli-plugin-app 8.6.0 → 8.6.1-pre.2022-06-25.2ab6c018

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 (38) hide show
  1. package/README.md +685 -256
  2. package/oclif.manifest.json +1 -1
  3. package/package.json +23 -27
  4. package/src/AddCommand.js +3 -3
  5. package/src/BaseCommand.js +5 -6
  6. package/src/commands/app/add/action.js +4 -4
  7. package/src/commands/app/add/ci.js +2 -2
  8. package/src/commands/app/add/event.js +4 -4
  9. package/src/commands/app/add/extension.js +4 -4
  10. package/src/commands/app/add/index.js +3 -3
  11. package/src/commands/app/add/service.js +3 -3
  12. package/src/commands/app/add/web-assets.js +4 -4
  13. package/src/commands/app/build.js +12 -12
  14. package/src/commands/app/config/get/index.js +3 -3
  15. package/src/commands/app/config/index.js +3 -3
  16. package/src/commands/app/config/set/index.js +3 -3
  17. package/src/commands/app/create.js +3 -3
  18. package/src/commands/app/delete/action.js +3 -3
  19. package/src/commands/app/delete/ci.js +3 -3
  20. package/src/commands/app/delete/event.js +3 -3
  21. package/src/commands/app/delete/extension.js +6 -6
  22. package/src/commands/app/delete/index.js +3 -3
  23. package/src/commands/app/delete/web-assets.js +3 -3
  24. package/src/commands/app/deploy.js +19 -21
  25. package/src/commands/app/get-url.js +7 -7
  26. package/src/commands/app/index.js +3 -3
  27. package/src/commands/app/info.js +7 -7
  28. package/src/commands/app/init.js +11 -10
  29. package/src/commands/app/list/extension-points.js +4 -4
  30. package/src/commands/app/list/extension.js +4 -4
  31. package/src/commands/app/list/index.js +3 -3
  32. package/src/commands/app/logs.js +9 -9
  33. package/src/commands/app/run.js +9 -10
  34. package/src/commands/app/test.js +7 -7
  35. package/src/commands/app/undeploy.js +10 -10
  36. package/src/commands/app/use.js +11 -11
  37. package/src/lib/build-actions.js +3 -2
  38. package/src/lib/run-dev.js +1 -1
@@ -12,7 +12,7 @@ governing permissions and limitations under the License.
12
12
  const BaseCommand = require('../../../BaseCommand')
13
13
 
14
14
  const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:list:extension-points', { provider: 'debug' })
15
- const { flags } = require('@oclif/command')
15
+ const { Flags } = require('@oclif/core')
16
16
 
17
17
  const { EXTENSION_POINT_LIST } = require('../../../lib/defaults')
18
18
  const chalk = require('chalk')
@@ -20,7 +20,7 @@ const yaml = require('js-yaml')
20
20
 
21
21
  class ListExtensionPointsCommand extends BaseCommand {
22
22
  async run () {
23
- const { flags } = this.parse(ListExtensionPointsCommand)
23
+ const { flags } = await this.parse(ListExtensionPointsCommand)
24
24
  aioLogger.debug(`list all extensions points with flags: ${JSON.stringify(flags)}`)
25
25
 
26
26
  // print
@@ -45,11 +45,11 @@ ListExtensionPointsCommand.description = `List all extension points for the sele
45
45
  `
46
46
  ListExtensionPointsCommand.flags = {
47
47
  ...BaseCommand.flags,
48
- json: flags.boolean({
48
+ json: Flags.boolean({
49
49
  description: 'Output json',
50
50
  char: 'j'
51
51
  }),
52
- yml: flags.boolean({
52
+ yml: Flags.boolean({
53
53
  description: 'Output yml',
54
54
  char: 'y'
55
55
  })
@@ -12,7 +12,7 @@ governing permissions and limitations under the License.
12
12
  const BaseCommand = require('../../../BaseCommand')
13
13
 
14
14
  const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:list:extensions', { provider: 'debug' })
15
- const { flags } = require('@oclif/command')
15
+ const { Flags } = require('@oclif/core')
16
16
 
17
17
  const { EXTENSION_POINT_LIST } = require('../../../lib/defaults')
18
18
  const chalk = require('chalk')
@@ -20,7 +20,7 @@ const yaml = require('js-yaml')
20
20
 
21
21
  class ListExtensionCommand extends BaseCommand {
22
22
  async run () {
23
- const { flags } = this.parse(ListExtensionCommand)
23
+ const { flags } = await this.parse(ListExtensionCommand)
24
24
  aioLogger.debug(`list extensions with flags: ${JSON.stringify(flags)}`)
25
25
 
26
26
  const extConfig = this.getAppExtConfigs(flags)
@@ -81,11 +81,11 @@ ListExtensionCommand.description = `List implemented extensions
81
81
  `
82
82
  ListExtensionCommand.flags = {
83
83
  ...BaseCommand.flags,
84
- json: flags.boolean({
84
+ json: Flags.boolean({
85
85
  description: 'Output json',
86
86
  char: 'j'
87
87
  }),
88
- yml: flags.boolean({
88
+ yml: Flags.boolean({
89
89
  description: 'Output yml',
90
90
  char: 'y'
91
91
  })
@@ -9,13 +9,13 @@ OF ANY KIND, either express or implied. See the License for the specific languag
9
9
  governing permissions and limitations under the License.
10
10
  */
11
11
 
12
- const HHelp = require('@oclif/plugin-help').default
12
+ const { Help } = require('@oclif/core')
13
13
  const BaseCommand = require('../../../BaseCommand')
14
14
 
15
15
  class ListCommand extends BaseCommand {
16
16
  async run () {
17
- const help = new HHelp(this.config)
18
- help.showHelp(['app:list', '--help'])
17
+ const help = new Help(this.config)
18
+ await help.showHelp(['app:list', '--help'])
19
19
  }
20
20
  }
21
21
 
@@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
10
10
  governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- const { flags } = require('@oclif/command')
13
+ const { Flags } = require('@oclif/core')
14
14
  const BaseCommand = require('../../BaseCommand')
15
15
  const { wrapError } = require('../../lib/app-helper')
16
16
  const rtLib = require('@adobe/aio-lib-runtime')
@@ -35,7 +35,7 @@ class Logs extends BaseCommand {
35
35
  }
36
36
 
37
37
  async run () {
38
- const { flags } = this.parse(Logs)
38
+ const { flags } = await this.parse(Logs)
39
39
  const fullConfig = this.getFullConfig()
40
40
 
41
41
  // has any backend
@@ -95,7 +95,7 @@ class Logs extends BaseCommand {
95
95
 
96
96
  try {
97
97
  const owConfig = { ow: Object.values(fullConfig.all)[0].ow }
98
- await rtLib.printActionLogs(owConfig, this.log, flags.limit, filterActions, flags.strip, flags.poll || flags.tail || flags.watch)
98
+ await rtLib.printActionLogs(owConfig, this.log.bind(this), flags.limit, filterActions, flags.strip, flags.poll || flags.tail || flags.watch)
99
99
  } catch (error) {
100
100
  this.error(wrapError(error))
101
101
  }
@@ -107,34 +107,34 @@ Logs.description = `Fetch logs for an Adobe I/O App
107
107
 
108
108
  Logs.flags = {
109
109
  ...BaseCommand.flags,
110
- limit: flags.integer({
110
+ limit: Flags.integer({
111
111
  description: 'Limit number of activations to fetch logs from ( 1-50 )',
112
112
  default: 1,
113
113
  char: 'l'
114
114
  }),
115
- action: flags.string({
115
+ action: Flags.string({
116
116
  description: 'Fetch logs for a specific action',
117
117
  char: 'a',
118
118
  multiple: true
119
119
  }),
120
- strip: flags.boolean({
120
+ strip: Flags.boolean({
121
121
  char: 'r',
122
122
  description: 'strip timestamp information and output first line only',
123
123
  default: false
124
124
  }),
125
- tail: flags.boolean({
125
+ tail: Flags.boolean({
126
126
  description: 'Fetch logs continuously',
127
127
  char: 't',
128
128
  default: false,
129
129
  exclusive: ['watch', 'poll']
130
130
  }),
131
- watch: flags.boolean({
131
+ watch: Flags.boolean({
132
132
  description: 'Fetch logs continuously',
133
133
  default: false,
134
134
  char: 'w',
135
135
  exclusive: ['tail', 'poll']
136
136
  }),
137
- poll: flags.boolean({
137
+ poll: Flags.boolean({
138
138
  description: 'Fetch logs continuously',
139
139
  default: false,
140
140
  char: 'o',
@@ -15,9 +15,8 @@ const chalk = require('chalk')
15
15
  const fs = require('fs-extra')
16
16
  const https = require('https')
17
17
  const getPort = require('get-port')
18
- const { cli } = require('cli-ux')
19
18
 
20
- const { flags } = require('@oclif/command')
19
+ const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
21
20
  const coreConfig = require('@adobe/aio-lib-core-config')
22
21
 
23
22
  const BaseCommand = require('../../BaseCommand')
@@ -33,7 +32,7 @@ const CONFIG_KEY = 'aio-dev.dev-keys'
33
32
  class Run extends BaseCommand {
34
33
  async run () {
35
34
  // cli input
36
- const { flags } = this.parse(Run)
35
+ const { flags } = await this.parse(Run)
37
36
  // aliases
38
37
  flags.actions = flags.actions && !flags['skip-actions']
39
38
 
@@ -42,7 +41,7 @@ class Run extends BaseCommand {
42
41
  const runConfigs = this.getAppExtConfigs(flags)
43
42
  const entries = Object.entries(runConfigs)
44
43
  if (entries.length > 1) {
45
- this.error('You can only run one implementation at the time, please filter with the \'-e\' flag.')
44
+ this.error('Your app implements multiple extensions. You can only run one at the time, please select which extension to run with the \'-e\' flag.')
46
45
  }
47
46
  const name = entries[0][0]
48
47
  const config = entries[0][1]
@@ -203,31 +202,31 @@ Run.description = 'Run an Adobe I/O App'
203
202
 
204
203
  Run.flags = {
205
204
  ...BaseCommand.flags,
206
- local: flags.boolean({
205
+ local: Flags.boolean({
207
206
  description: 'Run/debug actions locally ( requires Docker running )',
208
207
  exclusive: ['skip-actions']
209
208
  }),
210
- serve: flags.boolean({
209
+ serve: Flags.boolean({
211
210
  description: '[default: true] Start frontend server (experimental)',
212
211
  default: true,
213
212
  allowNo: true
214
213
  }),
215
- 'skip-actions': flags.boolean({
214
+ 'skip-actions': Flags.boolean({
216
215
  description: '[deprecated] Please use --no-actions',
217
216
  exclusive: ['local'],
218
217
  default: false
219
218
  }),
220
- actions: flags.boolean({
219
+ actions: Flags.boolean({
221
220
  description: '[default: true] Run actions, defaults to true, to skip actions use --no-actions',
222
221
  exclusive: ['local'], // no-actions and local don't work together
223
222
  default: true,
224
223
  allowNo: true
225
224
  }),
226
- open: flags.boolean({
225
+ open: Flags.boolean({
227
226
  description: 'Open the default web browser after a successful run, only valid if your app has a front-end',
228
227
  default: false
229
228
  }),
230
- extension: flags.string({
229
+ extension: Flags.string({
231
230
  description: 'Run only a specific extension, this flag can only be specified once',
232
231
  char: 'e',
233
232
  // we do not support multiple yet
@@ -11,7 +11,7 @@ governing permissions and limitations under the License.
11
11
  */
12
12
 
13
13
  const { runScript } = require('../../lib/app-helper')
14
- const { flags } = require('@oclif/command')
14
+ const { Flags } = require('@oclif/core')
15
15
  const BaseCommand = require('../../BaseCommand')
16
16
  const chalk = require('chalk')
17
17
  const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:test', { provider: 'debug' })
@@ -19,7 +19,7 @@ const path = require('path')
19
19
 
20
20
  class Test extends BaseCommand {
21
21
  async run () {
22
- const { flags } = this.parse(Test)
22
+ const { flags } = await this.parse(Test)
23
23
  let { all, unit, e2e, action, extension } = flags
24
24
 
25
25
  // 'all' overrides the setting of either the unit or e2e flag
@@ -201,27 +201,27 @@ class Test extends BaseCommand {
201
201
  }
202
202
 
203
203
  Test.flags = {
204
- extension: flags.string({
204
+ extension: Flags.string({
205
205
  char: 'e',
206
206
  description: 'the extension(s) to test',
207
207
  exclusive: ['action'],
208
208
  multiple: true
209
209
  }),
210
- action: flags.string({
210
+ action: Flags.string({
211
211
  char: 'a',
212
212
  description: 'the action(s) to test',
213
213
  exclusive: ['extension'],
214
214
  multiple: true
215
215
  }),
216
- all: flags.boolean({
216
+ all: Flags.boolean({
217
217
  description: 'run both unit and e2e tests',
218
218
  default: false
219
219
  }),
220
- e2e: flags.boolean({
220
+ e2e: Flags.boolean({
221
221
  description: 'run e2e tests',
222
222
  default: false
223
223
  }),
224
- unit: flags.boolean({
224
+ unit: Flags.boolean({
225
225
  description: 'run unit tests',
226
226
  default: false
227
227
  })
@@ -14,7 +14,7 @@ const ora = require('ora')
14
14
  const chalk = require('chalk')
15
15
  // const path = require('path')
16
16
 
17
- const { flags } = require('@oclif/command')
17
+ const { Flags } = require('@oclif/core')
18
18
 
19
19
  const BaseCommand = require('../../BaseCommand')
20
20
  const webLib = require('@adobe/aio-lib-web')
@@ -24,7 +24,7 @@ const rtLib = require('@adobe/aio-lib-runtime')
24
24
  class Undeploy extends BaseCommand {
25
25
  async run () {
26
26
  // cli input
27
- const { flags } = this.parse(Undeploy)
27
+ const { flags } = await this.parse(Undeploy)
28
28
 
29
29
  // flags
30
30
  flags['web-assets'] = flags['web-assets'] && !flags['skip-static'] && !flags['skip-web-assets'] && !flags.action
@@ -146,36 +146,36 @@ Undeploy.description = `Undeploys an Adobe I/O App
146
146
 
147
147
  Undeploy.flags = {
148
148
  ...BaseCommand.flags,
149
- 'skip-static': flags.boolean({
149
+ 'skip-static': Flags.boolean({
150
150
  description: '[deprecated] Please use --no-web-assets'
151
151
  }),
152
- 'skip-web-assets': flags.boolean({
152
+ 'skip-web-assets': Flags.boolean({
153
153
  description: '[deprecated] Please use --no-web-assets'
154
154
  }),
155
- 'skip-actions': flags.boolean({
155
+ 'skip-actions': Flags.boolean({
156
156
  description: '[deprecated] Please use --no-actions'
157
157
  }),
158
- actions: flags.boolean({
158
+ actions: Flags.boolean({
159
159
  description: '[default: true] Undeploy actions if any',
160
160
  default: true,
161
161
  allowNo: true
162
162
  }),
163
- 'web-assets': flags.boolean({
163
+ 'web-assets': Flags.boolean({
164
164
  description: '[default: true] Undeploy web-assets if any',
165
165
  default: true,
166
166
  allowNo: true
167
167
  }),
168
- extension: flags.string({
168
+ extension: Flags.string({
169
169
  description: 'Undeploy only a specific extension, the flags can be specified multiple times',
170
170
  char: 'e',
171
171
  multiple: true
172
172
  }),
173
- unpublish: flags.boolean({
173
+ unpublish: Flags.boolean({
174
174
  description: '[default: true] Unpublish selected extension(s) from Exchange',
175
175
  allowNo: true,
176
176
  default: true
177
177
  }),
178
- 'force-unpublish': flags.boolean({
178
+ 'force-unpublish': Flags.boolean({
179
179
  description: 'Force unpublish extension(s) from Exchange, will delete all extension points',
180
180
  default: false,
181
181
  exclusive: ['unpublish'] // unpublish is excluded
@@ -11,7 +11,7 @@ governing permissions and limitations under the License.
11
11
 
12
12
  const BaseCommand = require('../../BaseCommand')
13
13
  const { CONSOLE_CONFIG_KEY, importConfigJson, loadAndValidateConfigFile } = require('../../lib/import')
14
- const { flags } = require('@oclif/command')
14
+ const { Flags } = require('@oclif/core')
15
15
  const inquirer = require('inquirer')
16
16
  const config = require('@adobe/aio-lib-core-config')
17
17
  const { EOL } = require('os')
@@ -25,7 +25,7 @@ const chalk = require('chalk')
25
25
 
26
26
  class Use extends BaseCommand {
27
27
  async run () {
28
- const { flags, args } = this.parse(Use)
28
+ const { flags, args } = await this.parse(Use)
29
29
 
30
30
  flags.workspace = flags.workspace || flags['workspace-name'] || ''
31
31
 
@@ -370,49 +370,49 @@ To download the configuration file for your project, select the 'Download' butto
370
370
 
371
371
  Use.flags = {
372
372
  ...BaseCommand.flags,
373
- overwrite: flags.boolean({
373
+ overwrite: Flags.boolean({
374
374
  description: 'Overwrite any .aio and .env files during import of the Adobe Developer Console configuration file',
375
375
  default: false,
376
376
  exclusive: ['merge']
377
377
  }),
378
- merge: flags.boolean({
378
+ merge: Flags.boolean({
379
379
  description: 'Merge any .aio and .env files during import of the Adobe Developer Console configuration file',
380
380
  default: false,
381
381
  exclusive: ['overwrite']
382
382
  }),
383
- global: flags.boolean({
383
+ global: Flags.boolean({
384
384
  description: 'Use the global Adobe Developer Console Org / Project / Workspace configuration, which can be set via `aio console` commands',
385
385
  default: false,
386
386
  char: 'g',
387
387
  exclusive: ['workspace']
388
388
  }),
389
- workspace: flags.string({
389
+ workspace: Flags.string({
390
390
  description: 'Specify the Adobe Developer Console Workspace name or Workspace id to import the configuration from',
391
391
  default: '',
392
392
  char: 'w',
393
393
  exclusive: ['global', 'workspace-name']
394
394
  }),
395
- 'confirm-new-workspace': flags.boolean({
395
+ 'confirm-new-workspace': Flags.boolean({
396
396
  description: 'Skip and confirm prompt for creating a new workspace',
397
397
  default: false
398
398
  }),
399
- 'workspace-name': flags.string({
399
+ 'workspace-name': Flags.string({
400
400
  description: '[DEPRECATED]: please use --workspace instead',
401
401
  default: '',
402
402
  char: 'w',
403
403
  exclusive: ['global', 'workspace']
404
404
  }),
405
- 'no-service-sync': flags.boolean({
405
+ 'no-service-sync': Flags.boolean({
406
406
  description: 'Skip the Service sync prompt and do not attach current Service subscriptions to the new Workspace',
407
407
  default: false,
408
408
  exclusive: ['confirm-service-sync']
409
409
  }),
410
- 'confirm-service-sync': flags.boolean({
410
+ 'confirm-service-sync': Flags.boolean({
411
411
  description: 'Skip the Service sync prompt and overwrite Service subscriptions in the new Workspace with current subscriptions',
412
412
  default: false,
413
413
  exclusive: ['no-service-sync']
414
414
  }),
415
- 'no-input': flags.boolean({
415
+ 'no-input': Flags.boolean({
416
416
  description: 'Skip user prompts by setting --no-service-sync and --merge. Requires one of config_file_path or --global or --workspace',
417
417
  default: false
418
418
  })
@@ -18,12 +18,13 @@ const { buildActions } = require('@adobe/aio-lib-runtime')
18
18
  *
19
19
  * @param {object} config see src/lib/config-loader.js
20
20
  * @param {Array<string>} filterActions add filters to deploy only specified OpenWhisk actions
21
+ * @param {boolean} [forceBuild=false] force a build (skip file changed hash check)
21
22
  */
22
- module.exports = async (config, filterActions) => {
23
+ module.exports = async (config, filterActions, forceBuild = false) => {
23
24
  utils.runScript(config.hooks['pre-app-build'])
24
25
  const script = await utils.runScript(config.hooks['build-actions'])
25
26
  if (!script) {
26
- await buildActions(config, filterActions)
27
+ await buildActions(config, filterActions, forceBuild)
27
28
  }
28
29
  utils.runScript(config.hooks['post-app-build'])
29
30
  }
@@ -80,7 +80,7 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
80
80
 
81
81
  // build and deploy actions
82
82
  log('building actions..')
83
- await buildActions(devConfig)
83
+ await buildActions(devConfig, null, true /* force build */)
84
84
 
85
85
  const { cleanup: watcherCleanup } = await actionsWatcher({ config: devConfig, isLocal, log })
86
86
  cleanup.add(() => watcherCleanup(), 'stopping action watcher...')