@adobe/aio-cli-plugin-app 10.4.0 → 10.6.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 +64 -8
- package/oclif.manifest.json +9 -3
- package/package.json +17 -14
- package/src/BaseCommand.js +21 -1
- package/src/commands/app/add/action.js +1 -1
- package/src/commands/app/add/ci.js +1 -1
- package/src/commands/app/add/event.js +60 -18
- package/src/commands/app/add/extension.js +1 -1
- package/src/commands/app/add/index.js +1 -1
- package/src/commands/app/add/service.js +1 -1
- package/src/commands/app/add/web-assets.js +1 -1
- package/src/commands/app/create.js +6 -6
- package/src/commands/app/delete/action.js +7 -7
- package/src/commands/app/delete/ci.js +1 -1
- package/src/commands/app/delete/event.js +6 -6
- package/src/commands/app/delete/extension.js +1 -1
- package/src/commands/app/delete/index.js +1 -1
- package/src/commands/app/delete/service.js +1 -1
- package/src/commands/app/delete/web-assets.js +1 -1
- package/src/commands/app/deploy.js +4 -3
- package/src/commands/app/get-url.js +6 -4
- package/src/commands/app/index.js +1 -1
- package/src/commands/app/info.js +1 -1
- package/src/commands/app/init.js +6 -6
- package/src/commands/app/install.js +71 -6
- package/src/commands/app/list/extension-points.js +1 -1
- package/src/commands/app/list/extension.js +1 -1
- package/src/commands/app/list/index.js +1 -1
- package/src/commands/app/pack.js +24 -55
- package/src/commands/app/run.js +10 -7
- package/src/commands/app/undeploy.js +9 -12
- package/src/commands/app/use.js +7 -7
- package/src/lib/app-helper.js +2 -2
- package/src/lib/import-helper.js +9 -9
- package/src/lib/log-poller.js +1 -0
|
@@ -11,7 +11,7 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
|
|
12
12
|
const BaseCommand = require('../../../BaseCommand')
|
|
13
13
|
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:delete:event', { provider: 'debug' })
|
|
14
|
-
const { Flags } = require('@oclif/core')
|
|
14
|
+
const { Flags, Args } = require('@oclif/core')
|
|
15
15
|
const DeleteActionCommand = require('./action')
|
|
16
16
|
const chalk = require('chalk')
|
|
17
17
|
|
|
@@ -54,13 +54,13 @@ DeleteEventCommand.flags = {
|
|
|
54
54
|
...BaseCommand.flags
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
DeleteEventCommand.args =
|
|
57
|
+
DeleteEventCommand.args =
|
|
58
58
|
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
'event-action-name': Args.string({
|
|
60
|
+
description: 'Action `pkg/name` to delete, you can specify multiple actions via a comma separated list',
|
|
61
|
+
required: false
|
|
62
|
+
})
|
|
62
63
|
}
|
|
63
|
-
]
|
|
64
64
|
|
|
65
65
|
DeleteEventCommand.aliases = ['app:delete:events']
|
|
66
66
|
|
|
@@ -12,11 +12,12 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
|
|
13
13
|
const ora = require('ora')
|
|
14
14
|
const chalk = require('chalk')
|
|
15
|
+
const open = require('open')
|
|
15
16
|
|
|
16
17
|
const BaseCommand = require('../../BaseCommand')
|
|
17
18
|
const BuildCommand = require('./build')
|
|
18
19
|
const webLib = require('@adobe/aio-lib-web')
|
|
19
|
-
const { Flags
|
|
20
|
+
const { Flags } = require('@oclif/core')
|
|
20
21
|
const { createWebExportFilter, runInProcess, buildExtensionPointPayloadWoMetadata, buildExcShellViewExtensionMetadata } = require('../../lib/app-helper')
|
|
21
22
|
const rtLib = require('@adobe/aio-lib-runtime')
|
|
22
23
|
const LogForwarding = require('../../lib/log-forwarding')
|
|
@@ -241,7 +242,7 @@ class Deploy extends BuildCommand {
|
|
|
241
242
|
const launchUrl = this.getLaunchUrlPrefix() + deployedFrontendUrl
|
|
242
243
|
if (flags.open) {
|
|
243
244
|
this.log(chalk.blue(chalk.bold(`Opening your deployed application in the Experience Cloud shell:\n -> ${launchUrl}`)))
|
|
244
|
-
|
|
245
|
+
open(launchUrl)
|
|
245
246
|
} else {
|
|
246
247
|
this.log(chalk.blue(chalk.bold(`To view your deployed application in the Experience Cloud shell:\n -> ${launchUrl}`)))
|
|
247
248
|
}
|
|
@@ -375,6 +376,6 @@ Deploy.flags = {
|
|
|
375
376
|
})
|
|
376
377
|
}
|
|
377
378
|
|
|
378
|
-
Deploy.args =
|
|
379
|
+
Deploy.args = {}
|
|
379
380
|
|
|
380
381
|
module.exports = Deploy
|
|
@@ -12,7 +12,7 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
|
|
13
13
|
const chalk = require('chalk')
|
|
14
14
|
|
|
15
|
-
const { Flags } = require('@oclif/core')
|
|
15
|
+
const { Flags, Args } = require('@oclif/core')
|
|
16
16
|
|
|
17
17
|
const BaseCommand = require('../../BaseCommand')
|
|
18
18
|
const { wrapError } = require('../../lib/app-helper')
|
|
@@ -116,8 +116,10 @@ GetUrlCommand.flags = {
|
|
|
116
116
|
})
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
GetUrlCommand.args =
|
|
120
|
-
{
|
|
121
|
-
|
|
119
|
+
GetUrlCommand.args =
|
|
120
|
+
{
|
|
121
|
+
action: Args.string({
|
|
122
|
+
})
|
|
123
|
+
}
|
|
122
124
|
|
|
123
125
|
module.exports = GetUrlCommand
|
package/src/commands/app/info.js
CHANGED
package/src/commands/app/init.js
CHANGED
|
@@ -15,7 +15,7 @@ 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 { Flags } = require('@oclif/core')
|
|
18
|
+
const { Flags, Args } = require('@oclif/core')
|
|
19
19
|
const generators = require('@adobe/generator-aio-app')
|
|
20
20
|
const TemplateRegistryAPI = require('@adobe/aio-lib-templates')
|
|
21
21
|
const inquirer = require('inquirer')
|
|
@@ -400,12 +400,12 @@ InitCommand.flags = {
|
|
|
400
400
|
})
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
InitCommand.args =
|
|
403
|
+
InitCommand.args =
|
|
404
404
|
{
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
405
|
+
path: Args.string({
|
|
406
|
+
description: 'Path to the app directory',
|
|
407
|
+
default: '.'
|
|
408
|
+
})
|
|
408
409
|
}
|
|
409
|
-
]
|
|
410
410
|
|
|
411
411
|
module.exports = InitCommand
|
|
@@ -11,13 +11,15 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
const BaseCommand = require('../../BaseCommand')
|
|
14
|
-
const { Flags } = require('@oclif/core')
|
|
14
|
+
const { Flags, Args } = require('@oclif/core')
|
|
15
15
|
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:install', { provider: 'debug' })
|
|
16
16
|
const path = require('node:path')
|
|
17
17
|
const fs = require('fs-extra')
|
|
18
18
|
const execa = require('execa')
|
|
19
19
|
const unzipper = require('unzipper')
|
|
20
20
|
const { validateJsonWithSchema } = require('../../lib/install-helper')
|
|
21
|
+
const { loadConfigFile, writeFile } = require('../../lib/import-helper')
|
|
22
|
+
const { getObjectValue } = require('../../lib/app-helper')
|
|
21
23
|
const jsYaml = require('js-yaml')
|
|
22
24
|
const { USER_CONFIG_FILE, DEPLOY_CONFIG_FILE } = require('../../lib/defaults')
|
|
23
25
|
const ora = require('ora')
|
|
@@ -28,6 +30,7 @@ class InstallCommand extends BaseCommand {
|
|
|
28
30
|
const { args, flags } = await this.parse(InstallCommand)
|
|
29
31
|
|
|
30
32
|
this.preRelease()
|
|
33
|
+
const appConfig = this.getFullConfig()
|
|
31
34
|
|
|
32
35
|
aioLogger.debug(`flags: ${JSON.stringify(flags, null, 2)}`)
|
|
33
36
|
aioLogger.debug(`args: ${JSON.stringify(args, null, 2)}`)
|
|
@@ -49,6 +52,7 @@ class InstallCommand extends BaseCommand {
|
|
|
49
52
|
try {
|
|
50
53
|
await this.validateZipDirectoryStructure(args.path)
|
|
51
54
|
await this.unzipFile(args.path, outputPath)
|
|
55
|
+
await this.addCodeDownloadAnnotation(outputPath, appConfig)
|
|
52
56
|
await this.validateConfig(outputPath, USER_CONFIG_FILE)
|
|
53
57
|
await this.validateConfig(outputPath, DEPLOY_CONFIG_FILE)
|
|
54
58
|
await this.npmInstall(flags.verbose)
|
|
@@ -139,6 +143,67 @@ class InstallCommand extends BaseCommand {
|
|
|
139
143
|
}
|
|
140
144
|
})
|
|
141
145
|
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* An annotation called disable-download will be added to all actions in app.config.yaml
|
|
149
|
+
* (and linked yaml configs for example in extensions). This value will be set to true.
|
|
150
|
+
* The annotation will by default be false if not set.
|
|
151
|
+
*
|
|
152
|
+
* @param {object} outputPath the path to the app package
|
|
153
|
+
* @param {object} appConfig the app's configuration file
|
|
154
|
+
*/
|
|
155
|
+
async addCodeDownloadAnnotation (outputPath, appConfig) {
|
|
156
|
+
this.spinner.start('Adding disable-download annotations...')
|
|
157
|
+
// get each annotation key relative to the file it is defined in
|
|
158
|
+
/// iterate only over extensions that have actions defined
|
|
159
|
+
const fileToAnnotationKey = {}
|
|
160
|
+
Object.entries(appConfig.all)
|
|
161
|
+
.filter(([_, extConf]) => extConf.manifest?.full?.packages)
|
|
162
|
+
.forEach(([ext, extConf]) => {
|
|
163
|
+
Object.entries(extConf.manifest.full.packages)
|
|
164
|
+
.filter(([pkg, pkgConf]) => pkgConf.actions)
|
|
165
|
+
.forEach(([pkg, pkgConf]) => {
|
|
166
|
+
Object.entries(pkgConf.actions).forEach(([action, actionConf]) => {
|
|
167
|
+
const baseFullKey = ext === 'application'
|
|
168
|
+
? `application.runtimeManifest.packages.${pkg}.actions.${action}`
|
|
169
|
+
: `extensions.${ext}.runtimeManifest.packages.${pkg}.actions.${action}`
|
|
170
|
+
|
|
171
|
+
let index
|
|
172
|
+
if (actionConf.annotations) {
|
|
173
|
+
index = appConfig.includeIndex[`${baseFullKey}.annotations`]
|
|
174
|
+
} else {
|
|
175
|
+
// the annotation object is not defined, take the parent key
|
|
176
|
+
index = appConfig.includeIndex[baseFullKey]
|
|
177
|
+
}
|
|
178
|
+
if (!fileToAnnotationKey[index.file]) {
|
|
179
|
+
fileToAnnotationKey[index.file] = []
|
|
180
|
+
}
|
|
181
|
+
fileToAnnotationKey[index.file].push(index.key) // index.key is relative to the file
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
// rewrite config files
|
|
187
|
+
for (const [file, keys] of Object.entries(fileToAnnotationKey)) {
|
|
188
|
+
const configFilePath = path.join(outputPath, file)
|
|
189
|
+
const { values } = loadConfigFile(configFilePath)
|
|
190
|
+
|
|
191
|
+
keys.forEach(key => {
|
|
192
|
+
const object = getObjectValue(values, key)
|
|
193
|
+
if (key.endsWith('.annotations') || key === 'annotations') {
|
|
194
|
+
// object is the annotations object
|
|
195
|
+
object['disable-download'] = true
|
|
196
|
+
} else {
|
|
197
|
+
// annotation object is not defined, the object is the action object
|
|
198
|
+
object.annotations = { 'disable-download': true }
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
// write back the modified manifest to disk
|
|
203
|
+
await writeFile(configFilePath, jsYaml.dump(values), { overwrite: true })
|
|
204
|
+
}
|
|
205
|
+
this.spinner.succeed('Added disable-download annotations')
|
|
206
|
+
}
|
|
142
207
|
}
|
|
143
208
|
|
|
144
209
|
InstallCommand.hidden = true // hide from help for pre-release
|
|
@@ -155,12 +220,12 @@ InstallCommand.flags = {
|
|
|
155
220
|
})
|
|
156
221
|
}
|
|
157
222
|
|
|
158
|
-
InstallCommand.args =
|
|
223
|
+
InstallCommand.args =
|
|
159
224
|
{
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
225
|
+
path: Args.string({
|
|
226
|
+
description: 'Path to the app package to install',
|
|
227
|
+
required: true
|
|
228
|
+
})
|
|
163
229
|
}
|
|
164
|
-
]
|
|
165
230
|
|
|
166
231
|
module.exports = InstallCommand
|
|
@@ -66,6 +66,6 @@ ListExtensionPointsCommand.flags = {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
ListExtensionPointsCommand.aliases = ['app:list:ext-points', 'app:list:extension-points']
|
|
69
|
-
ListExtensionPointsCommand.args =
|
|
69
|
+
ListExtensionPointsCommand.args = {}
|
|
70
70
|
|
|
71
71
|
module.exports = ListExtensionPointsCommand
|
package/src/commands/app/pack.js
CHANGED
|
@@ -10,15 +10,14 @@ governing permissions and limitations under the License.
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
const BaseCommand = require('../../BaseCommand')
|
|
13
|
-
const { Flags } = require('@oclif/core')
|
|
13
|
+
const { Flags, Args } = require('@oclif/core')
|
|
14
14
|
const path = require('node:path')
|
|
15
15
|
const fs = require('fs-extra')
|
|
16
16
|
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:pack', { provider: 'debug' })
|
|
17
17
|
const archiver = require('archiver')
|
|
18
18
|
const yaml = require('js-yaml')
|
|
19
19
|
const execa = require('execa')
|
|
20
|
-
const {
|
|
21
|
-
const { getObjectValue } = require('../../lib/app-helper')
|
|
20
|
+
const { writeFile } = require('../../lib/import-helper')
|
|
22
21
|
const ora = require('ora')
|
|
23
22
|
const chalk = require('chalk')
|
|
24
23
|
|
|
@@ -70,10 +69,6 @@ class Pack extends BaseCommand {
|
|
|
70
69
|
await this.createDeployYamlFile(appConfig)
|
|
71
70
|
this.spinner.succeed('Created configuration files')
|
|
72
71
|
|
|
73
|
-
this.spinner.start('Adding code-download annotations...')
|
|
74
|
-
await this.addCodeDownloadAnnotation(appConfig)
|
|
75
|
-
this.spinner.succeed('Added code-download annotations')
|
|
76
|
-
|
|
77
72
|
// doing this before zip so other things can be added to the zip
|
|
78
73
|
await this.config.runHook('post-pack', { appConfig, artifactsFolder: DEFAULTS.ARTIFACTS_FOLDER })
|
|
79
74
|
|
|
@@ -135,13 +130,23 @@ class Pack extends BaseCommand {
|
|
|
135
130
|
// TODO: send a PR to their plugin to have a `--json` flag
|
|
136
131
|
const command = await this.config.findCommand('api-mesh:get')
|
|
137
132
|
if (command) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
133
|
+
try {
|
|
134
|
+
this.spinner.start('Getting api-mesh config...')
|
|
135
|
+
const { stdout } = await execa('aio', ['api-mesh', 'get'], { cwd: process.cwd() })
|
|
136
|
+
// until we get the --json flag, we parse the output
|
|
137
|
+
const idx = stdout.indexOf('{')
|
|
138
|
+
meshConfig = JSON.parse(stdout.substring(idx))
|
|
139
|
+
aioLogger.debug(`api-mesh:get - ${JSON.stringify(meshConfig, null, 2)}`)
|
|
140
|
+
this.spinner.succeed('Got api-mesh config')
|
|
141
|
+
} catch (err) {
|
|
142
|
+
// Ignore error if no mesh found, otherwise throw
|
|
143
|
+
if (err?.stderr.includes('Error: Unable to get mesh config. No mesh found for Org')) {
|
|
144
|
+
aioLogger.debug('No api-mesh config found')
|
|
145
|
+
} else {
|
|
146
|
+
console.error(err)
|
|
147
|
+
throw err
|
|
148
|
+
}
|
|
149
|
+
}
|
|
145
150
|
} else {
|
|
146
151
|
aioLogger.debug('api-mesh:get command was not found, meshConfig is not available for app:pack')
|
|
147
152
|
}
|
|
@@ -233,42 +238,6 @@ class Pack extends BaseCommand {
|
|
|
233
238
|
.map(file => file.path)
|
|
234
239
|
.filter(file => !filesToExclude.includes(file))
|
|
235
240
|
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* An annotation called code-download will be added to all actions in app.config.yaml
|
|
239
|
-
* (and linked yaml configs for example in extensions). This value will be set to false.
|
|
240
|
-
* The annotation will by default be true if not set.
|
|
241
|
-
*
|
|
242
|
-
* @param {object} appConfig the app's configuration file
|
|
243
|
-
*/
|
|
244
|
-
async addCodeDownloadAnnotation (appConfig) {
|
|
245
|
-
// get the configFiles that have runtime manifests
|
|
246
|
-
const configFiles = []
|
|
247
|
-
for (const [, value] of Object.entries(appConfig.includeIndex)) {
|
|
248
|
-
const { key } = value
|
|
249
|
-
if (key === 'runtimeManifest' || key === 'application.runtimeManifest') {
|
|
250
|
-
configFiles.push(value)
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// for each configFile, we modify each action to have the "code-download: false" annotation
|
|
255
|
-
for (const configFile of configFiles) {
|
|
256
|
-
const configFilePath = path.join(DEFAULTS.ARTIFACTS_FOLDER, configFile.file)
|
|
257
|
-
const { values } = loadConfigFile(configFilePath)
|
|
258
|
-
|
|
259
|
-
const runtimeManifest = getObjectValue(values, configFile.key)
|
|
260
|
-
for (const [, pkgManifest] of Object.entries(runtimeManifest.packages)) {
|
|
261
|
-
// key is the package name (unused), value is the package manifest. we iterate through each package's "actions"
|
|
262
|
-
for (const [, actionManifest] of Object.entries(pkgManifest.actions)) {
|
|
263
|
-
// key is the action name (unused), value is the action manifest. we add the "code-download: false" annotation
|
|
264
|
-
actionManifest.annotations['code-download'] = false
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// write back the modified manifest to disk
|
|
269
|
-
await writeFile(configFilePath, yaml.dump(values), { overwrite: true })
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
241
|
}
|
|
273
242
|
|
|
274
243
|
Pack.hidden = true // hide from help for pre-release
|
|
@@ -285,12 +254,12 @@ Pack.flags = {
|
|
|
285
254
|
})
|
|
286
255
|
}
|
|
287
256
|
|
|
288
|
-
Pack.args =
|
|
257
|
+
Pack.args =
|
|
289
258
|
{
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
259
|
+
path: Args.string({
|
|
260
|
+
description: 'Path to the app directory to package',
|
|
261
|
+
default: '.'
|
|
262
|
+
})
|
|
293
263
|
}
|
|
294
|
-
]
|
|
295
264
|
|
|
296
265
|
module.exports = Pack
|
package/src/commands/app/run.js
CHANGED
|
@@ -15,8 +15,9 @@ const chalk = require('chalk')
|
|
|
15
15
|
const fs = require('fs-extra')
|
|
16
16
|
const https = require('https')
|
|
17
17
|
const getPort = require('get-port')
|
|
18
|
+
const open = require('open')
|
|
18
19
|
|
|
19
|
-
const { Flags,
|
|
20
|
+
const { Flags, ux } = require('@oclif/core')
|
|
20
21
|
const coreConfig = require('@adobe/aio-lib-core-config')
|
|
21
22
|
|
|
22
23
|
const BaseCommand = require('../../BaseCommand')
|
|
@@ -117,7 +118,7 @@ class Run extends BaseCommand {
|
|
|
117
118
|
const launchUrl = this.getLaunchUrlPrefix() + frontendUrl
|
|
118
119
|
if (flags.open) {
|
|
119
120
|
this.log(chalk.blue(chalk.bold(`Opening your deployed application in the Experience Cloud shell:\n -> ${launchUrl}`)))
|
|
120
|
-
|
|
121
|
+
open(launchUrl)
|
|
121
122
|
} else {
|
|
122
123
|
this.log(chalk.blue(chalk.bold(`To view your deployed application in the Experience Cloud shell:\n -> ${launchUrl}`)))
|
|
123
124
|
}
|
|
@@ -178,17 +179,17 @@ class Run extends BaseCommand {
|
|
|
178
179
|
const actualPort = await getPort({ port })
|
|
179
180
|
server.listen(actualPort)
|
|
180
181
|
this.log('A self signed development certificate has been generated, you will need to accept it in your browser in order to use it.')
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
open(`https://localhost:${actualPort}`)
|
|
183
|
+
ux.action.start('Waiting for the certificate to be accepted.')
|
|
183
184
|
// eslint-disable-next-line no-unmodified-loop-condition
|
|
184
185
|
while (!certAccepted && Date.now() - startTime < 20000) {
|
|
185
|
-
await
|
|
186
|
+
await ux.wait()
|
|
186
187
|
}
|
|
187
188
|
if (certAccepted) {
|
|
188
|
-
|
|
189
|
+
ux.action.stop()
|
|
189
190
|
this.log('Great, you accepted the certificate!')
|
|
190
191
|
} else {
|
|
191
|
-
|
|
192
|
+
ux.action.stop('timed out')
|
|
192
193
|
}
|
|
193
194
|
server.close()
|
|
194
195
|
|
|
@@ -198,6 +199,8 @@ class Run extends BaseCommand {
|
|
|
198
199
|
|
|
199
200
|
Run.description = 'Run an Adobe I/O App'
|
|
200
201
|
|
|
202
|
+
Run.args = {}
|
|
203
|
+
|
|
201
204
|
Run.flags = {
|
|
202
205
|
...BaseCommand.flags,
|
|
203
206
|
local: Flags.boolean({
|
|
@@ -12,7 +12,6 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
|
|
13
13
|
const ora = require('ora')
|
|
14
14
|
const chalk = require('chalk')
|
|
15
|
-
// const path = require('path')
|
|
16
15
|
|
|
17
16
|
const { Flags } = require('@oclif/core')
|
|
18
17
|
|
|
@@ -79,6 +78,14 @@ class Undeploy extends BaseCommand {
|
|
|
79
78
|
// undeploy
|
|
80
79
|
try {
|
|
81
80
|
await runInProcess(config.hooks['pre-app-undeploy'], config)
|
|
81
|
+
if (flags['feature-event-hooks'] && flags.events) {
|
|
82
|
+
this.log('feature-event-hooks is enabled, running pre-undeploy-event-reg hook')
|
|
83
|
+
const hookResults = await this.config.runHook('pre-undeploy-event-reg', { appConfig: config })
|
|
84
|
+
if (hookResults?.failures?.length > 0) {
|
|
85
|
+
// output should be "Error : <plugin-name> : <error-message>\n" for each failure
|
|
86
|
+
this.error(hookResults.failures.map(f => `${f.plugin.name} : ${f.error.message}`).join('\nError: '), { exit: 1 })
|
|
87
|
+
}
|
|
88
|
+
}
|
|
82
89
|
} catch (err) {
|
|
83
90
|
this.log(err)
|
|
84
91
|
}
|
|
@@ -86,7 +93,6 @@ class Undeploy extends BaseCommand {
|
|
|
86
93
|
if (flags.actions) {
|
|
87
94
|
if (config.app.hasBackend) {
|
|
88
95
|
try {
|
|
89
|
-
this.config.runHook('pre-undeploy-event-reg', { appConfig: config })
|
|
90
96
|
const script = await runInProcess(config.hooks['undeploy-actions'], config)
|
|
91
97
|
if (!script) {
|
|
92
98
|
await rtLib.undeployActions(config)
|
|
@@ -118,16 +124,7 @@ class Undeploy extends BaseCommand {
|
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
try {
|
|
121
|
-
this.config.runHook('post-undeploy-event-reg', { appConfig: config })
|
|
122
127
|
await runInProcess(config.hooks['post-app-undeploy'], config)
|
|
123
|
-
if (flags['feature-event-hooks'] && flags.events) {
|
|
124
|
-
this.log('feature-event-hooks is enabled, running post-undeploy-event-reg hook')
|
|
125
|
-
const hookResults = await this.config.runHook('post-undeploy-event-reg', { appConfig: config })
|
|
126
|
-
if (hookResults?.failures?.length > 0) {
|
|
127
|
-
// output should be "Error : <plugin-name> : <error-message>\n" for each failure
|
|
128
|
-
this.error(hookResults.failures.map(f => `${f.plugin.name} : ${f.error.message}`).join('\nError: '), { exit: 1 })
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
128
|
} catch (err) {
|
|
132
129
|
this.log(err)
|
|
133
130
|
}
|
|
@@ -190,6 +187,6 @@ Undeploy.flags = {
|
|
|
190
187
|
})
|
|
191
188
|
}
|
|
192
189
|
|
|
193
|
-
Undeploy.args =
|
|
190
|
+
Undeploy.args = {}
|
|
194
191
|
|
|
195
192
|
module.exports = Undeploy
|
package/src/commands/app/use.js
CHANGED
|
@@ -12,7 +12,7 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
const BaseCommand = require('../../BaseCommand')
|
|
13
13
|
const { CONSOLE_CONFIG_KEY, getProjectCredentialType } = require('../../lib/import-helper')
|
|
14
14
|
const { importConsoleConfig, downloadConsoleConfigToBuffer } = require('../../lib/import')
|
|
15
|
-
const { Flags } = require('@oclif/core')
|
|
15
|
+
const { Flags, Args } = require('@oclif/core')
|
|
16
16
|
const inquirer = require('inquirer')
|
|
17
17
|
const config = require('@adobe/aio-lib-core-config')
|
|
18
18
|
const { EOL } = require('os')
|
|
@@ -341,7 +341,7 @@ If the optional configuration file is not set, this command will retrieve the co
|
|
|
341
341
|
|
|
342
342
|
To set these global config values, see the help text for 'aio console --help'.
|
|
343
343
|
|
|
344
|
-
To download the configuration file for your project, select the 'Download' button in the toolbar of your project's page in https://
|
|
344
|
+
To download the configuration file for your project, select the 'Download' button in the toolbar of your project's page in https://developer.adobe.com/console/
|
|
345
345
|
`
|
|
346
346
|
|
|
347
347
|
Use.flags = {
|
|
@@ -398,12 +398,12 @@ Use.flags = {
|
|
|
398
398
|
})
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
Use.args =
|
|
401
|
+
Use.args =
|
|
402
402
|
{
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
403
|
+
config_file_path: Args.string({
|
|
404
|
+
description: 'path to an Adobe I/O Developer Console configuration file',
|
|
405
|
+
required: false
|
|
406
|
+
})
|
|
406
407
|
}
|
|
407
|
-
]
|
|
408
408
|
|
|
409
409
|
module.exports = Use
|
package/src/lib/app-helper.js
CHANGED
|
@@ -71,6 +71,7 @@ async function installPackages (dir, options = { spinner: null, verbose: false }
|
|
|
71
71
|
* @param {string} scriptName npm script name
|
|
72
72
|
* @param {string} dir directory to run npm script in
|
|
73
73
|
* @param {string[]} cmdArgs args to pass to npm script
|
|
74
|
+
* @returns {object} the child process
|
|
74
75
|
*/
|
|
75
76
|
async function runPackageScript (scriptName, dir, cmdArgs = []) {
|
|
76
77
|
aioLogger.debug(`running npm run-script ${scriptName} in dir: ${dir}`)
|
|
@@ -85,7 +86,6 @@ async function runPackageScript (scriptName, dir, cmdArgs = []) {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
/**
|
|
88
|
-
*
|
|
89
89
|
* @param {string} hookPath to be require()'d and run. Should export an async function that takes a config object as its only argument
|
|
90
90
|
* @param {object} config which will be passed to the hook
|
|
91
91
|
* @returns {Promise<*>} whatever the hook returns
|
|
@@ -357,7 +357,7 @@ async function runOpenWhiskJar (jarFile, runtimeConfigFile, apihost, waitInitTim
|
|
|
357
357
|
|
|
358
358
|
/**
|
|
359
359
|
*
|
|
360
|
-
*
|
|
360
|
+
*Converts a service array to an input string that can be consumed by generator-aio-app
|
|
361
361
|
*
|
|
362
362
|
* @param {Array} services array of services [{ code: 'xxx', name: 'xxx' }, ...]
|
|
363
363
|
* @returns {string} 'code1,code2,code3'
|
package/src/lib/import-helper.js
CHANGED
|
@@ -200,24 +200,24 @@ async function checkFileConflict (filePath) {
|
|
|
200
200
|
* Transform a json object to a flattened version. Any nesting is separated by the `separator` string.
|
|
201
201
|
* For example, if you have the `_` separator string, flattening this:
|
|
202
202
|
*
|
|
203
|
+
* @example
|
|
203
204
|
* {
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
205
|
+
* foo: {
|
|
206
|
+
* bar: 'a',
|
|
207
|
+
* baz: {
|
|
208
|
+
* faz: 'b'
|
|
209
|
+
* }
|
|
210
|
+
* }
|
|
210
211
|
* }
|
|
211
212
|
*
|
|
212
213
|
* const result = flattenObjectWithSeparator(json, {}, '', '_)
|
|
213
214
|
* The result would then be:
|
|
214
215
|
* {
|
|
215
|
-
*
|
|
216
|
-
*
|
|
216
|
+
* 'foo_bar': 'a',
|
|
217
|
+
* 'foo_baz_faz': 'b'
|
|
217
218
|
* }
|
|
218
219
|
*
|
|
219
220
|
* Any underscores in the object key are escaped with an underscore.
|
|
220
|
-
*
|
|
221
221
|
* @param {object} json the json object to transform
|
|
222
222
|
* @param {object} result the result object to initialize the function with
|
|
223
223
|
* @param {string} prefix the prefix to add to the final key
|