@adobe/aio-cli-plugin-app 8.5.1 → 8.6.1-pre.2022-08-17.163d3a3a
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 +688 -256
- package/bin/openwhisk-standalone-config/get-runtimes.js +52 -0
- package/bin/openwhisk-standalone-config/runtimes.json +16 -8
- package/oclif.manifest.json +1 -1
- package/package.json +24 -27
- package/src/AddCommand.js +3 -3
- package/src/BaseCommand.js +13 -8
- package/src/commands/app/add/action.js +8 -8
- package/src/commands/app/add/ci.js +4 -5
- package/src/commands/app/add/event.js +7 -7
- package/src/commands/app/add/extension.js +7 -7
- package/src/commands/app/add/index.js +3 -3
- package/src/commands/app/add/service.js +3 -3
- package/src/commands/app/add/web-assets.js +8 -8
- package/src/commands/app/build.js +15 -15
- package/src/commands/app/config/get/index.js +3 -3
- package/src/commands/app/config/index.js +3 -3
- package/src/commands/app/config/set/index.js +3 -3
- package/src/commands/app/create.js +3 -3
- package/src/commands/app/delete/action.js +3 -3
- package/src/commands/app/delete/ci.js +6 -6
- package/src/commands/app/delete/event.js +3 -3
- package/src/commands/app/delete/extension.js +6 -6
- package/src/commands/app/delete/index.js +3 -3
- package/src/commands/app/delete/web-assets.js +3 -3
- package/src/commands/app/deploy.js +19 -21
- package/src/commands/app/get-url.js +20 -9
- package/src/commands/app/index.js +3 -3
- package/src/commands/app/info.js +7 -7
- package/src/commands/app/init.js +34 -15
- package/src/commands/app/list/extension-points.js +4 -4
- package/src/commands/app/list/extension.js +4 -4
- package/src/commands/app/list/index.js +3 -3
- package/src/commands/app/logs.js +20 -12
- package/src/commands/app/run.js +13 -12
- package/src/commands/app/test.js +7 -7
- package/src/commands/app/undeploy.js +10 -10
- package/src/commands/app/use.js +11 -11
- package/src/lib/build-actions.js +3 -2
- package/src/lib/deploy-actions.js +3 -3
- package/src/lib/run-dev.js +6 -7
- package/src/lib/run-local-runtime.js +22 -12
- package/src/lib/vscode.js +3 -3
package/src/commands/app/test.js
CHANGED
|
@@ -11,7 +11,7 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
const { runScript } = require('../../lib/app-helper')
|
|
14
|
-
const {
|
|
14
|
+
const { Flags } = require('@oclif/core')
|
|
15
15
|
const BaseCommand = require('../../BaseCommand')
|
|
16
16
|
const chalk = require('chalk')
|
|
17
17
|
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:test', { provider: 'debug' })
|
|
@@ -19,7 +19,7 @@ const path = require('path')
|
|
|
19
19
|
|
|
20
20
|
class Test extends BaseCommand {
|
|
21
21
|
async run () {
|
|
22
|
-
const { flags } = this.parse(Test)
|
|
22
|
+
const { flags } = await this.parse(Test)
|
|
23
23
|
let { all, unit, e2e, action, extension } = flags
|
|
24
24
|
|
|
25
25
|
// 'all' overrides the setting of either the unit or e2e flag
|
|
@@ -201,27 +201,27 @@ class Test extends BaseCommand {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
Test.flags = {
|
|
204
|
-
extension:
|
|
204
|
+
extension: Flags.string({
|
|
205
205
|
char: 'e',
|
|
206
206
|
description: 'the extension(s) to test',
|
|
207
207
|
exclusive: ['action'],
|
|
208
208
|
multiple: true
|
|
209
209
|
}),
|
|
210
|
-
action:
|
|
210
|
+
action: Flags.string({
|
|
211
211
|
char: 'a',
|
|
212
212
|
description: 'the action(s) to test',
|
|
213
213
|
exclusive: ['extension'],
|
|
214
214
|
multiple: true
|
|
215
215
|
}),
|
|
216
|
-
all:
|
|
216
|
+
all: Flags.boolean({
|
|
217
217
|
description: 'run both unit and e2e tests',
|
|
218
218
|
default: false
|
|
219
219
|
}),
|
|
220
|
-
e2e:
|
|
220
|
+
e2e: Flags.boolean({
|
|
221
221
|
description: 'run e2e tests',
|
|
222
222
|
default: false
|
|
223
223
|
}),
|
|
224
|
-
unit:
|
|
224
|
+
unit: Flags.boolean({
|
|
225
225
|
description: 'run unit tests',
|
|
226
226
|
default: false
|
|
227
227
|
})
|
|
@@ -14,7 +14,7 @@ const ora = require('ora')
|
|
|
14
14
|
const chalk = require('chalk')
|
|
15
15
|
// const path = require('path')
|
|
16
16
|
|
|
17
|
-
const {
|
|
17
|
+
const { Flags } = require('@oclif/core')
|
|
18
18
|
|
|
19
19
|
const BaseCommand = require('../../BaseCommand')
|
|
20
20
|
const webLib = require('@adobe/aio-lib-web')
|
|
@@ -24,7 +24,7 @@ const rtLib = require('@adobe/aio-lib-runtime')
|
|
|
24
24
|
class Undeploy extends BaseCommand {
|
|
25
25
|
async run () {
|
|
26
26
|
// cli input
|
|
27
|
-
const { flags } = this.parse(Undeploy)
|
|
27
|
+
const { flags } = await this.parse(Undeploy)
|
|
28
28
|
|
|
29
29
|
// flags
|
|
30
30
|
flags['web-assets'] = flags['web-assets'] && !flags['skip-static'] && !flags['skip-web-assets'] && !flags.action
|
|
@@ -146,36 +146,36 @@ Undeploy.description = `Undeploys an Adobe I/O App
|
|
|
146
146
|
|
|
147
147
|
Undeploy.flags = {
|
|
148
148
|
...BaseCommand.flags,
|
|
149
|
-
'skip-static':
|
|
149
|
+
'skip-static': Flags.boolean({
|
|
150
150
|
description: '[deprecated] Please use --no-web-assets'
|
|
151
151
|
}),
|
|
152
|
-
'skip-web-assets':
|
|
152
|
+
'skip-web-assets': Flags.boolean({
|
|
153
153
|
description: '[deprecated] Please use --no-web-assets'
|
|
154
154
|
}),
|
|
155
|
-
'skip-actions':
|
|
155
|
+
'skip-actions': Flags.boolean({
|
|
156
156
|
description: '[deprecated] Please use --no-actions'
|
|
157
157
|
}),
|
|
158
|
-
actions:
|
|
158
|
+
actions: Flags.boolean({
|
|
159
159
|
description: '[default: true] Undeploy actions if any',
|
|
160
160
|
default: true,
|
|
161
161
|
allowNo: true
|
|
162
162
|
}),
|
|
163
|
-
'web-assets':
|
|
163
|
+
'web-assets': Flags.boolean({
|
|
164
164
|
description: '[default: true] Undeploy web-assets if any',
|
|
165
165
|
default: true,
|
|
166
166
|
allowNo: true
|
|
167
167
|
}),
|
|
168
|
-
extension:
|
|
168
|
+
extension: Flags.string({
|
|
169
169
|
description: 'Undeploy only a specific extension, the flags can be specified multiple times',
|
|
170
170
|
char: 'e',
|
|
171
171
|
multiple: true
|
|
172
172
|
}),
|
|
173
|
-
unpublish:
|
|
173
|
+
unpublish: Flags.boolean({
|
|
174
174
|
description: '[default: true] Unpublish selected extension(s) from Exchange',
|
|
175
175
|
allowNo: true,
|
|
176
176
|
default: true
|
|
177
177
|
}),
|
|
178
|
-
'force-unpublish':
|
|
178
|
+
'force-unpublish': Flags.boolean({
|
|
179
179
|
description: 'Force unpublish extension(s) from Exchange, will delete all extension points',
|
|
180
180
|
default: false,
|
|
181
181
|
exclusive: ['unpublish'] // unpublish is excluded
|
package/src/commands/app/use.js
CHANGED
|
@@ -11,7 +11,7 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
|
|
12
12
|
const BaseCommand = require('../../BaseCommand')
|
|
13
13
|
const { CONSOLE_CONFIG_KEY, importConfigJson, loadAndValidateConfigFile } = require('../../lib/import')
|
|
14
|
-
const {
|
|
14
|
+
const { Flags } = require('@oclif/core')
|
|
15
15
|
const inquirer = require('inquirer')
|
|
16
16
|
const config = require('@adobe/aio-lib-core-config')
|
|
17
17
|
const { EOL } = require('os')
|
|
@@ -25,7 +25,7 @@ const chalk = require('chalk')
|
|
|
25
25
|
|
|
26
26
|
class Use extends BaseCommand {
|
|
27
27
|
async run () {
|
|
28
|
-
const { flags, args } = this.parse(Use)
|
|
28
|
+
const { flags, args } = await this.parse(Use)
|
|
29
29
|
|
|
30
30
|
flags.workspace = flags.workspace || flags['workspace-name'] || ''
|
|
31
31
|
|
|
@@ -370,49 +370,49 @@ To download the configuration file for your project, select the 'Download' butto
|
|
|
370
370
|
|
|
371
371
|
Use.flags = {
|
|
372
372
|
...BaseCommand.flags,
|
|
373
|
-
overwrite:
|
|
373
|
+
overwrite: Flags.boolean({
|
|
374
374
|
description: 'Overwrite any .aio and .env files during import of the Adobe Developer Console configuration file',
|
|
375
375
|
default: false,
|
|
376
376
|
exclusive: ['merge']
|
|
377
377
|
}),
|
|
378
|
-
merge:
|
|
378
|
+
merge: Flags.boolean({
|
|
379
379
|
description: 'Merge any .aio and .env files during import of the Adobe Developer Console configuration file',
|
|
380
380
|
default: false,
|
|
381
381
|
exclusive: ['overwrite']
|
|
382
382
|
}),
|
|
383
|
-
global:
|
|
383
|
+
global: Flags.boolean({
|
|
384
384
|
description: 'Use the global Adobe Developer Console Org / Project / Workspace configuration, which can be set via `aio console` commands',
|
|
385
385
|
default: false,
|
|
386
386
|
char: 'g',
|
|
387
387
|
exclusive: ['workspace']
|
|
388
388
|
}),
|
|
389
|
-
workspace:
|
|
389
|
+
workspace: Flags.string({
|
|
390
390
|
description: 'Specify the Adobe Developer Console Workspace name or Workspace id to import the configuration from',
|
|
391
391
|
default: '',
|
|
392
392
|
char: 'w',
|
|
393
393
|
exclusive: ['global', 'workspace-name']
|
|
394
394
|
}),
|
|
395
|
-
'confirm-new-workspace':
|
|
395
|
+
'confirm-new-workspace': Flags.boolean({
|
|
396
396
|
description: 'Skip and confirm prompt for creating a new workspace',
|
|
397
397
|
default: false
|
|
398
398
|
}),
|
|
399
|
-
'workspace-name':
|
|
399
|
+
'workspace-name': Flags.string({
|
|
400
400
|
description: '[DEPRECATED]: please use --workspace instead',
|
|
401
401
|
default: '',
|
|
402
402
|
char: 'w',
|
|
403
403
|
exclusive: ['global', 'workspace']
|
|
404
404
|
}),
|
|
405
|
-
'no-service-sync':
|
|
405
|
+
'no-service-sync': Flags.boolean({
|
|
406
406
|
description: 'Skip the Service sync prompt and do not attach current Service subscriptions to the new Workspace',
|
|
407
407
|
default: false,
|
|
408
408
|
exclusive: ['confirm-service-sync']
|
|
409
409
|
}),
|
|
410
|
-
'confirm-service-sync':
|
|
410
|
+
'confirm-service-sync': Flags.boolean({
|
|
411
411
|
description: 'Skip the Service sync prompt and overwrite Service subscriptions in the new Workspace with current subscriptions',
|
|
412
412
|
default: false,
|
|
413
413
|
exclusive: ['no-service-sync']
|
|
414
414
|
}),
|
|
415
|
-
'no-input':
|
|
415
|
+
'no-input': Flags.boolean({
|
|
416
416
|
description: 'Skip user prompts by setting --no-service-sync and --merge. Requires one of config_file_path or --global or --workspace',
|
|
417
417
|
default: false
|
|
418
418
|
})
|
package/src/lib/build-actions.js
CHANGED
|
@@ -18,12 +18,13 @@ const { buildActions } = require('@adobe/aio-lib-runtime')
|
|
|
18
18
|
*
|
|
19
19
|
* @param {object} config see src/lib/config-loader.js
|
|
20
20
|
* @param {Array<string>} filterActions add filters to deploy only specified OpenWhisk actions
|
|
21
|
+
* @param {boolean} [forceBuild=false] force a build (skip file changed hash check)
|
|
21
22
|
*/
|
|
22
|
-
module.exports = async (config, filterActions) => {
|
|
23
|
+
module.exports = async (config, filterActions, forceBuild = false) => {
|
|
23
24
|
utils.runScript(config.hooks['pre-app-build'])
|
|
24
25
|
const script = await utils.runScript(config.hooks['build-actions'])
|
|
25
26
|
if (!script) {
|
|
26
|
-
await buildActions(config, filterActions)
|
|
27
|
+
await buildActions(config, filterActions, forceBuild)
|
|
27
28
|
}
|
|
28
29
|
utils.runScript(config.hooks['post-app-build'])
|
|
29
30
|
}
|
|
@@ -17,17 +17,17 @@ const { deployActions } = require('@adobe/aio-lib-runtime')
|
|
|
17
17
|
* Deploys actions.
|
|
18
18
|
*
|
|
19
19
|
* @param {object} config see src/lib/config-loader.js
|
|
20
|
-
* @param {boolean}
|
|
20
|
+
* @param {boolean} isLocalDev default false, set to true if it's a local deploy
|
|
21
21
|
* @param {Function} [log] a log function
|
|
22
22
|
* @param {boolean} filter true if a filter by built actions is desired.
|
|
23
23
|
*/
|
|
24
24
|
/** @private */
|
|
25
|
-
module.exports = async (config,
|
|
25
|
+
module.exports = async (config, isLocalDev = false, log = () => {}, filter = false) => {
|
|
26
26
|
utils.runScript(config.hooks['pre-app-deploy'])
|
|
27
27
|
const script = await utils.runScript(config.hooks['deploy-actions'])
|
|
28
28
|
if (!script) {
|
|
29
29
|
const deployConfig = {
|
|
30
|
-
isLocalDev
|
|
30
|
+
isLocalDev,
|
|
31
31
|
filterEntities: {
|
|
32
32
|
byBuiltActions: filter
|
|
33
33
|
}
|
package/src/lib/run-dev.js
CHANGED
|
@@ -19,7 +19,7 @@ const bundleServe = require('./bundle-serve')
|
|
|
19
19
|
const { defaultHttpServerPort: SERVER_DEFAULT_PORT } = require('./defaults')
|
|
20
20
|
const serve = require('./serve')
|
|
21
21
|
const Cleanup = require('./cleanup')
|
|
22
|
-
const runLocalRuntime = require('./run-local-runtime')
|
|
22
|
+
const { runLocalRuntime } = require('./run-local-runtime')
|
|
23
23
|
|
|
24
24
|
const buildActions = require('./build-actions')
|
|
25
25
|
const deployActions = require('./deploy-actions')
|
|
@@ -46,7 +46,7 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
|
|
|
46
46
|
// control variables
|
|
47
47
|
const hasFrontend = config.app.hasFrontend
|
|
48
48
|
const withBackend = config.app.hasBackend && !skipActions
|
|
49
|
-
const isLocal =
|
|
49
|
+
const isLocal = options.isLocal // applies only for backend
|
|
50
50
|
const portToUse = parseInt(process.env.PORT) || SERVER_DEFAULT_PORT
|
|
51
51
|
const uiPort = await getPort({ port: portToUse })
|
|
52
52
|
if (uiPort !== portToUse) {
|
|
@@ -80,9 +80,8 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
|
|
|
80
80
|
|
|
81
81
|
// build and deploy actions
|
|
82
82
|
log('building actions..')
|
|
83
|
-
await buildActions(devConfig)
|
|
83
|
+
await buildActions(devConfig, null, true /* force build */)
|
|
84
84
|
|
|
85
|
-
log(`watching action files at ${devConfig.actions.src}...`)
|
|
86
85
|
const { cleanup: watcherCleanup } = await actionsWatcher({ config: devConfig, isLocal, log })
|
|
87
86
|
cleanup.add(() => watcherCleanup(), 'stopping action watcher...')
|
|
88
87
|
}
|
|
@@ -95,14 +94,14 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
|
|
|
95
94
|
// note the condition: we still write backend urls EVEN if skipActions is set
|
|
96
95
|
// the urls will always point to remotely deployed actions if skipActions is set
|
|
97
96
|
log('injecting backend urls into frontend config')
|
|
98
|
-
urls = rtLibUtils.getActionUrls(devConfig, true, isLocal && !skipActions)
|
|
97
|
+
urls = rtLibUtils.getActionUrls(devConfig, true, isLocal && !skipActions, true)
|
|
99
98
|
}
|
|
100
99
|
utils.writeConfig(devConfig.web.injectedConfig, urls)
|
|
101
100
|
|
|
102
101
|
if (!options.skipServe) {
|
|
103
102
|
const script = await utils.runScript(config.hooks['build-static'])
|
|
104
103
|
if (!script) {
|
|
105
|
-
const
|
|
104
|
+
const entries = config.web.src + '/**/*.html'
|
|
106
105
|
bundleOptions.serveOptions = {
|
|
107
106
|
port: uiPort,
|
|
108
107
|
https: bundleOptions.https
|
|
@@ -114,7 +113,7 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
|
|
|
114
113
|
bundleOptions.additionalReporters = [
|
|
115
114
|
{ packageName: '@parcel/reporter-cli', resolveFrom: __filename }
|
|
116
115
|
]
|
|
117
|
-
defaultBundler = await bundle(
|
|
116
|
+
defaultBundler = await bundle(entries, config.web.distDev, bundleOptions, log)
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
}
|
|
@@ -32,6 +32,12 @@ const OW_WAIT_INIT_TIME = 2000
|
|
|
32
32
|
const OW_WAIT_PERIOD_TIME = 500
|
|
33
33
|
const OW_TIMEOUT = 60000
|
|
34
34
|
|
|
35
|
+
const LOCAL_RUNTIME = {
|
|
36
|
+
namespace: OW_LOCAL_NAMESPACE,
|
|
37
|
+
auth: OW_LOCAL_AUTH,
|
|
38
|
+
apihost: OW_LOCAL_APIHOST
|
|
39
|
+
}
|
|
40
|
+
|
|
35
41
|
/**
|
|
36
42
|
* @typedef {object} RunDevLocalObject
|
|
37
43
|
* @property {string} config the modified dev config
|
|
@@ -55,9 +61,8 @@ const OW_TIMEOUT = 60000
|
|
|
55
61
|
* @returns {RunDevLocalObject} the RunDevLocalObject
|
|
56
62
|
*/
|
|
57
63
|
async function runDevLocal (config, dataDir, log = () => undefined, verbose = false) {
|
|
58
|
-
const devConfig = cloneDeep(config)
|
|
59
|
-
devConfig.envFile = path.join(config.app.dist, '.env.local')
|
|
60
64
|
const owJarFile = path.join(dataDir, OW_JAR_PATH)
|
|
65
|
+
const devConfig = loadLocalDevConfig(config)
|
|
61
66
|
|
|
62
67
|
// take following steps only when we have a backend
|
|
63
68
|
log('checking if java is installed...')
|
|
@@ -91,16 +96,8 @@ async function runDevLocal (config, dataDir, log = () => undefined, verbose = fa
|
|
|
91
96
|
}
|
|
92
97
|
const res = await utils.runOpenWhiskJar(owJarFile, OW_CONFIG_RUNTIMES_FILE, OW_LOCAL_APIHOST, OW_WAIT_INIT_TIME, OW_WAIT_PERIOD_TIME, OW_TIMEOUT, owExecaOptions)
|
|
93
98
|
|
|
94
|
-
log('setting local openwhisk credentials...')
|
|
95
|
-
const runtime = {
|
|
96
|
-
namespace: OW_LOCAL_NAMESPACE,
|
|
97
|
-
auth: OW_LOCAL_AUTH,
|
|
98
|
-
apihost: OW_LOCAL_APIHOST
|
|
99
|
-
}
|
|
100
|
-
devConfig.ow = { ...devConfig.ow, ...runtime }
|
|
101
|
-
|
|
102
99
|
log(`writing credentials to tmp wskdebug config '${devConfig.envFile}'`)
|
|
103
|
-
await writeLocalEnvFile(devConfig,
|
|
100
|
+
await writeLocalEnvFile(devConfig, LOCAL_RUNTIME)
|
|
104
101
|
|
|
105
102
|
const cleanup = () => {
|
|
106
103
|
aioLogger.debug('stopping local OpenWhisk stack...')
|
|
@@ -118,6 +115,19 @@ async function runDevLocal (config, dataDir, log = () => undefined, verbose = fa
|
|
|
118
115
|
}
|
|
119
116
|
}
|
|
120
117
|
|
|
118
|
+
/**
|
|
119
|
+
* @param {object} config the app config
|
|
120
|
+
* @param {Function} [log] function to log application logs
|
|
121
|
+
* @returns {RunDevLocalObject} the RunDevLocalObject
|
|
122
|
+
*/
|
|
123
|
+
function loadLocalDevConfig (config, log) {
|
|
124
|
+
const devConfig = cloneDeep(config)
|
|
125
|
+
devConfig.envFile = path.join(config.app.dist, '.env.local')
|
|
126
|
+
log && log('setting local openwhisk credentials...')
|
|
127
|
+
devConfig.ow = { ...devConfig.ow, ...LOCAL_RUNTIME }
|
|
128
|
+
return devConfig
|
|
129
|
+
}
|
|
130
|
+
|
|
121
131
|
/**
|
|
122
132
|
* Writes the local debugging .env file
|
|
123
133
|
*
|
|
@@ -141,4 +151,4 @@ async function writeLocalEnvFile (appConfig, runtimeCredentials) {
|
|
|
141
151
|
`))
|
|
142
152
|
}
|
|
143
153
|
|
|
144
|
-
module.exports = runDevLocal
|
|
154
|
+
module.exports = { runLocalRuntime: runDevLocal, loadLocalDevConfig }
|
package/src/lib/vscode.js
CHANGED
|
@@ -42,14 +42,14 @@ function update (config) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
const env = yeoman.createEnv()
|
|
45
|
+
// by default yeoman runs the install, we control installation from the app plugin
|
|
46
|
+
env.options = { skipInstall: true }
|
|
45
47
|
const gen = env.instantiate(generators['add-vscode-config'], {
|
|
46
48
|
options: {
|
|
47
49
|
'app-config': config,
|
|
48
50
|
'env-file': config.envFile,
|
|
49
51
|
'frontend-url': props.frontEndUrl,
|
|
50
|
-
'skip-prompt': true
|
|
51
|
-
// by default yeoman runs the install, we control installation from the app plugin
|
|
52
|
-
'skip-install': true
|
|
52
|
+
'skip-prompt': true
|
|
53
53
|
}
|
|
54
54
|
})
|
|
55
55
|
await env.runGenerator(gen)
|