@adobe/aio-cli-plugin-app 10.0.3 → 10.1.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 +1 -1
- package/oclif.manifest.json +1654 -1
- package/package.json +4 -4
- package/src/TemplatesCommand.js +8 -0
- package/src/commands/app/add/service.js +11 -2
- package/src/commands/app/deploy.js +6 -1
- package/src/commands/app/init.js +1 -1
- package/src/commands/app/run.js +2 -2
- package/src/commands/app/use.js +6 -35
- package/src/lib/actions-watcher.js +2 -3
- package/src/lib/deploy-actions.js +9 -1
- package/src/lib/import-helper.js +631 -0
- package/src/lib/import.js +35 -614
- package/src/lib/log-forwarding.js +1 -1
- package/src/lib/run-dev.js +5 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/aio-cli-plugin-app",
|
|
3
3
|
"description": "Create, Build and Deploy Adobe I/O Applications",
|
|
4
|
-
"version": "10.0
|
|
4
|
+
"version": "10.1.0",
|
|
5
5
|
"author": "Adobe Inc.",
|
|
6
6
|
"bugs": "https://github.com/adobe/aio-cli-plugin-app/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@adobe/aio-lib-runtime": "^5.0.0",
|
|
16
16
|
"@adobe/aio-lib-templates": "^2.2.0",
|
|
17
17
|
"@adobe/aio-lib-web": "^6.0.1",
|
|
18
|
-
"@adobe/generator-aio-app": "^
|
|
18
|
+
"@adobe/generator-aio-app": "^5.1.0",
|
|
19
19
|
"@adobe/generator-app-common-lib": "^0.3.3",
|
|
20
20
|
"@adobe/inquirer-table-checkbox": "^1.2.0",
|
|
21
21
|
"@oclif/core": "^1.15.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@adobe/aio-lib-test-proxy": "^1.0.0",
|
|
50
50
|
"@adobe/eslint-config-aio-lib-config": "^2.0.0",
|
|
51
|
-
"@types/jest": "^
|
|
51
|
+
"@types/jest": "^29",
|
|
52
52
|
"babel-runtime": "^6.26.0",
|
|
53
53
|
"core-js": "^3",
|
|
54
54
|
"eol": "^0.9.1",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"prepack": "oclif manifest && oclif readme --no-aliases",
|
|
96
96
|
"test": "npm run unit-tests && npm run lint",
|
|
97
97
|
"unit-tests": "jest -c jest.config.js",
|
|
98
|
-
"version": "oclif readme && git add README.md",
|
|
98
|
+
"version": "oclif readme --no-aliases && git add README.md",
|
|
99
99
|
"update-openwhisk-runtimes": "node bin/openwhisk-standalone-config/get-runtimes.js > bin/openwhisk-standalone-config/runtimes.json"
|
|
100
100
|
},
|
|
101
101
|
"bin": {
|
package/src/TemplatesCommand.js
CHANGED
|
@@ -150,6 +150,14 @@ class TemplatesCommand extends AddCommand {
|
|
|
150
150
|
} = {}) {
|
|
151
151
|
const spinner = ora()
|
|
152
152
|
|
|
153
|
+
if (templates.length <= 0) {
|
|
154
|
+
aioLogger.debug('installTemplates: standalone-app')
|
|
155
|
+
await this.config.runHook('telemetry', { data: 'installTemplates:standalone-app' })
|
|
156
|
+
} else {
|
|
157
|
+
aioLogger.debug(`installTemplates: ${templates}`)
|
|
158
|
+
await this.config.runHook('telemetry', { data: `installTemplates:${templates}` })
|
|
159
|
+
}
|
|
160
|
+
|
|
153
161
|
// install the templates in sequence
|
|
154
162
|
for (const template of templates) {
|
|
155
163
|
spinner.info(`Installing template ${template}`)
|
|
@@ -9,6 +9,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
9
9
|
governing permissions and limitations under the License.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
const { importConsoleConfig, downloadConsoleConfigToBuffer } = require('../../../lib/import')
|
|
12
13
|
const path = require('path')
|
|
13
14
|
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:add:service', { provider: 'debug' })
|
|
14
15
|
const config = require('@adobe/aio-lib-core-config')
|
|
@@ -130,8 +131,16 @@ class AddServiceCommand extends BaseCommand {
|
|
|
130
131
|
path.join(this.config.dataDir, ENTP_INT_CERTS_FOLDER),
|
|
131
132
|
newServiceProperties
|
|
132
133
|
)
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
|
|
135
|
+
// update environment
|
|
136
|
+
const config = {
|
|
137
|
+
org: { id: projectConfig.org.id },
|
|
138
|
+
project: { id: projectConfig.id },
|
|
139
|
+
workspace: { id: projectConfig.workspace.id }
|
|
140
|
+
}
|
|
141
|
+
const buffer = await downloadConsoleConfigToBuffer(consoleCLI, config, supportedServices)
|
|
142
|
+
await importConsoleConfig(buffer, flags)
|
|
143
|
+
|
|
135
144
|
// success !
|
|
136
145
|
this.log(chalk.green(chalk.bold(`Successfully updated Service Subscriptions in Workspace ${workspace.name}`)))
|
|
137
146
|
return newServiceProperties
|
|
@@ -37,7 +37,7 @@ class Deploy extends BuildCommand {
|
|
|
37
37
|
|
|
38
38
|
// if there are no extensions, then set publish to false
|
|
39
39
|
flags.publish = flags.publish && !isStandaloneApp
|
|
40
|
-
let libConsoleCLI
|
|
40
|
+
let libConsoleCLI // <= this can be undefined later on, and it was not checked
|
|
41
41
|
if (flags.publish) {
|
|
42
42
|
// force login at beginning (if required)
|
|
43
43
|
libConsoleCLI = await this.getLibConsoleCLI()
|
|
@@ -158,6 +158,11 @@ class Deploy extends BuildCommand {
|
|
|
158
158
|
try {
|
|
159
159
|
const script = await runScript(config.hooks['deploy-actions'])
|
|
160
160
|
if (!script) {
|
|
161
|
+
await this.config.runHook('deploy-actions', {
|
|
162
|
+
appConfig: config,
|
|
163
|
+
filterEntities: filterActions || [],
|
|
164
|
+
isLocalDev: false
|
|
165
|
+
})
|
|
161
166
|
deployedRuntimeEntities = await rtLib.deployActions(config, { filterEntities }, onProgress)
|
|
162
167
|
}
|
|
163
168
|
|
package/src/commands/app/init.js
CHANGED
|
@@ -21,7 +21,7 @@ const TemplateRegistryAPI = require('@adobe/aio-lib-templates')
|
|
|
21
21
|
const inquirer = require('inquirer')
|
|
22
22
|
const hyperlinker = require('hyperlinker')
|
|
23
23
|
|
|
24
|
-
const { loadAndValidateConfigFile, importConfigJson } = require('../../lib/import')
|
|
24
|
+
const { loadAndValidateConfigFile, importConfigJson } = require('../../lib/import-helper')
|
|
25
25
|
const { SERVICE_API_KEY_ENV } = require('../../lib/defaults')
|
|
26
26
|
|
|
27
27
|
const DEFAULT_WORKSPACE = 'Stage'
|
package/src/commands/app/run.js
CHANGED
|
@@ -104,8 +104,8 @@ class Run extends BaseCommand {
|
|
|
104
104
|
spinner.info(chalk.dim(`${info}`))
|
|
105
105
|
spinner.start()
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
const frontendUrl = await runDev(config, this.config.dataDir, runOptions, onProgress)
|
|
107
|
+
const inprocHook = this.config.runHook.bind(this.config)
|
|
108
|
+
const frontendUrl = await runDev(config, this.config.dataDir, runOptions, onProgress, inprocHook)
|
|
109
109
|
try {
|
|
110
110
|
await runScript(config.hooks['post-app-run'])
|
|
111
111
|
} catch (err) {
|
package/src/commands/app/use.js
CHANGED
|
@@ -10,14 +10,15 @@ governing permissions and limitations under the License.
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
const BaseCommand = require('../../BaseCommand')
|
|
13
|
-
const { CONSOLE_CONFIG_KEY
|
|
13
|
+
const { CONSOLE_CONFIG_KEY } = require('../../lib/import-helper')
|
|
14
|
+
const { importConsoleConfig, downloadConsoleConfigToBuffer } = require('../../lib/import')
|
|
14
15
|
const { Flags } = require('@oclif/core')
|
|
15
16
|
const inquirer = require('inquirer')
|
|
16
17
|
const config = require('@adobe/aio-lib-core-config')
|
|
17
18
|
const { EOL } = require('os')
|
|
18
19
|
const { warnIfOverwriteServicesInProductionWorkspace } = require('../../lib/app-helper')
|
|
19
20
|
const path = require('path')
|
|
20
|
-
const {
|
|
21
|
+
const { ENTP_INT_CERTS_FOLDER } = require('../../lib/defaults')
|
|
21
22
|
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:use', { provider: 'debug' })
|
|
22
23
|
const chalk = require('chalk')
|
|
23
24
|
|
|
@@ -45,7 +46,7 @@ class Use extends BaseCommand {
|
|
|
45
46
|
this.log(`You are currently in:${EOL}${currentConfigString}${EOL}`)
|
|
46
47
|
|
|
47
48
|
if (args.config_file_path) {
|
|
48
|
-
const consoleConfig = await
|
|
49
|
+
const consoleConfig = await importConsoleConfig(args.config_file_path, flags)
|
|
49
50
|
this.finalLogMessage(consoleConfig)
|
|
50
51
|
return
|
|
51
52
|
}
|
|
@@ -107,9 +108,9 @@ class Use extends BaseCommand {
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
// download the console configuration for the newly selected org, project, workspace
|
|
110
|
-
const buffer = await
|
|
111
|
+
const buffer = await downloadConsoleConfigToBuffer(consoleCLI, newConfig, supportedServices)
|
|
111
112
|
|
|
112
|
-
const consoleConfig = await
|
|
113
|
+
const consoleConfig = await importConsoleConfig(buffer, flags)
|
|
113
114
|
this.finalLogMessage(consoleConfig)
|
|
114
115
|
}
|
|
115
116
|
|
|
@@ -308,36 +309,6 @@ class Use extends BaseCommand {
|
|
|
308
309
|
console.error(`✔ Successfully updated Services in Project ${newConfig.project.name} and Workspace ${newConfig.workspace.name}.`)
|
|
309
310
|
}
|
|
310
311
|
|
|
311
|
-
async importConsoleConfig (consoleConfigFileOrBuffer, flags) {
|
|
312
|
-
const overwrite = flags.overwrite
|
|
313
|
-
const merge = flags.merge
|
|
314
|
-
let interactive = true
|
|
315
|
-
|
|
316
|
-
if (overwrite || merge) {
|
|
317
|
-
interactive = false
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
// before importing the config, first extract the service api key id
|
|
321
|
-
const { values: config } = loadAndValidateConfigFile(consoleConfigFileOrBuffer)
|
|
322
|
-
const project = config.project
|
|
323
|
-
const jwtConfig = project.workspace.details.credentials && project.workspace.details.credentials.find(c => c.jwt)
|
|
324
|
-
const serviceClientId = (jwtConfig && jwtConfig.jwt.client_id) || ''
|
|
325
|
-
const extraEnvVars = { [SERVICE_API_KEY_ENV]: serviceClientId }
|
|
326
|
-
|
|
327
|
-
await importConfigJson(consoleConfigFileOrBuffer, process.cwd(), { interactive, overwrite, merge }, extraEnvVars)
|
|
328
|
-
return config
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
async downloadConsoleConfigToBuffer (consoleCLI, config, supportedServices) {
|
|
332
|
-
const workspaceConfig = await consoleCLI.getWorkspaceConfig(
|
|
333
|
-
config.org.id,
|
|
334
|
-
config.project.id,
|
|
335
|
-
config.workspace.id,
|
|
336
|
-
supportedServices
|
|
337
|
-
)
|
|
338
|
-
return Buffer.from(JSON.stringify(workspaceConfig))
|
|
339
|
-
}
|
|
340
|
-
|
|
341
312
|
async finalLogMessage (consoleConfig) {
|
|
342
313
|
const config = { org: consoleConfig.project.org, project: consoleConfig.project, workspace: consoleConfig.project.workspace }
|
|
343
314
|
const configString = this.configString(config)
|
|
@@ -61,10 +61,9 @@ module.exports = async (watcherOptions) => {
|
|
|
61
61
|
* @param {Array<string>} filterActions add filters to deploy only specified OpenWhisk actions
|
|
62
62
|
*/
|
|
63
63
|
async function buildAndDeploy (watcherOptions, filterActions) {
|
|
64
|
-
const { config, isLocal, log } = watcherOptions
|
|
65
|
-
|
|
64
|
+
const { config, isLocal, log, inprocHook } = watcherOptions
|
|
66
65
|
await buildActions(config, filterActions)
|
|
67
|
-
await deployActions(config, isLocal, log, filterActions)
|
|
66
|
+
await deployActions(config, isLocal, log, filterActions, inprocHook)
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
/**
|
|
@@ -22,7 +22,7 @@ const { deployActions } = require('@adobe/aio-lib-runtime')
|
|
|
22
22
|
* @param {boolean} filter true if a filter by built actions is desired.
|
|
23
23
|
*/
|
|
24
24
|
/** @private */
|
|
25
|
-
module.exports = async (config, isLocalDev = false, log = () => {}, filter = false) => {
|
|
25
|
+
module.exports = async (config, isLocalDev = false, log = () => {}, filter = false, inprocHook) => {
|
|
26
26
|
utils.runScript(config.hooks['pre-app-deploy'])
|
|
27
27
|
const script = await utils.runScript(config.hooks['deploy-actions'])
|
|
28
28
|
if (!script) {
|
|
@@ -32,6 +32,14 @@ module.exports = async (config, isLocalDev = false, log = () => {}, filter = fal
|
|
|
32
32
|
byBuiltActions: filter
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
if (inprocHook) {
|
|
36
|
+
const hookFilterEntities = Array.isArray(filter) ? filter : []
|
|
37
|
+
await inprocHook('deploy-actions', {
|
|
38
|
+
appConfig: config,
|
|
39
|
+
filterEntities: hookFilterEntities,
|
|
40
|
+
isLocalDev
|
|
41
|
+
})
|
|
42
|
+
}
|
|
35
43
|
const entities = await deployActions(config, deployConfig, log)
|
|
36
44
|
if (entities.actions) {
|
|
37
45
|
const web = entities.actions.filter(utils.createWebExportFilter(true))
|