@adobe/aio-cli-plugin-app 8.6.1 → 9.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.
Files changed (44) hide show
  1. package/README.md +687 -256
  2. package/bin/openwhisk-standalone-config/get-runtimes.js +52 -0
  3. package/bin/openwhisk-standalone-config/runtimes.json +16 -8
  4. package/oclif.manifest.json +1 -1
  5. package/package.json +46 -47
  6. package/schema/config.schema.json +12 -3
  7. package/src/AddCommand.js +3 -3
  8. package/src/BaseCommand.js +5 -6
  9. package/src/commands/app/add/action.js +8 -8
  10. package/src/commands/app/add/ci.js +4 -5
  11. package/src/commands/app/add/event.js +7 -7
  12. package/src/commands/app/add/extension.js +7 -7
  13. package/src/commands/app/add/index.js +3 -3
  14. package/src/commands/app/add/service.js +3 -3
  15. package/src/commands/app/add/web-assets.js +8 -8
  16. package/src/commands/app/build.js +14 -14
  17. package/src/commands/app/config/get/index.js +3 -3
  18. package/src/commands/app/config/index.js +3 -3
  19. package/src/commands/app/config/set/index.js +3 -3
  20. package/src/commands/app/create.js +3 -3
  21. package/src/commands/app/delete/action.js +3 -3
  22. package/src/commands/app/delete/ci.js +6 -6
  23. package/src/commands/app/delete/event.js +3 -3
  24. package/src/commands/app/delete/extension.js +6 -6
  25. package/src/commands/app/delete/index.js +3 -3
  26. package/src/commands/app/delete/web-assets.js +3 -3
  27. package/src/commands/app/deploy.js +19 -21
  28. package/src/commands/app/get-url.js +8 -8
  29. package/src/commands/app/index.js +3 -3
  30. package/src/commands/app/info.js +7 -7
  31. package/src/commands/app/init.js +17 -16
  32. package/src/commands/app/list/extension-points.js +5 -5
  33. package/src/commands/app/list/extension.js +5 -5
  34. package/src/commands/app/list/index.js +3 -3
  35. package/src/commands/app/logs.js +9 -9
  36. package/src/commands/app/run.js +10 -11
  37. package/src/commands/app/test.js +7 -7
  38. package/src/commands/app/undeploy.js +10 -10
  39. package/src/commands/app/use.js +11 -11
  40. package/src/lib/app-helper.js +2 -2
  41. package/src/lib/build-actions.js +3 -2
  42. package/src/lib/import.js +3 -6
  43. package/src/lib/run-dev.js +4 -4
  44. package/src/lib/vscode.js +3 -3
@@ -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
  })
@@ -486,12 +486,12 @@ function atLeastOne (input) {
486
486
 
487
487
  /** @private */
488
488
  function deleteUserConfig (configData) {
489
- const phyConfig = yaml.safeLoad(fs.readFileSync(configData.file))
489
+ const phyConfig = yaml.load(fs.readFileSync(configData.file))
490
490
  const interKeys = configData.key.split('.')
491
491
  const phyActionConfigParent = interKeys.slice(0, -1).reduce((obj, k) => obj && obj[k], phyConfig)
492
492
  // like delete configFile.runtimeManifest.packages.actions.theaction
493
493
  delete phyActionConfigParent[interKeys.slice(-1)]
494
- fs.writeFileSync(configData.file, yaml.safeDump(phyConfig))
494
+ fs.writeFileSync(configData.file, yaml.dump(phyConfig))
495
495
  }
496
496
 
497
497
  /** @private */
@@ -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
  }
package/src/lib/import.js CHANGED
@@ -75,7 +75,7 @@ function loadConfigFile (fileOrBuffer) {
75
75
  }
76
76
  } else {
77
77
  try {
78
- return { values: yaml.safeLoad(contents, { json: true }), format: 'yaml' }
78
+ return { values: yaml.load(contents, { json: true }), format: 'yaml' }
79
79
  } catch (e) {
80
80
  throw new Error('Cannot parse yaml')
81
81
  }
@@ -537,11 +537,8 @@ function transformCredentials (credentials, imsOrgId) {
537
537
  }
538
538
 
539
539
  return credentials.reduce((acc, credential) => {
540
- // the json schema enforces either jwt OR oauth2 keys in a credential
541
- let value = credential.oauth2
542
- if (!value) {
543
- value = credential.jwt
544
- }
540
+ // the json schema enforces for jwt OR oauth2 OR apiKey in a credential
541
+ const value = credential.oauth2 || credential.jwt || credential.api_key
545
542
 
546
543
  const name = credential.name.replace(/ /gi, '_') // replace any spaces with underscores
547
544
  acc[name] = value
@@ -46,7 +46,7 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
46
46
  // control variables
47
47
  const hasFrontend = config.app.hasFrontend
48
48
  const withBackend = config.app.hasBackend && !skipActions
49
- const isLocal = !options.devRemote // applies only for backend
49
+ const isLocal = options.isLocal // applies only for backend
50
50
  const portToUse = parseInt(process.env.PORT) || SERVER_DEFAULT_PORT
51
51
  const uiPort = await getPort({ port: portToUse })
52
52
  if (uiPort !== portToUse) {
@@ -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...')
@@ -101,7 +101,7 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
101
101
  if (!options.skipServe) {
102
102
  const script = await utils.runScript(config.hooks['build-static'])
103
103
  if (!script) {
104
- const entryFile = config.web.src + '/index.html'
104
+ const entries = config.web.src + '/**/*.html'
105
105
  bundleOptions.serveOptions = {
106
106
  port: uiPort,
107
107
  https: bundleOptions.https
@@ -113,7 +113,7 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
113
113
  bundleOptions.additionalReporters = [
114
114
  { packageName: '@parcel/reporter-cli', resolveFrom: __filename }
115
115
  ]
116
- defaultBundler = await bundle(entryFile, config.web.distDev, bundleOptions, log)
116
+ defaultBundler = await bundle(entries, config.web.distDev, bundleOptions, log)
117
117
  }
118
118
  }
119
119
  }
package/src/lib/vscode.js CHANGED
@@ -42,14 +42,14 @@ function update (config) {
42
42
  }
43
43
 
44
44
  const env = yeoman.createEnv()
45
+ // by default yeoman runs the install, we control installation from the app plugin
46
+ env.options = { skipInstall: true }
45
47
  const gen = env.instantiate(generators['add-vscode-config'], {
46
48
  options: {
47
49
  'app-config': config,
48
50
  'env-file': config.envFile,
49
51
  'frontend-url': props.frontEndUrl,
50
- 'skip-prompt': true,
51
- // by default yeoman runs the install, we control installation from the app plugin
52
- 'skip-install': true
52
+ 'skip-prompt': true
53
53
  }
54
54
  })
55
55
  await env.runGenerator(gen)