@adobe/aio-cli-plugin-app 9.2.0 → 10.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.
- 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 +83 -103
- 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,17 +27,16 @@ 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)
|
|
37
35
|
const values = Object.values(deployConfigs)
|
|
36
|
+
const isStandaloneApp = (keys.length === 1 && keys[0] === 'application')
|
|
38
37
|
|
|
39
38
|
// if there are no extensions, then set publish to false
|
|
40
|
-
flags.publish = flags.publish && !
|
|
39
|
+
flags.publish = flags.publish && !isStandaloneApp
|
|
41
40
|
let libConsoleCLI
|
|
42
41
|
if (flags.publish) {
|
|
43
42
|
// force login at beginning (if required)
|
|
@@ -45,9 +44,7 @@ class Deploy extends BuildCommand {
|
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
if (
|
|
48
|
-
(!flags.publish && !flags['web-assets'] && !flags.actions)
|
|
49
|
-
// NOTE skip deploy is deprecated
|
|
50
|
-
(!flags.publish && !flags.build && flags['skip-deploy'])
|
|
47
|
+
(!flags.publish && !flags['web-assets'] && !flags.actions)
|
|
51
48
|
) {
|
|
52
49
|
this.error('Nothing to be done 🚫')
|
|
53
50
|
}
|
|
@@ -86,7 +83,7 @@ class Deploy extends BuildCommand {
|
|
|
86
83
|
}
|
|
87
84
|
|
|
88
85
|
// 2. Bail if workspace is production and application status is PUBLISHED, honor force-deploy
|
|
89
|
-
if (aioConfig
|
|
86
|
+
if (!isStandaloneApp && aioConfig?.project?.workspace?.name === 'Production' && !flags['force-deploy']) {
|
|
90
87
|
const extension = await this.getApplicationExtension(libConsoleCLI, aioConfig)
|
|
91
88
|
spinner.info(chalk.dim(JSON.stringify(extension)))
|
|
92
89
|
if (extension && extension.status === 'PUBLISHED') {
|
|
@@ -144,103 +141,101 @@ class Deploy extends BuildCommand {
|
|
|
144
141
|
|
|
145
142
|
const filterActions = flags.action
|
|
146
143
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
144
|
+
try {
|
|
145
|
+
await runScript(config.hooks['pre-app-deploy'])
|
|
146
|
+
} catch (err) {
|
|
147
|
+
this.log(err)
|
|
148
|
+
}
|
|
153
149
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
150
|
+
if (flags.actions) {
|
|
151
|
+
if (config.app.hasBackend) {
|
|
152
|
+
let filterEntities
|
|
153
|
+
if (filterActions) {
|
|
154
|
+
filterEntities = { actions: filterActions }
|
|
155
|
+
}
|
|
156
|
+
const message = `Deploying actions for '${name}'`
|
|
157
|
+
spinner.start(message)
|
|
158
|
+
try {
|
|
159
|
+
const script = await runScript(config.hooks['deploy-actions'])
|
|
160
|
+
if (!script) {
|
|
161
|
+
deployedRuntimeEntities = await rtLib.deployActions(config, { filterEntities }, onProgress)
|
|
159
162
|
}
|
|
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
163
|
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
if (deployedRuntimeEntities.actions && deployedRuntimeEntities.actions.length > 0) {
|
|
165
|
+
spinner.succeed(chalk.green(`Deployed ${deployedRuntimeEntities.actions.length} action(s) for '${name}'`))
|
|
166
|
+
} else {
|
|
167
|
+
if (script) {
|
|
168
|
+
spinner.fail(chalk.green(`deploy-actions skipped by hook '${name}'`))
|
|
170
169
|
} 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
|
-
}
|
|
170
|
+
spinner.fail(chalk.green(`No actions deployed for '${name}'`))
|
|
176
171
|
}
|
|
177
|
-
} catch (err) {
|
|
178
|
-
spinner.fail(chalk.green(message))
|
|
179
|
-
throw err
|
|
180
172
|
}
|
|
181
|
-
}
|
|
182
|
-
|
|
173
|
+
} catch (err) {
|
|
174
|
+
spinner.fail(chalk.green(message))
|
|
175
|
+
throw err
|
|
183
176
|
}
|
|
177
|
+
} else {
|
|
178
|
+
this.log(`no backend, skipping action deploy '${name}'`)
|
|
184
179
|
}
|
|
180
|
+
}
|
|
185
181
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
} catch (err) {
|
|
199
|
-
spinner.fail(chalk.green(message))
|
|
200
|
-
throw err
|
|
182
|
+
if (flags['web-assets']) {
|
|
183
|
+
if (config.app.hasFrontend) {
|
|
184
|
+
const message = `Deploying web assets for '${name}'`
|
|
185
|
+
spinner.start(message)
|
|
186
|
+
try {
|
|
187
|
+
const script = await runScript(config.hooks['deploy-static'])
|
|
188
|
+
if (script) {
|
|
189
|
+
spinner.fail(chalk.green(`deploy-static skipped by hook '${name}'`))
|
|
190
|
+
} else {
|
|
191
|
+
deployedFrontendUrl = await webLib.deployWeb(config, onProgress)
|
|
192
|
+
spinner.succeed(chalk.green(message))
|
|
201
193
|
}
|
|
202
|
-
}
|
|
203
|
-
|
|
194
|
+
} catch (err) {
|
|
195
|
+
spinner.fail(chalk.green(message))
|
|
196
|
+
throw err
|
|
204
197
|
}
|
|
198
|
+
} else {
|
|
199
|
+
this.log(`no frontend, skipping frontend deploy '${name}'`)
|
|
205
200
|
}
|
|
201
|
+
}
|
|
206
202
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
203
|
+
// log deployed resources
|
|
204
|
+
if (deployedRuntimeEntities.actions && deployedRuntimeEntities.actions.length > 0) {
|
|
205
|
+
this.log(chalk.blue(chalk.bold('Your deployed actions:')))
|
|
206
|
+
const web = deployedRuntimeEntities.actions.filter(createWebExportFilter(true))
|
|
207
|
+
const nonWeb = deployedRuntimeEntities.actions.filter(createWebExportFilter(false))
|
|
208
|
+
|
|
209
|
+
if (web.length > 0) {
|
|
210
|
+
this.log('web actions:')
|
|
211
|
+
web.forEach(a => {
|
|
212
|
+
this.log(chalk.blue(chalk.bold(` -> ${a.url || a.name} `)))
|
|
213
|
+
})
|
|
214
|
+
}
|
|
219
215
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
216
|
+
if (nonWeb.length > 0) {
|
|
217
|
+
this.log('non-web actions:')
|
|
218
|
+
nonWeb.forEach(a => {
|
|
219
|
+
this.log(chalk.blue(chalk.bold(` -> ${a.url || a.name} `)))
|
|
220
|
+
})
|
|
226
221
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
222
|
+
}
|
|
223
|
+
// TODO urls should depend on extension point, exc shell only for exc shell extension point - use a post-app-deploy hook ?
|
|
224
|
+
if (deployedFrontendUrl) {
|
|
225
|
+
this.log(chalk.blue(chalk.bold(`To view your deployed application:\n -> ${deployedFrontendUrl}`)))
|
|
226
|
+
const launchUrl = this.getLaunchUrlPrefix() + deployedFrontendUrl
|
|
227
|
+
if (flags.open) {
|
|
228
|
+
this.log(chalk.blue(chalk.bold(`Opening your deployed application in the Experience Cloud shell:\n -> ${launchUrl}`)))
|
|
229
|
+
cli.open(launchUrl)
|
|
230
|
+
} else {
|
|
231
|
+
this.log(chalk.blue(chalk.bold(`To view your deployed application in the Experience Cloud shell:\n -> ${launchUrl}`)))
|
|
237
232
|
}
|
|
233
|
+
}
|
|
238
234
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
235
|
+
try {
|
|
236
|
+
await runScript(config.hooks['post-app-deploy'])
|
|
237
|
+
} catch (err) {
|
|
238
|
+
this.log(err)
|
|
244
239
|
}
|
|
245
240
|
}
|
|
246
241
|
|
|
@@ -276,21 +271,6 @@ This will always force a rebuild unless --no-force-build is set.
|
|
|
276
271
|
|
|
277
272
|
Deploy.flags = {
|
|
278
273
|
...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
274
|
actions: Flags.boolean({
|
|
295
275
|
description: '[default: true] Deploy actions if any',
|
|
296
276
|
default: true,
|