@adobe/aio-cli-plugin-app 11.1.0 → 12.0.1

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.
@@ -28,8 +28,6 @@ class Use extends BaseCommand {
28
28
  async run () {
29
29
  const { flags, args } = await this.parse(Use)
30
30
 
31
- flags.workspace = flags.workspace || flags['workspace-name'] || ''
32
-
33
31
  aioLogger.debug(`args: ${JSON.stringify(args, null, 2)}, flags: ${JSON.stringify(flags, null, 2)}`)
34
32
 
35
33
  // some additional checks and updates of flags and args on top of what oclif provides
@@ -196,15 +194,23 @@ class Use extends BaseCommand {
196
194
  let workspace
197
195
  let workspaceData = { name: workspaceNameOrId }
198
196
  // does not prompt if workspaceNameOrId is defined via the flag
199
- workspace = await consoleCLI.promptForSelectWorkspace(workspaces, { workspaceId: workspaceNameOrId, workspaceName: workspaceNameOrId }, { allowCreate: true })
197
+ workspace = await consoleCLI.promptForSelectWorkspace(workspaces, {
198
+ workspaceId: workspaceNameOrId,
199
+ workspaceName: workspaceNameOrId
200
+ }, {
201
+ allowCreate: true
202
+ })
203
+
200
204
  if (!workspace) {
201
205
  aioLogger.debug(`--workspace=${workspaceNameOrId} was not found in the current Project ${project.name}`)
202
206
  if (workspaceNameOrId) {
203
- if (!flags['confirm-new-workspace']) {
207
+ if (flags['confirm-new-workspace']) {
204
208
  const shouldNewWorkspace = await consoleCLI.prompt.promptConfirm(`Workspace '${workspaceNameOrId}' does not exist \n > Do you wish to create a new workspace?`)
205
209
  if (!shouldNewWorkspace) {
206
210
  this.error('Workspace creation aborted')
207
211
  }
212
+ } else {
213
+ // this is not an error, if we end up here we just use `workspaceData` later
208
214
  }
209
215
  } else {
210
216
  workspaceData = await consoleCLI.promptForCreateWorkspaceDetails()
@@ -369,15 +375,26 @@ Use.flags = {
369
375
  exclusive: ['global', 'workspace-name']
370
376
  }),
371
377
  'confirm-new-workspace': Flags.boolean({
372
- description: 'Skip and confirm prompt for creating a new workspace',
373
- default: false
374
- }),
375
- 'workspace-name': Flags.string({
376
- description: '[DEPRECATED]: please use --workspace instead',
377
- default: '',
378
- char: 'w',
379
- exclusive: ['global', 'workspace']
378
+ description: 'Prompt to confirm before creating a new workspace',
379
+ default: true,
380
+ allowNo: true,
381
+ relationships: [
382
+ // if prompt is false, then the workspace flag MUST be specified
383
+ {
384
+ type: 'all',
385
+ flags: [{
386
+ name: 'workspace',
387
+ when: async (flags) => flags['confirm-new-workspace'] === false
388
+ }]
389
+ }
390
+ ]
380
391
  }),
392
+ // 'workspace-name': Flags.string({
393
+ // description: '[DEPRECATED]: please use --workspace instead',
394
+ // default: '',
395
+ // char: 'w',
396
+ // exclusive: ['global', 'workspace']
397
+ // }),
381
398
  'no-service-sync': Flags.boolean({
382
399
  description: 'Skip the Service sync prompt and do not attach current Service subscriptions to the new Workspace',
383
400
  default: false,
@@ -129,10 +129,9 @@ class LogForwarding {
129
129
  projectConfig.project.workspace.log_forwarding = {
130
130
  [destination]: nonSecretSettings
131
131
  }
132
- const interactive = false
133
- const merge = true
134
- await writeAio(projectConfig, '', { interactive, merge })
135
- await writeEnv({}, '', { interactive, merge }, secretSettings)
132
+ const writeOptions = { interactive: false, merge: true }
133
+ await writeAio(projectConfig, '', writeOptions)
134
+ await writeEnv({}, '', writeOptions, secretSettings)
136
135
  }
137
136
 
138
137
  isLocalConfigChanged () {