@adobe/aio-cli-plugin-app 14.3.2 → 14.4.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 +222 -188
- package/oclif.manifest.json +224 -2
- package/package.json +1 -1
- package/src/BaseCommand.js +19 -14
- package/src/commands/app/add/action.js +1 -1
- package/src/commands/app/add/event.js +2 -2
- package/src/commands/app/add/extension.js +1 -1
- package/src/commands/app/add/web-assets.js +1 -1
- package/src/commands/app/config/get/log-forwarding/errors.js +7 -3
- package/src/commands/app/config/get/log-forwarding.js +6 -1
- package/src/commands/app/config/set/log-forwarding.js +5 -1
- package/src/commands/app/delete/action.js +11 -11
- package/src/commands/app/delete/extension.js +5 -5
- package/src/commands/app/delete/web-assets.js +1 -1
- package/src/commands/app/deploy.js +1 -1
- package/src/commands/app/get-url.js +5 -5
- package/src/commands/app/info.js +1 -1
- package/src/commands/app/logs.js +1 -1
- package/src/commands/app/pack.js +32 -7
- package/src/commands/app/test.js +2 -1
- package/src/commands/app/undeploy.js +1 -1
|
@@ -16,7 +16,8 @@ const { setRuntimeApiHostAndAuthHandler } = require('../../../../lib/auth-helper
|
|
|
16
16
|
|
|
17
17
|
class LogForwardingCommand extends BaseCommand {
|
|
18
18
|
async run () {
|
|
19
|
-
|
|
19
|
+
const { flags } = await this.parse(LogForwardingCommand)
|
|
20
|
+
let aioConfig = (await this.getFullConfig({}, flags)).aio
|
|
20
21
|
aioConfig = setRuntimeApiHostAndAuthHandler(aioConfig)
|
|
21
22
|
const lf = await LogForwarding.init(aioConfig)
|
|
22
23
|
|
|
@@ -50,5 +51,8 @@ class LogForwardingCommand extends BaseCommand {
|
|
|
50
51
|
|
|
51
52
|
LogForwardingCommand.description = 'Set log forwarding destination configuration'
|
|
52
53
|
LogForwardingCommand.aliases = ['app:config:set:log-forwarding', 'app:config:set:lf']
|
|
54
|
+
LogForwardingCommand.flags = {
|
|
55
|
+
...BaseCommand.flags
|
|
56
|
+
}
|
|
53
57
|
|
|
54
58
|
module.exports = LogForwardingCommand
|
|
@@ -30,8 +30,8 @@ class DeleteActionCommand extends BaseCommand {
|
|
|
30
30
|
this.error('<action-name> must also be provided when using --yes')
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const fullConfig = await this.getFullConfig()
|
|
34
|
-
const { actions, actionsByImpl } = await this.getAllActions(fullConfig)
|
|
33
|
+
const fullConfig = await this.getFullConfig({}, flags)
|
|
34
|
+
const { actions, actionsByImpl } = await this.getAllActions(fullConfig, flags)
|
|
35
35
|
if (actions.length <= 0) {
|
|
36
36
|
this.error('There are no actions in this project!')
|
|
37
37
|
}
|
|
@@ -108,7 +108,7 @@ class DeleteActionCommand extends BaseCommand {
|
|
|
108
108
|
)))
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
async getAllActions (config) {
|
|
111
|
+
async getAllActions (config, flags = {}) {
|
|
112
112
|
const actions = []
|
|
113
113
|
const actionsByImpl = {}
|
|
114
114
|
const allConfigEntries = Object.entries(config.all)
|
|
@@ -121,7 +121,7 @@ class DeleteActionCommand extends BaseCommand {
|
|
|
121
121
|
for (const [actionName, action] of actionEntries) {
|
|
122
122
|
const fullActionName = `${pkgName}/${actionName}`
|
|
123
123
|
const startKey = implName === 'application' ? 'application' : `extensions.${implName}`
|
|
124
|
-
const configData = await this.getConfigFileForKey(`${startKey}.runtimeManifest.packages.${pkgName}.actions.${actionName}
|
|
124
|
+
const configData = await this.getConfigFileForKey(`${startKey}.runtimeManifest.packages.${pkgName}.actions.${actionName}`, flags)
|
|
125
125
|
const actionObj = {
|
|
126
126
|
// assumes path is not relative
|
|
127
127
|
path: action.function,
|
|
@@ -157,13 +157,13 @@ DeleteActionCommand.flags = {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
DeleteActionCommand.args =
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
{
|
|
161
|
+
'action-name': Args.string({
|
|
162
|
+
description: 'Action `pkg/name` to delete, you can specify multiple actions via a comma separated list',
|
|
163
|
+
default: '',
|
|
164
|
+
required: false
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
167
|
|
|
168
168
|
DeleteActionCommand.aliases = ['app:delete:actions']
|
|
169
169
|
|
|
@@ -28,7 +28,7 @@ class DeleteExtensionCommand extends BaseCommand {
|
|
|
28
28
|
this.error('--extension= must also be provided when using --yes')
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const fullConfig = await this.getFullConfig({ allowNoImpl: true })
|
|
31
|
+
const fullConfig = await this.getFullConfig({ allowNoImpl: true }, flags)
|
|
32
32
|
const configs = await this.selectOrGetConfigsToDelete(flags, fullConfig)
|
|
33
33
|
|
|
34
34
|
const resConfirm = await this.prompt([
|
|
@@ -44,7 +44,7 @@ class DeleteExtensionCommand extends BaseCommand {
|
|
|
44
44
|
this.error('aborting..')
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
await this.deleteImplementations(configs)
|
|
47
|
+
await this.deleteImplementations(configs, flags)
|
|
48
48
|
|
|
49
49
|
this.log(chalk.bold(chalk.green(
|
|
50
50
|
`✔ Successfully deleted implementation(s) '${Object.keys(configs)}'` + EOL +
|
|
@@ -71,7 +71,7 @@ class DeleteExtensionCommand extends BaseCommand {
|
|
|
71
71
|
return await this.getAppExtConfigs(flags)
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
async deleteImplementations (configs) {
|
|
74
|
+
async deleteImplementations (configs, flags) {
|
|
75
75
|
for (const [id, c] of Object.entries(configs)) {
|
|
76
76
|
// delete actions
|
|
77
77
|
if (c.app.hasBackend) {
|
|
@@ -89,12 +89,12 @@ class DeleteExtensionCommand extends BaseCommand {
|
|
|
89
89
|
// delete config
|
|
90
90
|
// try to find another config file => case of init extension in another folder
|
|
91
91
|
const configKey = id === 'application' ? 'application' : `extensions.${id}`
|
|
92
|
-
const configDataOp = await this.getConfigFileForKey(configKey + '.operations')
|
|
92
|
+
const configDataOp = await this.getConfigFileForKey(configKey + '.operations', flags)
|
|
93
93
|
if (configDataOp.file) {
|
|
94
94
|
fs.removeSync(configDataOp.file)
|
|
95
95
|
}
|
|
96
96
|
// delete config in parent config file
|
|
97
|
-
const configData = await this.getConfigFileForKey(configKey)
|
|
97
|
+
const configData = await this.getConfigFileForKey(configKey, flags)
|
|
98
98
|
deleteUserConfig(configData)
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -25,7 +25,7 @@ class DeleteWebAssetsCommand extends BaseCommand {
|
|
|
25
25
|
|
|
26
26
|
aioLogger.debug(`deleting web assets from the project, using flags: ${JSON.stringify(flags)}`)
|
|
27
27
|
|
|
28
|
-
const fullConfig = await this.getFullConfig()
|
|
28
|
+
const fullConfig = await this.getFullConfig({}, flags)
|
|
29
29
|
const webAssetsByImpl = this.getAllWebAssets(fullConfig)
|
|
30
30
|
if (!webAssetsByImpl) {
|
|
31
31
|
this.error('web-assets not found')
|
|
@@ -57,7 +57,7 @@ class Deploy extends BuildCommand {
|
|
|
57
57
|
const spinner = ora()
|
|
58
58
|
|
|
59
59
|
try {
|
|
60
|
-
const { aio: aioConfig, packagejson: packageJson } = await this.getFullConfig()
|
|
60
|
+
const { aio: aioConfig, packagejson: packageJson } = await this.getFullConfig({}, flags)
|
|
61
61
|
const cliDetails = await getAccessToken({ useCachedToken: !flags.publish })
|
|
62
62
|
const appInfo = {
|
|
63
63
|
name: packageJson.name,
|
|
@@ -30,7 +30,7 @@ class GetUrlCommand extends BaseCommand {
|
|
|
30
30
|
options.cdn = flags.cdn
|
|
31
31
|
|
|
32
32
|
const urls = {}
|
|
33
|
-
const fullConfig = await this.getFullConfig()
|
|
33
|
+
const fullConfig = await this.getFullConfig({}, flags)
|
|
34
34
|
if (options.action) {
|
|
35
35
|
let action
|
|
36
36
|
// search for action
|
|
@@ -107,9 +107,9 @@ GetUrlCommand.flags = {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
GetUrlCommand.args =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
{
|
|
111
|
+
action: Args.string({
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
114
|
|
|
115
115
|
module.exports = GetUrlCommand
|
package/src/commands/app/info.js
CHANGED
|
@@ -19,7 +19,7 @@ class Info extends BaseCommand {
|
|
|
19
19
|
async run () {
|
|
20
20
|
// cli input
|
|
21
21
|
const { flags } = await this.parse(Info)
|
|
22
|
-
const appConfig = deepCopy(await this.getFullConfig({ allowNoImpl: true }))
|
|
22
|
+
const appConfig = deepCopy(await this.getFullConfig({ allowNoImpl: true }, flags))
|
|
23
23
|
|
|
24
24
|
// includes .env secret delete all aio config for now
|
|
25
25
|
delete appConfig.aio
|
package/src/commands/app/logs.js
CHANGED
|
@@ -36,7 +36,7 @@ class Logs extends BaseCommand {
|
|
|
36
36
|
|
|
37
37
|
async run () {
|
|
38
38
|
const { flags } = await this.parse(Logs)
|
|
39
|
-
const fullConfig = await this.getFullConfig()
|
|
39
|
+
const fullConfig = await this.getFullConfig({}, flags)
|
|
40
40
|
|
|
41
41
|
// has any backend
|
|
42
42
|
const hasAnyBackend = Object.values(fullConfig.all).reduce((hasBackend, config) => hasBackend && config.app.hasBackend, true)
|
package/src/commands/app/pack.js
CHANGED
|
@@ -57,6 +57,11 @@ class Pack extends BaseCommand {
|
|
|
57
57
|
.map(([, extConfig]) => path.relative(process.cwd(), extConfig.app.dist))
|
|
58
58
|
|
|
59
59
|
try {
|
|
60
|
+
// 0. validate package.json and package-lock.json compatibility (skip if --no-lock-file)
|
|
61
|
+
if (flags['lock-file']) {
|
|
62
|
+
await this.validatePackageLockCompatibility()
|
|
63
|
+
}
|
|
64
|
+
|
|
60
65
|
// 1. create artifacts phase
|
|
61
66
|
this.spinner.start(`Creating package artifacts folder '${DEFAULTS.ARTIFACTS_FOLDER_PATH}'...`)
|
|
62
67
|
await fs.emptyDir(DEFAULTS.ARTIFACTS_FOLDER_PATH)
|
|
@@ -127,6 +132,26 @@ class Pack extends BaseCommand {
|
|
|
127
132
|
return this._spinner
|
|
128
133
|
}
|
|
129
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Validates that package.json and package-lock.json are compatible
|
|
137
|
+
*/
|
|
138
|
+
async validatePackageLockCompatibility () {
|
|
139
|
+
const packageLockPath = path.join(process.cwd(), 'package-lock.json')
|
|
140
|
+
if (!(await fs.pathExists(packageLockPath))) {
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
this.spinner.start('Validating package.json and package-lock.json compatibility...')
|
|
145
|
+
try {
|
|
146
|
+
await execa('npm', ['ci', '--dry-run'], { cwd: process.cwd() })
|
|
147
|
+
this.spinner.succeed('Validated package.json and package-lock.json compatibility')
|
|
148
|
+
} catch (error) {
|
|
149
|
+
this.spinner.fail('package.json and package-lock.json are incompatible')
|
|
150
|
+
const errorMessage = error.stderr || error.message || 'npm ci --dry-run failed'
|
|
151
|
+
throw new Error(`package.json and package-lock.json are incompatible. Run 'npm install' to update your package-lock.json.\n\nError: ${errorMessage}`)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
130
155
|
/**
|
|
131
156
|
* Creates the deploy.yaml file
|
|
132
157
|
*
|
|
@@ -371,7 +396,7 @@ Pack.description = `This command will support packaging apps for redistribution.
|
|
|
371
396
|
Pack.flags = {
|
|
372
397
|
...BaseCommand.flags,
|
|
373
398
|
'lock-file': Flags.boolean({
|
|
374
|
-
description: 'Include the package-lock.json file in the packaged app',
|
|
399
|
+
description: 'Include the package-lock.json file in the packaged app. When disabled, compatibility validation is skipped since the provisioner will use npm install instead of npm ci.',
|
|
375
400
|
default: true,
|
|
376
401
|
allowNo: true
|
|
377
402
|
}),
|
|
@@ -383,11 +408,11 @@ Pack.flags = {
|
|
|
383
408
|
}
|
|
384
409
|
|
|
385
410
|
Pack.args =
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
411
|
+
{
|
|
412
|
+
path: Args.string({
|
|
413
|
+
description: 'Path to the app directory to package',
|
|
414
|
+
default: '.'
|
|
415
|
+
})
|
|
416
|
+
}
|
|
392
417
|
|
|
393
418
|
module.exports = Pack
|
package/src/commands/app/test.js
CHANGED
|
@@ -31,7 +31,7 @@ class Test extends BaseCommand {
|
|
|
31
31
|
unit = true
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const buildConfigs = await this.getAppExtConfigs({ extension })
|
|
34
|
+
const buildConfigs = await this.getAppExtConfigs(flags, { extension })
|
|
35
35
|
aioLogger.debug(`run buildConfigs:${JSON.stringify(buildConfigs, null, 2)}`)
|
|
36
36
|
|
|
37
37
|
const totalResults = []
|
|
@@ -202,6 +202,7 @@ class Test extends BaseCommand {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
Test.flags = {
|
|
205
|
+
...BaseCommand.flags,
|
|
205
206
|
extension: Flags.string({
|
|
206
207
|
char: 'e',
|
|
207
208
|
description: 'the extension(s) to test',
|
|
@@ -51,7 +51,7 @@ class Undeploy extends BaseCommand {
|
|
|
51
51
|
|
|
52
52
|
const spinner = ora()
|
|
53
53
|
try {
|
|
54
|
-
const { aio: aioConfig, packagejson: packageJson } = await this.getFullConfig()
|
|
54
|
+
const { aio: aioConfig, packagejson: packageJson } = await this.getFullConfig({}, flags)
|
|
55
55
|
const cliDetails = await getAccessToken({ useCachedToken: !flags.unpublish })
|
|
56
56
|
const appInfo = {
|
|
57
57
|
name: packageJson.name,
|