@adobe/aio-cli-plugin-app 9.2.0 → 10.0.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.
- package/README.md +21 -38
- package/oclif.manifest.json +1 -1
- package/package.json +5 -2
- package/src/AddCommand.js +1 -7
- package/src/TemplatesCommand.js +256 -0
- package/src/commands/app/add/action.js +85 -31
- package/src/commands/app/add/extension.js +27 -77
- package/src/commands/app/add/service.js +1 -1
- package/src/commands/app/add/web-assets.js +29 -28
- package/src/commands/app/build.js +1 -11
- package/src/commands/app/delete/extension.js +7 -8
- package/src/commands/app/delete/service.js +1 -1
- package/src/commands/app/deploy.js +81 -102
- package/src/commands/app/init.js +178 -147
- package/src/commands/app/run.js +4 -12
- package/src/commands/app/undeploy.js +0 -13
- package/src/lib/defaults.js +1 -32
|
@@ -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
|
|
68
|
-
choices:
|
|
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
|
|
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
|
-
|
|
114
|
-
description: '
|
|
115
|
-
default:
|
|
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',
|
|
@@ -34,7 +34,7 @@ class AddServiceCommand extends BaseCommand {
|
|
|
34
34
|
// load console configuration from .aio and .env files
|
|
35
35
|
const projectConfig = config.get('project')
|
|
36
36
|
if (!projectConfig) {
|
|
37
|
-
this.error(
|
|
37
|
+
this.error(`Incomplete .aio configuration, please import a valid Adobe Developer Console configuration via \`${this.config.bin} app use\` first.`)
|
|
38
38
|
}
|
|
39
39
|
const orgId = projectConfig.org.id
|
|
40
40
|
const project = { name: projectConfig.name, id: projectConfig.id }
|
|
@@ -27,10 +27,8 @@ class Deploy extends BuildCommand {
|
|
|
27
27
|
const { flags } = await this.parse(Deploy)
|
|
28
28
|
|
|
29
29
|
// flags
|
|
30
|
-
flags['web-assets'] = flags['web-assets'] && !flags
|
|
31
|
-
flags.actions = flags.actions && !flags['skip-actions']
|
|
30
|
+
flags['web-assets'] = flags['web-assets'] && !flags.action
|
|
32
31
|
flags.publish = flags.publish && !flags.action
|
|
33
|
-
flags.build = flags.build && !flags['skip-build']
|
|
34
32
|
|
|
35
33
|
const deployConfigs = this.getAppExtConfigs(flags)
|
|
36
34
|
const keys = Object.keys(deployConfigs)
|
|
@@ -45,9 +43,7 @@ class Deploy extends BuildCommand {
|
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
if (
|
|
48
|
-
(!flags.publish && !flags['web-assets'] && !flags.actions)
|
|
49
|
-
// NOTE skip deploy is deprecated
|
|
50
|
-
(!flags.publish && !flags.build && flags['skip-deploy'])
|
|
46
|
+
(!flags.publish && !flags['web-assets'] && !flags.actions)
|
|
51
47
|
) {
|
|
52
48
|
this.error('Nothing to be done 🚫')
|
|
53
49
|
}
|
|
@@ -86,7 +82,7 @@ class Deploy extends BuildCommand {
|
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
// 2. Bail if workspace is production and application status is PUBLISHED, honor force-deploy
|
|
89
|
-
if (aioConfig
|
|
85
|
+
if (aioConfig?.project?.workspace?.name === 'Production' && !flags['force-deploy']) {
|
|
90
86
|
const extension = await this.getApplicationExtension(libConsoleCLI, aioConfig)
|
|
91
87
|
spinner.info(chalk.dim(JSON.stringify(extension)))
|
|
92
88
|
if (extension && extension.status === 'PUBLISHED') {
|
|
@@ -144,103 +140,101 @@ class Deploy extends BuildCommand {
|
|
|
144
140
|
|
|
145
141
|
const filterActions = flags.action
|
|
146
142
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
143
|
+
try {
|
|
144
|
+
await runScript(config.hooks['pre-app-deploy'])
|
|
145
|
+
} catch (err) {
|
|
146
|
+
this.log(err)
|
|
147
|
+
}
|
|
153
148
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
149
|
+
if (flags.actions) {
|
|
150
|
+
if (config.app.hasBackend) {
|
|
151
|
+
let filterEntities
|
|
152
|
+
if (filterActions) {
|
|
153
|
+
filterEntities = { actions: filterActions }
|
|
154
|
+
}
|
|
155
|
+
const message = `Deploying actions for '${name}'`
|
|
156
|
+
spinner.start(message)
|
|
157
|
+
try {
|
|
158
|
+
const script = await runScript(config.hooks['deploy-actions'])
|
|
159
|
+
if (!script) {
|
|
160
|
+
deployedRuntimeEntities = await rtLib.deployActions(config, { filterEntities }, onProgress)
|
|
159
161
|
}
|
|
160
|
-
const message = `Deploying actions for '${name}'`
|
|
161
|
-
spinner.start(message)
|
|
162
|
-
try {
|
|
163
|
-
const script = await runScript(config.hooks['deploy-actions'])
|
|
164
|
-
if (!script) {
|
|
165
|
-
deployedRuntimeEntities = await rtLib.deployActions(config, { filterEntities }, onProgress)
|
|
166
|
-
}
|
|
167
162
|
|
|
168
|
-
|
|
169
|
-
|
|
163
|
+
if (deployedRuntimeEntities.actions && deployedRuntimeEntities.actions.length > 0) {
|
|
164
|
+
spinner.succeed(chalk.green(`Deployed ${deployedRuntimeEntities.actions.length} action(s) for '${name}'`))
|
|
165
|
+
} else {
|
|
166
|
+
if (script) {
|
|
167
|
+
spinner.fail(chalk.green(`deploy-actions skipped by hook '${name}'`))
|
|
170
168
|
} else {
|
|
171
|
-
|
|
172
|
-
spinner.fail(chalk.green(`deploy-actions skipped by hook '${name}'`))
|
|
173
|
-
} else {
|
|
174
|
-
spinner.fail(chalk.green(`No actions deployed for '${name}'`))
|
|
175
|
-
}
|
|
169
|
+
spinner.fail(chalk.green(`No actions deployed for '${name}'`))
|
|
176
170
|
}
|
|
177
|
-
} catch (err) {
|
|
178
|
-
spinner.fail(chalk.green(message))
|
|
179
|
-
throw err
|
|
180
171
|
}
|
|
181
|
-
}
|
|
182
|
-
|
|
172
|
+
} catch (err) {
|
|
173
|
+
spinner.fail(chalk.green(message))
|
|
174
|
+
throw err
|
|
183
175
|
}
|
|
176
|
+
} else {
|
|
177
|
+
this.log(`no backend, skipping action deploy '${name}'`)
|
|
184
178
|
}
|
|
179
|
+
}
|
|
185
180
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
} catch (err) {
|
|
199
|
-
spinner.fail(chalk.green(message))
|
|
200
|
-
throw err
|
|
181
|
+
if (flags['web-assets']) {
|
|
182
|
+
if (config.app.hasFrontend) {
|
|
183
|
+
const message = `Deploying web assets for '${name}'`
|
|
184
|
+
spinner.start(message)
|
|
185
|
+
try {
|
|
186
|
+
const script = await runScript(config.hooks['deploy-static'])
|
|
187
|
+
if (script) {
|
|
188
|
+
spinner.fail(chalk.green(`deploy-static skipped by hook '${name}'`))
|
|
189
|
+
} else {
|
|
190
|
+
deployedFrontendUrl = await webLib.deployWeb(config, onProgress)
|
|
191
|
+
spinner.succeed(chalk.green(message))
|
|
201
192
|
}
|
|
202
|
-
}
|
|
203
|
-
|
|
193
|
+
} catch (err) {
|
|
194
|
+
spinner.fail(chalk.green(message))
|
|
195
|
+
throw err
|
|
204
196
|
}
|
|
197
|
+
} else {
|
|
198
|
+
this.log(`no frontend, skipping frontend deploy '${name}'`)
|
|
205
199
|
}
|
|
200
|
+
}
|
|
206
201
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
202
|
+
// log deployed resources
|
|
203
|
+
if (deployedRuntimeEntities.actions && deployedRuntimeEntities.actions.length > 0) {
|
|
204
|
+
this.log(chalk.blue(chalk.bold('Your deployed actions:')))
|
|
205
|
+
const web = deployedRuntimeEntities.actions.filter(createWebExportFilter(true))
|
|
206
|
+
const nonWeb = deployedRuntimeEntities.actions.filter(createWebExportFilter(false))
|
|
207
|
+
|
|
208
|
+
if (web.length > 0) {
|
|
209
|
+
this.log('web actions:')
|
|
210
|
+
web.forEach(a => {
|
|
211
|
+
this.log(chalk.blue(chalk.bold(` -> ${a.url || a.name} `)))
|
|
212
|
+
})
|
|
213
|
+
}
|
|
219
214
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
215
|
+
if (nonWeb.length > 0) {
|
|
216
|
+
this.log('non-web actions:')
|
|
217
|
+
nonWeb.forEach(a => {
|
|
218
|
+
this.log(chalk.blue(chalk.bold(` -> ${a.url || a.name} `)))
|
|
219
|
+
})
|
|
226
220
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
221
|
+
}
|
|
222
|
+
// TODO urls should depend on extension point, exc shell only for exc shell extension point - use a post-app-deploy hook ?
|
|
223
|
+
if (deployedFrontendUrl) {
|
|
224
|
+
this.log(chalk.blue(chalk.bold(`To view your deployed application:\n -> ${deployedFrontendUrl}`)))
|
|
225
|
+
const launchUrl = this.getLaunchUrlPrefix() + deployedFrontendUrl
|
|
226
|
+
if (flags.open) {
|
|
227
|
+
this.log(chalk.blue(chalk.bold(`Opening your deployed application in the Experience Cloud shell:\n -> ${launchUrl}`)))
|
|
228
|
+
cli.open(launchUrl)
|
|
229
|
+
} else {
|
|
230
|
+
this.log(chalk.blue(chalk.bold(`To view your deployed application in the Experience Cloud shell:\n -> ${launchUrl}`)))
|
|
237
231
|
}
|
|
232
|
+
}
|
|
238
233
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
234
|
+
try {
|
|
235
|
+
await runScript(config.hooks['post-app-deploy'])
|
|
236
|
+
} catch (err) {
|
|
237
|
+
this.log(err)
|
|
244
238
|
}
|
|
245
239
|
}
|
|
246
240
|
|
|
@@ -276,21 +270,6 @@ This will always force a rebuild unless --no-force-build is set.
|
|
|
276
270
|
|
|
277
271
|
Deploy.flags = {
|
|
278
272
|
...BaseCommand.flags,
|
|
279
|
-
'skip-build': Flags.boolean({
|
|
280
|
-
description: '[deprecated] Please use --no-build'
|
|
281
|
-
}),
|
|
282
|
-
'skip-deploy': Flags.boolean({
|
|
283
|
-
description: '[deprecated] Please use \'aio app build\''
|
|
284
|
-
}),
|
|
285
|
-
'skip-static': Flags.boolean({
|
|
286
|
-
description: '[deprecated] Please use --no-web-assets'
|
|
287
|
-
}),
|
|
288
|
-
'skip-web-assets': Flags.boolean({
|
|
289
|
-
description: '[deprecated] Please use --no-web-assets'
|
|
290
|
-
}),
|
|
291
|
-
'skip-actions': Flags.boolean({
|
|
292
|
-
description: '[deprecated] Please use --no-actions'
|
|
293
|
-
}),
|
|
294
273
|
actions: Flags.boolean({
|
|
295
274
|
description: '[default: true] Deploy actions if any',
|
|
296
275
|
default: true,
|