@adobe/aio-cli-plugin-app 9.1.0 → 9.2.0-pre.2022-09-27.805ee90c

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.
@@ -14,7 +14,6 @@ const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-
14
14
  const { Flags } = require('@oclif/core')
15
15
 
16
16
  const { atLeastOne, deleteUserConfig } = require('../../../lib/app-helper')
17
- const { implPromptChoices } = require('../../../lib/defaults')
18
17
  const chalk = require('chalk')
19
18
  const fs = require('fs-extra')
20
19
  const { EOL } = require('os')
@@ -59,16 +58,15 @@ class DeleteExtensionCommand extends BaseCommand {
59
58
  throw new Error('There are no implementations left in the project')
60
59
  }
61
60
  if (!flags.extension) {
62
- const alreadyImplementedChoices = implPromptChoices.filter(i => alreadyImplemented.includes(i.value.name))
63
61
  // prompt
64
62
  const answers = await this.prompt([{
65
63
  type: 'checkbox',
66
64
  name: 'res',
67
- message: 'Which new implementation(s) do you wish to add to the project ?',
68
- choices: alreadyImplementedChoices,
65
+ message: 'Which implementation(s) do you wish to delete from the project?',
66
+ choices: alreadyImplemented,
69
67
  validate: atLeastOne
70
68
  }])
71
- flags.extension = answers.res.map(v => v.name)
69
+ flags.extension = answers.res
72
70
  }
73
71
  return this.getAppExtConfigs(flags)
74
72
  }
@@ -110,9 +108,10 @@ DeleteExtensionCommand.flags = {
110
108
  default: false,
111
109
  char: 'y'
112
110
  }),
113
- 'skip-install': Flags.boolean({
114
- description: 'Skip npm installation after files are created',
115
- default: false
111
+ install: Flags.boolean({
112
+ description: '[default: true] Run npm installation after files are created',
113
+ default: true,
114
+ allowNo: true
116
115
  }),
117
116
  extension: Flags.string({
118
117
  description: 'Specify extensions to delete, skips selection prompt',
@@ -55,6 +55,7 @@ class Deploy extends BuildCommand {
55
55
 
56
56
  try {
57
57
  const aioConfig = this.getFullConfig().aio
58
+
58
59
  // 1. update log forwarding configuration
59
60
  // note: it is possible that .aio file does not exist, which means there is no local lg config
60
61
  if (aioConfig &&
@@ -83,7 +84,18 @@ class Deploy extends BuildCommand {
83
84
  throw error
84
85
  }
85
86
  }
86
- // 2. deploy actions and web assets for each extension
87
+
88
+ // 2. Bail if workspace is production and application status is PUBLISHED, honor force-deploy
89
+ if (aioConfig.project.workspace.name === 'Production' && !flags['force-deploy']) {
90
+ const extension = await this.getApplicationExtension(libConsoleCLI, aioConfig)
91
+ spinner.info(chalk.dim(JSON.stringify(extension)))
92
+ if (extension && extension.status === 'PUBLISHED') {
93
+ spinner.info(chalk.red('This application is published and the current workspace is Production, deployment will be skipped. You must first retract this application in Adobe Exchange to deploy updates.'))
94
+ return
95
+ }
96
+ }
97
+
98
+ // 3. deploy actions and web assets for each extension
87
99
  // Possible improvements:
88
100
  // - parallelize
89
101
  // - break into smaller pieces deploy, allowing to first deploy all actions then all web assets
@@ -93,7 +105,7 @@ class Deploy extends BuildCommand {
93
105
  await this.deploySingleConfig(k, v, flags, spinner)
94
106
  }
95
107
 
96
- // 3. deploy extension manifest
108
+ // 4. deploy extension manifest
97
109
  if (flags.publish) {
98
110
  const payload = await this.publishExtensionPoints(libConsoleCLI, deployConfigs, aioConfig, flags['force-publish'])
99
111
  this.log(chalk.blue(chalk.bold(`New Extension Point(s) in Workspace '${aioConfig.project.workspace.name}': '${Object.keys(payload.endpoints)}'`)))
@@ -249,6 +261,12 @@ class Deploy extends BuildCommand {
249
261
  newPayload = await libConsoleCLI.updateExtensionPointsWithoutOverwrites(aioConfig.project.org, aioConfig.project, aioConfig.project.workspace, payload)
250
262
  return newPayload
251
263
  }
264
+
265
+ async getApplicationExtension (libConsoleCLI, aioConfig) {
266
+ const { appId } = await libConsoleCLI.getProject(aioConfig.project.org.id, aioConfig.project.id)
267
+ const applicationExtensions = await libConsoleCLI.getApplicationExtensions(aioConfig.project.org.id, appId)
268
+ return applicationExtensions.find(extension => extension.appId === appId)
269
+ }
252
270
  }
253
271
 
254
272
  Deploy.description = `Build and deploy an Adobe I/O App
@@ -322,8 +340,12 @@ Deploy.flags = {
322
340
  default: true,
323
341
  exclusive: ['action']
324
342
  }),
343
+ 'force-deploy': Flags.boolean({
344
+ description: '[default: false] Force deploy changes, regardless of production Workspace being published in Exchange.',
345
+ default: false
346
+ }),
325
347
  'force-publish': Flags.boolean({
326
- description: 'Force publish extension(s) to Exchange, delete previously published extension points',
348
+ description: '[default: false] Force publish extension(s) to Exchange, delete previously published extension points',
327
349
  default: false,
328
350
  exclusive: ['action', 'publish'] // no-publish is excluded
329
351
  }),
@@ -9,26 +9,24 @@ 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 AddCommand = require('../../AddCommand')
12
+ const TemplatesCommand = require('../../TemplatesCommand')
13
13
  const yeoman = require('yeoman-environment')
14
14
  const path = require('path')
15
15
  const fs = require('fs-extra')
16
16
  const ora = require('ora')
17
17
  const chalk = require('chalk')
18
- // const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:init', { provider: 'debug' })
19
18
  const { Flags } = require('@oclif/core')
20
19
  const generators = require('@adobe/generator-aio-app')
20
+ const TemplateRegistryAPI = require('@adobe/aio-lib-templates')
21
+ const inquirer = require('inquirer')
21
22
  const hyperlinker = require('hyperlinker')
22
23
 
23
24
  const { loadAndValidateConfigFile, importConfigJson } = require('../../lib/import')
24
- const { atLeastOne } = require('../../lib/app-helper')
25
-
26
- const { ENTP_INT_CERTS_FOLDER, SERVICE_API_KEY_ENV, implPromptChoices } = require('../../lib/defaults')
27
- const cloneDeep = require('lodash.clonedeep')
25
+ const { SERVICE_API_KEY_ENV } = require('../../lib/defaults')
28
26
 
29
27
  const DEFAULT_WORKSPACE = 'Stage'
30
28
 
31
- class InitCommand extends AddCommand {
29
+ class InitCommand extends TemplatesCommand {
32
30
  async run () {
33
31
  const { args, flags } = await this.parse(InitCommand)
34
32
 
@@ -36,19 +34,26 @@ class InitCommand extends AddCommand {
36
34
  this.error('--no-login and --workspace flags cannot be used together.')
37
35
  }
38
36
 
37
+ // check that the template plugin has been installed
38
+ const command = await this.config.findCommand('templates:install')
39
+ if (!command) {
40
+ this.error('aio-cli plugin @adobe/aio-cli-plugin-app-templates was not found. This plugin is required to install templates.')
41
+ }
42
+
39
43
  if (flags.import) {
40
44
  // resolve to absolute path before any chdir
41
45
  flags.import = path.resolve(flags.import)
42
46
  }
43
47
 
44
- if (args.path !== '.') {
45
- const destDir = path.resolve(args.path)
48
+ const destDir = this.destDir(args)
49
+ if (destDir !== '.') {
46
50
  fs.ensureDirSync(destDir)
47
51
  process.chdir(destDir)
48
52
  }
49
53
 
50
54
  const spinner = ora()
51
- if (flags.import || !flags.login) {
55
+ const noLogin = flags.import || !flags.login
56
+ if (noLogin) {
52
57
  // import a console config - no login required!
53
58
  await this.initNoLogin(flags)
54
59
  } else {
@@ -60,7 +65,32 @@ class InitCommand extends AddCommand {
60
65
  await this.runInstallPackages(flags, spinner)
61
66
 
62
67
  this.log(chalk.bold(chalk.green('✔ App initialization finished!')))
63
- this.log('> Tip: you can add more actions, web-assets and events to your project via the `aio app add` commands')
68
+ this.log(`> Tip: you can add more actions, web-assets and events to your project via the '${this.config.bin} app add' commands`)
69
+
70
+ if (noLogin) {
71
+ this.log(`> Run '${this.config.bin} templates info --required-services' to list the required services for the installed templates`)
72
+ }
73
+ }
74
+
75
+ getInitialGenerators (flags) {
76
+ // TODO read from config to override
77
+ const initialGenerators = ['base-app', 'add-ci']
78
+
79
+ if (flags['standalone-app']) {
80
+ initialGenerators.push('application')
81
+ }
82
+
83
+ return initialGenerators
84
+ }
85
+
86
+ /** @private */
87
+ destDir (args) {
88
+ let destDir = '.'
89
+ if (args.path !== '.') {
90
+ destDir = path.resolve(args.path)
91
+ }
92
+
93
+ return destDir
64
94
  }
65
95
 
66
96
  /** @private */
@@ -72,24 +102,24 @@ class InitCommand extends AddCommand {
72
102
  this.log(chalk.green(`Loaded Adobe Developer Console configuration file for the Project '${consoleConfig.project.title}' in the Organization '${consoleConfig.project.org.name}'`))
73
103
  }
74
104
 
75
- // 2. prompt for extension points to be implemented
76
- const extensionPoints = await this.selectExtensionPoints(flags)
105
+ // 2. prompt for templates to be installed
106
+ const templates = await this.getTemplatesForFlags(flags)
77
107
 
78
- // 3. run extension point code generators
108
+ // 3. run base code generators
79
109
  const projectName = (consoleConfig && consoleConfig.project.name) || path.basename(process.cwd())
80
- await this.runCodeGenerators(flags, extensionPoints, projectName)
110
+ await this.runCodeGenerators(this.getInitialGenerators(flags), flags.yes, projectName)
111
+
112
+ // 4. install templates
113
+ await this.installTemplates({
114
+ useDefaultValues: flags.yes,
115
+ installNpm: flags.install,
116
+ templates
117
+ })
81
118
 
82
- // 4. import config - if any
119
+ // 5. import config - if any
83
120
  if (flags.import) {
84
121
  await this.importConsoleConfig(consoleConfig)
85
122
  }
86
-
87
- // 5. This flow supports non logged in users so we can't now for sure if the project has
88
- // required services installed. So we output a note on required services instead.
89
- const requiredServices = this.getAllRequiredServicesFromExtPoints(extensionPoints)
90
- if (requiredServices.length > 0) {
91
- this.log(chalk.bold(`Please ensure the following service(s) are enabled in the Organization and added to the Console Workspace: '${requiredServices}'`))
92
- }
93
123
  }
94
124
 
95
125
  async initWithLogin (flags) {
@@ -104,31 +134,56 @@ class InitCommand extends AddCommand {
104
134
  const project = await this.selectOrCreateConsoleProject(consoleCLI, org)
105
135
  // 4. retrieve workspace details, defaults to Stage
106
136
  const workspace = await this.retrieveWorkspaceFromName(consoleCLI, org, project, flags)
107
- // 5. ask for exensionPoints, only allow selection for extensions that have services enabled in Org
108
- const extensionPoints = await this.selectExtensionPoints(flags, orgSupportedServices)
109
- // 6. add any required services to Workspace
110
- const requiredServices = this.getAllRequiredServicesFromExtPoints(extensionPoints)
111
- await this.addServices(
112
- consoleCLI,
113
- org,
114
- project,
115
- workspace,
116
- orgSupportedServices,
117
- requiredServices
118
- )
119
137
 
120
- // 7. download workspace config
138
+ // 5. get list of templates to install
139
+ const templates = await this.getTemplatesForFlags(flags, orgSupportedServices)
140
+
141
+ // 6. download workspace config
121
142
  const consoleConfig = await consoleCLI.getWorkspaceConfig(org.id, project.id, workspace.id, orgSupportedServices)
122
143
 
123
- // 8. run code generators
124
- await this.runCodeGenerators(flags, extensionPoints, consoleConfig.project.name)
144
+ // 7. run base code generators
145
+ await this.runCodeGenerators(this.getInitialGenerators(flags), flags.yes, consoleConfig.project.name)
125
146
 
126
- // 9. import config
147
+ // 8. import config
127
148
  await this.importConsoleConfig(consoleConfig)
128
149
 
150
+ // 9. install templates
151
+ await this.installTemplates({
152
+ useDefaultValues: flags.yes,
153
+ installNpm: flags.install,
154
+ templates
155
+ })
156
+
129
157
  this.log(chalk.blue(chalk.bold(`Project initialized for Workspace ${workspace.name}, you can run 'aio app use -w <workspace>' to switch workspace.`)))
130
158
  }
131
159
 
160
+ async getTemplatesForFlags (flags, orgSupportedServices = null) {
161
+ if (flags.template) {
162
+ return flags.template
163
+ } else if (flags.extension) {
164
+ const { notFound, templates: extensionTemplates } = await this.getTemplatesByExtensionPointIds(flags.extension)
165
+ if (notFound.length > 0) {
166
+ this.error(`Extension(s) '${notFound.join(', ')}' not found in the Template Registry.`)
167
+ }
168
+ return extensionTemplates.map(t => t.name)
169
+ } else if (!flags['standalone-app']) {
170
+ const noLogin = flags.import || !flags.login
171
+ let [searchCriteria, orderByCriteria] = await this.getSearchCriteria(orgSupportedServices)
172
+ if (noLogin) {
173
+ searchCriteria = {
174
+ [TemplateRegistryAPI.SEARCH_CRITERIA_STATUSES]: TemplateRegistryAPI.TEMPLATE_STATUS_APPROVED,
175
+ [TemplateRegistryAPI.SEARCH_CRITERIA_CATEGORIES]: TemplateRegistryAPI.SEARCH_CRITERIA_FILTER_NOT + 'helper-template'
176
+ }
177
+ orderByCriteria = {
178
+ [TemplateRegistryAPI.ORDER_BY_CRITERIA_PUBLISH_DATE]: TemplateRegistryAPI.ORDER_BY_CRITERIA_SORT_DESC
179
+ }
180
+ }
181
+ return this.selectTemplates(searchCriteria, orderByCriteria)
182
+ } else {
183
+ return []
184
+ }
185
+ }
186
+
132
187
  async ensureDevTermAccepted (consoleCLI, orgId) {
133
188
  const isTermAccepted = await consoleCLI.checkDevTermsForOrg(orgId)
134
189
  if (!isTermAccepted) {
@@ -147,40 +202,65 @@ class InitCommand extends AddCommand {
147
202
  }
148
203
  }
149
204
 
150
- async selectExtensionPoints (flags, orgSupportedServices = null) {
151
- if (!flags.extensions) {
152
- return [implPromptChoices.find(i => i.value.name === 'application').value]
153
- } else if (flags.extension) {
154
- const extList = implPromptChoices.filter(i => flags.extension.indexOf(i.value.name) > -1)
155
- .map(i => i.value)
156
- if (extList.length < 1) {
157
- throw new Error(`--extension=${flags.extension} not found.`)
205
+ async getSearchCriteria (orgSupportedServices) {
206
+ const choices = [
207
+ {
208
+ name: 'All Templates',
209
+ value: 'allTemplates',
210
+ checked: true
211
+ },
212
+ {
213
+ name: 'All Extension Points',
214
+ value: 'allExtensionPoints',
215
+ checked: false
158
216
  }
159
- return extList
160
- } else {
161
- const choices = cloneDeep(implPromptChoices)
217
+ ]
218
+
219
+ if (orgSupportedServices) {
220
+ choices.push({
221
+ name: 'Only Templates Supported By My Org',
222
+ value: 'orgTemplates',
223
+ checked: false
224
+ })
225
+ }
226
+
227
+ const { components: selection } = await inquirer.prompt([
228
+ {
229
+ type: 'list',
230
+ name: 'components',
231
+ message: 'What templates do you want to search for?',
232
+ loop: false,
233
+ choices
234
+ }
235
+ ])
236
+
237
+ const searchCriteria = {
238
+ [TemplateRegistryAPI.SEARCH_CRITERIA_STATUSES]: TemplateRegistryAPI.TEMPLATE_STATUS_APPROVED,
239
+ [TemplateRegistryAPI.SEARCH_CRITERIA_CATEGORIES]: TemplateRegistryAPI.SEARCH_CRITERIA_FILTER_NOT + 'helper-template'
240
+ }
162
241
 
163
- // disable extensions that lack required services
164
- if (orgSupportedServices) {
242
+ switch (selection) {
243
+ case 'orgTemplates': {
165
244
  const supportedServiceCodes = new Set(orgSupportedServices.map(s => s.code))
166
- // filter choices
167
- choices.forEach(c => {
168
- const missingServices = c.value.requiredServices.filter(s => !supportedServiceCodes.has(s))
169
- if (missingServices.length > 0) {
170
- c.disabled = true
171
- c.name = `${c.name}: missing service(s) in Org: '${missingServices}'`
172
- }
173
- })
245
+ searchCriteria[TemplateRegistryAPI.SEARCH_CRITERIA_APIS] = Array.from(supportedServiceCodes)
174
246
  }
175
- const answers = await this.prompt([{
176
- type: 'checkbox',
177
- name: 'res',
178
- message: 'Which extension point(s) do you wish to implement ?',
179
- choices,
180
- validate: atLeastOne
181
- }])
182
- return answers.res
247
+ break
248
+ case 'allExtensionPoints':
249
+ searchCriteria[TemplateRegistryAPI.SEARCH_CRITERIA_EXTENSIONS] = TemplateRegistryAPI.SEARCH_CRITERIA_FILTER_ANY
250
+ break
251
+ case 'allTemplates':
252
+ default:
253
+ break
254
+ }
255
+
256
+ const { name: selectionLabel } = choices.find(item => item.value === selection)
257
+
258
+ // an optional OrderBy Criteria object
259
+ const orderByCriteria = {
260
+ [TemplateRegistryAPI.ORDER_BY_CRITERIA_PUBLISH_DATE]: TemplateRegistryAPI.ORDER_BY_CRITERIA_SORT_DESC
183
261
  }
262
+
263
+ return [searchCriteria, orderByCriteria, selection, selectionLabel]
184
264
  }
185
265
 
186
266
  async selectConsoleOrg (consoleCLI) {
@@ -227,84 +307,20 @@ class InitCommand extends AddCommand {
227
307
  return workspace
228
308
  }
229
309
 
230
- async addServices (consoleCLI, org, project, workspace, orgSupportedServices, requiredServices) {
231
- // add required services if needed (for extension point)
232
- const currServiceProperties = await consoleCLI.getServicePropertiesFromWorkspace(
233
- org.id,
234
- project.id,
235
- workspace,
236
- orgSupportedServices
237
- )
238
- const serviceCodesToAdd = requiredServices.filter(s => !currServiceProperties.some(sp => sp.sdkCode === s))
239
- if (serviceCodesToAdd.length > 0) {
240
- const servicePropertiesToAdd = serviceCodesToAdd
241
- .map(s => {
242
- // previous check ensures orgSupportedServices has required services
243
- const orgServiceDefinition = orgSupportedServices.find(os => os.code === s)
244
- return {
245
- sdkCode: s,
246
- name: orgServiceDefinition.name,
247
- roles: orgServiceDefinition.properties.roles,
248
- // add all licenseConfigs
249
- licenseConfigs: orgServiceDefinition.properties.licenseConfigs
250
- }
251
- })
252
- await consoleCLI.subscribeToServices(
253
- org.id,
254
- project,
255
- workspace,
256
- // certDir if need to create integration
257
- path.join(this.config.dataDir, ENTP_INT_CERTS_FOLDER),
258
- // new service properties
259
- currServiceProperties.concat(servicePropertiesToAdd)
260
- )
261
- }
262
- return workspace
263
- }
264
-
265
- getAllRequiredServicesFromExtPoints (extensionPoints) {
266
- const requiredServicesWithDuplicates = extensionPoints
267
- .map(e => e.requiredServices)
268
- // flat not supported in node 10
269
- .reduce((res, arr) => res.concat(arr), [])
270
- return [...new Set(requiredServicesWithDuplicates)]
271
- }
272
-
273
- async runCodeGenerators (flags, extensionPoints, projectName) {
274
- let env = yeoman.createEnv()
275
- // by default yeoman runs the install, we control installation from the app plugin
310
+ async runCodeGenerators (generatorNames, skipPrompt, projectName) {
311
+ const env = yeoman.createEnv()
276
312
  env.options = { skipInstall: true }
277
- const initialGenerators = ['base-app', 'add-ci']
313
+
278
314
  // first run app generator that will generate the root skeleton + ci
279
- for (const generatorKey of initialGenerators) {
315
+ for (const generatorKey of generatorNames) {
280
316
  const appGen = env.instantiate(generators[generatorKey], {
281
317
  options: {
282
- 'skip-prompt': flags.yes,
318
+ 'skip-prompt': skipPrompt,
283
319
  'project-name': projectName
284
320
  }
285
321
  })
286
322
  await env.runGenerator(appGen)
287
323
  }
288
-
289
- // Creating new Yeoman env here to workaround an issue where yeoman reuses the conflicter from previous environment.
290
- // https://github.com/yeoman/environment/issues/324
291
-
292
- env = yeoman.createEnv()
293
- // by default yeoman runs the install, we control installation from the app plugin
294
- env.options = { skipInstall: true }
295
- // try to use appGen.composeWith
296
- for (let i = 0; i < extensionPoints.length; ++i) {
297
- const extGen = env.instantiate(
298
- extensionPoints[i].generator,
299
- {
300
- options: {
301
- 'skip-prompt': flags.yes,
302
- // do not prompt for overwrites
303
- force: true
304
- }
305
- })
306
- await env.runGenerator(extGen)
307
- }
308
324
  }
309
325
 
310
326
  // console config is already loaded into object
@@ -329,7 +345,7 @@ InitCommand.description = `Create a new Adobe I/O App
329
345
  `
330
346
 
331
347
  InitCommand.flags = {
332
- ...AddCommand.flags,
348
+ ...TemplatesCommand.flags,
333
349
  yes: Flags.boolean({
334
350
  description: 'Skip questions, and use all default values',
335
351
  default: false,
@@ -344,16 +360,21 @@ InitCommand.flags = {
344
360
  default: true,
345
361
  allowNo: true
346
362
  }),
347
- extensions: Flags.boolean({
348
- description: 'Use --no-extensions to create a blank application that does not integrate with Exchange',
349
- default: true,
350
- allowNo: true
351
- }),
352
363
  extension: Flags.string({
353
364
  description: 'Extension point(s) to implement',
354
365
  char: 'e',
355
366
  multiple: true,
356
- exclusive: ['extensions']
367
+ exclusive: ['template']
368
+ }),
369
+ 'standalone-app': Flags.boolean({
370
+ description: 'Create a stand-alone application',
371
+ default: false,
372
+ exclusive: ['template']
373
+ }),
374
+ template: Flags.string({
375
+ description: 'Specify a link to a template that will be installed',
376
+ char: 't',
377
+ multiple: true
357
378
  }),
358
379
  workspace: Flags.string({
359
380
  description: 'Specify the Adobe Developer Console Workspace to init from, defaults to Stage',
@@ -14,7 +14,6 @@ const BaseCommand = require('../../../BaseCommand')
14
14
  const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:list:extension-points', { provider: 'debug' })
15
15
  const { Flags } = require('@oclif/core')
16
16
 
17
- const { EXTENSION_POINT_LIST } = require('../../../lib/defaults')
18
17
  const chalk = require('chalk')
19
18
  const yaml = require('js-yaml')
20
19
 
@@ -23,17 +22,28 @@ class ListExtensionPointsCommand extends BaseCommand {
23
22
  const { flags } = await this.parse(ListExtensionPointsCommand)
24
23
  aioLogger.debug(`list all extensions points with flags: ${JSON.stringify(flags)}`)
25
24
 
25
+ const extConfig = this.getAppExtConfigs(flags)
26
+ const extPointList = {}
27
+
28
+ Object.keys(extConfig).forEach(name => {
29
+ if (name !== 'application') {
30
+ extPointList[name] = {
31
+ operations: Object.keys(extConfig[name].operations)
32
+ }
33
+ }
34
+ })
35
+
26
36
  // print
27
37
  if (flags.json) {
28
- this.log(JSON.stringify(EXTENSION_POINT_LIST))
38
+ this.log(JSON.stringify(extPointList))
29
39
  } else if (flags.yml) {
30
- this.log(yaml.dump(EXTENSION_POINT_LIST))
40
+ this.log(yaml.dump(extPointList))
31
41
  } else {
32
42
  this.log(chalk.bold('Extensions Points'))
33
- Object.keys(EXTENSION_POINT_LIST).forEach(key => {
43
+ Object.keys(extPointList).forEach(key => {
34
44
  this.log(key)
35
45
  this.log(' operations')
36
- EXTENSION_POINT_LIST[key].operations.forEach(opr => {
46
+ extPointList[key].operations.forEach(opr => {
37
47
  this.log(' -> ' + opr)
38
48
  })
39
49
  })
@@ -14,7 +14,6 @@ const BaseCommand = require('../../../BaseCommand')
14
14
  const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:list:extensions', { provider: 'debug' })
15
15
  const { Flags } = require('@oclif/core')
16
16
 
17
- const { EXTENSION_POINT_LIST } = require('../../../lib/defaults')
18
17
  const chalk = require('chalk')
19
18
  const yaml = require('js-yaml')
20
19
 
@@ -26,28 +25,30 @@ class ListExtensionCommand extends BaseCommand {
26
25
  const extConfig = this.getAppExtConfigs(flags)
27
26
  const extSummary = {}
28
27
 
29
- Object.keys(EXTENSION_POINT_LIST).forEach(extPoint => {
28
+ Object.keys(extConfig).forEach(extPoint => {
29
+ if (extPoint === 'application') {
30
+ return
31
+ }
32
+
30
33
  const extension = extConfig[extPoint]
31
- if (extension) {
32
- const extDetails = { operations: {} }
33
- extSummary[extPoint] = extDetails
34
+ const extDetails = { operations: {} }
35
+ extSummary[extPoint] = extDetails
34
36
 
35
- // get view impl details
36
- if (extension.operations.view) {
37
- extDetails.operations.view = [
38
- {
39
- impl: extension.operations.view[0].impl
40
- }
41
- ]
42
- }
43
- // get worker impl details
44
- if (extension.operations.workerProcess) {
45
- extDetails.operations.workerProcess = [
46
- {
47
- impl: extension.operations.workerProcess[0].impl
48
- }
49
- ]
50
- }
37
+ // get view impl details
38
+ if (extension.operations.view) {
39
+ extDetails.operations.view = [
40
+ {
41
+ impl: extension.operations.view[0].impl
42
+ }
43
+ ]
44
+ }
45
+ // get worker impl details
46
+ if (extension.operations.workerProcess) {
47
+ extDetails.operations.workerProcess = [
48
+ {
49
+ impl: extension.operations.workerProcess[0].impl
50
+ }
51
+ ]
51
52
  }
52
53
  })
53
54
  // print
@@ -154,7 +154,7 @@ class Run extends BaseCommand {
154
154
  // 1. generate them using aio certificate generate command
155
155
  const CertCmd = this.config.findCommand('certificate:generate')
156
156
  if (CertCmd) {
157
- const Instance = CertCmd.load()
157
+ const Instance = await CertCmd.load()
158
158
  await Instance.run([`--keyout=${PRIVATE_KEY_PATH}`, `--out=${PUB_CERT_PATH}`, '-n=DeveloperSelfSigned.cert'])
159
159
  } else {
160
160
  // could not find the cert command, error is caught below