@adobe/aio-cli-plugin-app 13.1.2 → 13.2.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 +158 -158
- package/oclif.manifest.json +1239 -895
- package/package.json +11 -11
- package/src/commands/app/build.js +2 -2
- package/src/commands/app/deploy.js +5 -19
- package/src/commands/app/undeploy.js +2 -2
- package/src/lib/actions-watcher.js +7 -1
- package/src/lib/app-helper.js +4 -2
- package/src/lib/deploy-actions.js +31 -39
- package/src/lib/log-actions.js +52 -0
- package/src/lib/run-dev.js +12 -1
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/aio-cli-plugin-app",
|
|
3
3
|
"description": "Create, Build and Deploy Adobe I/O Applications",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.2.0",
|
|
5
5
|
"author": "Adobe Inc.",
|
|
6
6
|
"bugs": "https://github.com/adobe/aio-cli-plugin-app/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@adobe/aio-cli-lib-app-config": "^4",
|
|
8
|
+
"@adobe/aio-cli-lib-app-config": "^4.0.3",
|
|
9
9
|
"@adobe/aio-cli-lib-console": "^5",
|
|
10
10
|
"@adobe/aio-lib-core-config": "^5",
|
|
11
11
|
"@adobe/aio-lib-core-logging": "^3",
|
|
12
12
|
"@adobe/aio-lib-core-networking": "^5",
|
|
13
13
|
"@adobe/aio-lib-env": "^3",
|
|
14
14
|
"@adobe/aio-lib-ims": "^7",
|
|
15
|
-
"@adobe/aio-lib-runtime": "^7.0.
|
|
15
|
+
"@adobe/aio-lib-runtime": "^7.0.1",
|
|
16
16
|
"@adobe/aio-lib-templates": "^3",
|
|
17
17
|
"@adobe/aio-lib-web": "^7",
|
|
18
18
|
"@adobe/generator-aio-app": "^7",
|
|
@@ -54,22 +54,22 @@
|
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@adobe/aio-lib-test-proxy": "^2",
|
|
57
|
-
"@adobe/eslint-config-aio-lib-config": "^
|
|
57
|
+
"@adobe/eslint-config-aio-lib-config": "^4.0.0",
|
|
58
58
|
"@types/jest": "^29",
|
|
59
59
|
"babel-runtime": "^6.26.0",
|
|
60
60
|
"core-js": "^3",
|
|
61
61
|
"eol": "^0.9.1",
|
|
62
|
-
"eslint": "^8.
|
|
62
|
+
"eslint": "^8.57.1",
|
|
63
63
|
"eslint-config-standard": "^17.1.0",
|
|
64
|
-
"eslint-plugin-import": "^2.
|
|
65
|
-
"eslint-plugin-jest": "^27.
|
|
66
|
-
"eslint-plugin-jsdoc": "^
|
|
67
|
-
"eslint-plugin-n": "^15.7",
|
|
64
|
+
"eslint-plugin-import": "^2.31.0",
|
|
65
|
+
"eslint-plugin-jest": "^27.9.0",
|
|
66
|
+
"eslint-plugin-jsdoc": "^48.11.0",
|
|
67
|
+
"eslint-plugin-n": "^15.7.0",
|
|
68
68
|
"eslint-plugin-node": "^11.1.0",
|
|
69
|
-
"eslint-plugin-promise": "^6.
|
|
69
|
+
"eslint-plugin-promise": "^6.6.0",
|
|
70
70
|
"jest": "^29.5.0",
|
|
71
71
|
"nock": "^13.2.9",
|
|
72
|
-
"oclif": "^
|
|
72
|
+
"oclif": "^4.17.13",
|
|
73
73
|
"stdout-stderr": "^0.1.9"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
@@ -167,8 +167,8 @@ Build.flags = {
|
|
|
167
167
|
allowNo: true
|
|
168
168
|
}),
|
|
169
169
|
'force-build': Flags.boolean({
|
|
170
|
-
description: '[default:
|
|
171
|
-
default:
|
|
170
|
+
description: '[default: true] Force a build even if one already exists',
|
|
171
|
+
default: true,
|
|
172
172
|
allowNo: true
|
|
173
173
|
}),
|
|
174
174
|
'content-hash': Flags.boolean({
|
|
@@ -18,10 +18,11 @@ const BaseCommand = require('../../BaseCommand')
|
|
|
18
18
|
const BuildCommand = require('./build')
|
|
19
19
|
const webLib = require('@adobe/aio-lib-web')
|
|
20
20
|
const { Flags } = require('@oclif/core')
|
|
21
|
-
const {
|
|
21
|
+
const { runInProcess, buildExtensionPointPayloadWoMetadata, buildExcShellViewExtensionMetadata, getCliInfo } = require('../../lib/app-helper')
|
|
22
22
|
const rtLib = require('@adobe/aio-lib-runtime')
|
|
23
23
|
const LogForwarding = require('../../lib/log-forwarding')
|
|
24
24
|
const { sendAuditLogs, getAuditLogEvent, getFilesCountWithExtension } = require('../../lib/audit-logger')
|
|
25
|
+
const logActions = require('../../lib/log-actions')
|
|
25
26
|
|
|
26
27
|
const PRE_DEPLOY_EVENT_REG = 'pre-deploy-event-reg'
|
|
27
28
|
const POST_DEPLOY_EVENT_REG = 'post-deploy-event-reg'
|
|
@@ -235,24 +236,9 @@ class Deploy extends BuildCommand {
|
|
|
235
236
|
|
|
236
237
|
// log deployed resources
|
|
237
238
|
if (deployedRuntimeEntities.actions && deployedRuntimeEntities.actions.length > 0) {
|
|
238
|
-
this.log(chalk.
|
|
239
|
-
const web = deployedRuntimeEntities.actions.filter(createWebExportFilter(true))
|
|
240
|
-
const nonWeb = deployedRuntimeEntities.actions.filter(createWebExportFilter(false))
|
|
241
|
-
|
|
242
|
-
if (web.length > 0) {
|
|
243
|
-
this.log('web actions:')
|
|
244
|
-
web.forEach(a => {
|
|
245
|
-
this.log(chalk.blue(chalk.bold(` -> ${a.url || a.name} `)))
|
|
246
|
-
})
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if (nonWeb.length > 0) {
|
|
250
|
-
this.log('non-web actions:')
|
|
251
|
-
nonWeb.forEach(a => {
|
|
252
|
-
this.log(chalk.blue(chalk.bold(` -> ${a.url || a.name} `)))
|
|
253
|
-
})
|
|
254
|
-
}
|
|
239
|
+
await logActions({ entities: deployedRuntimeEntities, log: (...rest) => this.log(chalk.bold(chalk.blue(...rest))) })
|
|
255
240
|
}
|
|
241
|
+
|
|
256
242
|
// TODO urls should depend on extension point, exc shell only for exc shell extension point - use a post-app-deploy hook ?
|
|
257
243
|
if (deployedFrontendUrl) {
|
|
258
244
|
this.log(chalk.blue(chalk.bold(`To view your deployed application:\n -> ${deployedFrontendUrl}`)))
|
|
@@ -342,7 +328,7 @@ Deploy.flags = {
|
|
|
342
328
|
'force-build': Flags.boolean({
|
|
343
329
|
description: '[default: true] Force a build even if one already exists',
|
|
344
330
|
exclusive: ['no-build'], // no-build
|
|
345
|
-
default:
|
|
331
|
+
default: true,
|
|
346
332
|
allowNo: true
|
|
347
333
|
}),
|
|
348
334
|
'content-hash': Flags.boolean({
|
|
@@ -112,9 +112,9 @@ class Undeploy extends BaseCommand {
|
|
|
112
112
|
if (!script) {
|
|
113
113
|
await rtLib.undeployActions(config)
|
|
114
114
|
}
|
|
115
|
-
spinner.succeed(chalk.green(`Un-
|
|
115
|
+
spinner.succeed(chalk.green(`Un-deploying actions for ${extName}`))
|
|
116
116
|
} catch (err) {
|
|
117
|
-
spinner.fail(chalk.green(`Un-
|
|
117
|
+
spinner.fail(chalk.green(`Un-deploying actions for ${extName}`))
|
|
118
118
|
throw err
|
|
119
119
|
}
|
|
120
120
|
} else {
|
|
@@ -63,7 +63,13 @@ module.exports = async (watcherOptions) => {
|
|
|
63
63
|
async function buildAndDeploy (watcherOptions, filterActions) {
|
|
64
64
|
const { config, isLocal, log, inprocHook } = watcherOptions
|
|
65
65
|
await buildActions(config, filterActions)
|
|
66
|
-
|
|
66
|
+
const deployConfig = {
|
|
67
|
+
isLocalDev: isLocal,
|
|
68
|
+
filterEntities: {
|
|
69
|
+
actions: filterActions
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
await deployActions({ config, deployConfig, log, inprocHook })
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
/**
|
package/src/lib/app-helper.js
CHANGED
|
@@ -551,11 +551,13 @@ function deleteUserConfig (configData) {
|
|
|
551
551
|
/** @private */
|
|
552
552
|
const createWebExportFilter = (filterValue) => {
|
|
553
553
|
return (action) => {
|
|
554
|
-
if (!action
|
|
554
|
+
if (!action) {
|
|
555
555
|
return false
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
-
|
|
558
|
+
// if no annotations, its as if web-export = false
|
|
559
|
+
const webExportValue = action.annotations?.['web-export'] ?? false
|
|
560
|
+
return String(!!webExportValue) === String(filterValue)
|
|
559
561
|
}
|
|
560
562
|
}
|
|
561
563
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
3
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -10,60 +10,52 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
const { runInProcess
|
|
13
|
+
const { runInProcess } = require('./app-helper')
|
|
14
14
|
const { deployActions } = require('@adobe/aio-lib-runtime')
|
|
15
|
+
const logActions = require('./log-actions')
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Deploys actions.
|
|
18
19
|
*
|
|
19
|
-
* @
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
20
|
+
* @private
|
|
21
|
+
* @param {object} options
|
|
22
|
+
* @param {object} options.config see src/lib/config-loader.js
|
|
23
|
+
* @param {object} [options.deployConfig] see https://github.com/adobe/aio-lib-runtime/blob/master/README.md#typedefs
|
|
24
|
+
* @param {Function} [options.log] a log function
|
|
25
|
+
* @param {Function} [options.inprocHook] a hook function
|
|
23
26
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
module.exports = async ({
|
|
28
|
+
config,
|
|
29
|
+
deployConfig = {},
|
|
30
|
+
log = () => {},
|
|
31
|
+
inprocHook
|
|
32
|
+
}) => {
|
|
26
33
|
await runInProcess(config.hooks['pre-app-deploy'], config)
|
|
27
|
-
|
|
34
|
+
|
|
35
|
+
const hookFilterEntities = Array.isArray(deployConfig.filterEntities?.actions) ? deployConfig.filterEntities.actions : []
|
|
36
|
+
const hookData = {
|
|
37
|
+
appConfig: config,
|
|
38
|
+
filterEntities: hookFilterEntities,
|
|
39
|
+
isLocalDev: deployConfig.isLocalDev
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let entities
|
|
43
|
+
const script = await runInProcess(config.hooks['deploy-actions'], hookData)
|
|
28
44
|
if (!script) {
|
|
29
|
-
const deployConfig = {
|
|
30
|
-
isLocalDev,
|
|
31
|
-
filterEntities: {
|
|
32
|
-
byBuiltActions: filter
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
45
|
if (inprocHook) {
|
|
36
|
-
const
|
|
37
|
-
const hookResults = await inprocHook('deploy-actions', {
|
|
38
|
-
appConfig: config,
|
|
39
|
-
filterEntities: hookFilterEntities,
|
|
40
|
-
isLocalDev
|
|
41
|
-
})
|
|
46
|
+
const hookResults = await inprocHook('deploy-actions', hookData)
|
|
42
47
|
if (hookResults?.failures?.length > 0) {
|
|
43
48
|
// output should be "Error : <plugin-name> : <error-message>\n" for each failure
|
|
44
49
|
log('Error: ' + hookResults.failures.map(f => `${f.plugin.name} : ${f.error.message}`).join('\nError: '))
|
|
45
50
|
throw new Error(`Hook 'deploy-actions' failed with ${hookResults.failures[0].error}`)
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
|
-
const entities = await deployActions(config, deployConfig, log)
|
|
49
|
-
if (entities.actions) {
|
|
50
|
-
const web = entities.actions.filter(createWebExportFilter(true))
|
|
51
|
-
const nonWeb = entities.actions.filter(createWebExportFilter(false))
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
web.forEach(a => {
|
|
56
|
-
log(` -> ${a.url || a.name}`)
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (nonWeb.length > 0) {
|
|
61
|
-
log('non-web actions:')
|
|
62
|
-
nonWeb.forEach(a => {
|
|
63
|
-
log(` -> ${a.url || a.name}`)
|
|
64
|
-
})
|
|
65
|
-
}
|
|
66
|
-
}
|
|
54
|
+
entities = await deployActions(config, deployConfig, log)
|
|
55
|
+
await logActions({ entities, log })
|
|
67
56
|
}
|
|
57
|
+
|
|
68
58
|
await runInProcess(config.hooks['post-app-deploy'], config)
|
|
59
|
+
|
|
60
|
+
return { script, entities }
|
|
69
61
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONSTJ
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const { createWebExportFilter } = require('./app-helper')
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Logs deployed action entities.
|
|
17
|
+
*
|
|
18
|
+
* @private
|
|
19
|
+
* @param {object} options
|
|
20
|
+
* @param {object} options.entities runtime entities that have been deployed
|
|
21
|
+
* @param {object} [options.deployConfig] see https://github.com/adobe/aio-lib-runtime?tab=readme-ov-file#typedefs
|
|
22
|
+
* @param {Function} [options.log] a log function
|
|
23
|
+
*/
|
|
24
|
+
module.exports = async ({
|
|
25
|
+
entities,
|
|
26
|
+
log = console.log
|
|
27
|
+
}) => {
|
|
28
|
+
if (!entities.actions) {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
log('Your deployed actions:')
|
|
33
|
+
|
|
34
|
+
const _web = entities.actions.filter(createWebExportFilter(true))
|
|
35
|
+
const _webRaw = entities.actions.filter(createWebExportFilter('raw'))
|
|
36
|
+
const web = [..._web, ..._webRaw]
|
|
37
|
+
const nonWeb = entities.actions.filter(createWebExportFilter(false))
|
|
38
|
+
|
|
39
|
+
if (web.length > 0) {
|
|
40
|
+
log('web actions:')
|
|
41
|
+
web.forEach(a => {
|
|
42
|
+
log(` -> ${a.url || a.name}`)
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (nonWeb.length > 0) {
|
|
47
|
+
log('non-web actions:')
|
|
48
|
+
nonWeb.forEach(a => {
|
|
49
|
+
log(` -> ${a.url || a.name}`)
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
}
|
package/src/lib/run-dev.js
CHANGED
|
@@ -122,7 +122,18 @@ async function runDev (config, dataDir, options = {}, log = () => {}, inprocHook
|
|
|
122
122
|
// Deploy Phase - deploy actions
|
|
123
123
|
if (withBackend) {
|
|
124
124
|
log('redeploying actions..')
|
|
125
|
-
|
|
125
|
+
const deployConfig = {
|
|
126
|
+
isLocalDev: isLocal,
|
|
127
|
+
filterEntities: {
|
|
128
|
+
byBuiltActions: true
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
await deployActions({
|
|
132
|
+
config: devConfig,
|
|
133
|
+
deployConfig,
|
|
134
|
+
log,
|
|
135
|
+
inprocHook
|
|
136
|
+
})
|
|
126
137
|
}
|
|
127
138
|
|
|
128
139
|
// Deploy Phase - serve the web UI
|