@adobe/aio-cli-plugin-app 8.6.1 → 9.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 +687 -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 +46 -47
- package/schema/config.schema.json +12 -3
- package/src/AddCommand.js +3 -3
- package/src/BaseCommand.js +5 -6
- 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 +14 -14
- 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 +8 -8
- package/src/commands/app/index.js +3 -3
- package/src/commands/app/info.js +7 -7
- package/src/commands/app/init.js +17 -16
- package/src/commands/app/list/extension-points.js +5 -5
- package/src/commands/app/list/extension.js +5 -5
- package/src/commands/app/list/index.js +3 -3
- package/src/commands/app/logs.js +9 -9
- package/src/commands/app/run.js +10 -11
- 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/app-helper.js +2 -2
- package/src/lib/build-actions.js +3 -2
- package/src/lib/import.js +3 -6
- package/src/lib/run-dev.js +4 -4
- package/src/lib/vscode.js +3 -3
|
@@ -12,13 +12,11 @@ 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
|
-
const { cli } = require('cli-ux')
|
|
17
15
|
|
|
18
16
|
const BaseCommand = require('../../BaseCommand')
|
|
19
17
|
const BuildCommand = require('./build')
|
|
20
18
|
const webLib = require('@adobe/aio-lib-web')
|
|
21
|
-
const {
|
|
19
|
+
const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
|
|
22
20
|
const { createWebExportFilter, runScript, buildExtensionPointPayloadWoMetadata, buildExcShellViewExtensionMetadata } = require('../../lib/app-helper')
|
|
23
21
|
const rtLib = require('@adobe/aio-lib-runtime')
|
|
24
22
|
const LogForwarding = require('../../lib/log-forwarding')
|
|
@@ -26,7 +24,7 @@ const LogForwarding = require('../../lib/log-forwarding')
|
|
|
26
24
|
class Deploy extends BuildCommand {
|
|
27
25
|
async run () {
|
|
28
26
|
// cli input
|
|
29
|
-
const { flags } = this.parse(Deploy)
|
|
27
|
+
const { flags } = await this.parse(Deploy)
|
|
30
28
|
|
|
31
29
|
// flags
|
|
32
30
|
flags['web-assets'] = flags['web-assets'] && !flags['skip-web-assets'] && !flags['skip-static'] && !flags.action
|
|
@@ -260,80 +258,80 @@ This will always force a rebuild unless --no-force-build is set.
|
|
|
260
258
|
|
|
261
259
|
Deploy.flags = {
|
|
262
260
|
...BaseCommand.flags,
|
|
263
|
-
'skip-build':
|
|
261
|
+
'skip-build': Flags.boolean({
|
|
264
262
|
description: '[deprecated] Please use --no-build'
|
|
265
263
|
}),
|
|
266
|
-
'skip-deploy':
|
|
264
|
+
'skip-deploy': Flags.boolean({
|
|
267
265
|
description: '[deprecated] Please use \'aio app build\''
|
|
268
266
|
}),
|
|
269
|
-
'skip-static':
|
|
267
|
+
'skip-static': Flags.boolean({
|
|
270
268
|
description: '[deprecated] Please use --no-web-assets'
|
|
271
269
|
}),
|
|
272
|
-
'skip-web-assets':
|
|
270
|
+
'skip-web-assets': Flags.boolean({
|
|
273
271
|
description: '[deprecated] Please use --no-web-assets'
|
|
274
272
|
}),
|
|
275
|
-
'skip-actions':
|
|
273
|
+
'skip-actions': Flags.boolean({
|
|
276
274
|
description: '[deprecated] Please use --no-actions'
|
|
277
275
|
}),
|
|
278
|
-
actions:
|
|
276
|
+
actions: Flags.boolean({
|
|
279
277
|
description: '[default: true] Deploy actions if any',
|
|
280
278
|
default: true,
|
|
281
279
|
allowNo: true,
|
|
282
280
|
exclusive: ['action'] // should be action exclusive --no-action but see https://github.com/oclif/oclif/issues/600
|
|
283
281
|
}),
|
|
284
|
-
action:
|
|
282
|
+
action: Flags.string({
|
|
285
283
|
description: 'Deploy only a specific action, the flags can be specified multiple times, this will set --no-publish',
|
|
286
284
|
char: 'a',
|
|
287
285
|
exclusive: ['extension'],
|
|
288
286
|
multiple: true
|
|
289
287
|
}),
|
|
290
|
-
'web-assets':
|
|
288
|
+
'web-assets': Flags.boolean({
|
|
291
289
|
description: '[default: true] Deploy web-assets if any',
|
|
292
290
|
default: true,
|
|
293
291
|
allowNo: true
|
|
294
292
|
}),
|
|
295
|
-
build:
|
|
293
|
+
build: Flags.boolean({
|
|
296
294
|
description: '[default: true] Run the build phase before deployment',
|
|
297
295
|
default: true,
|
|
298
296
|
allowNo: true
|
|
299
297
|
}),
|
|
300
|
-
'force-build':
|
|
298
|
+
'force-build': Flags.boolean({
|
|
301
299
|
description: '[default: true] Force a build even if one already exists',
|
|
302
300
|
exclusive: ['no-build'], // no-build
|
|
303
301
|
default: true,
|
|
304
302
|
allowNo: true
|
|
305
303
|
}),
|
|
306
|
-
'content-hash':
|
|
304
|
+
'content-hash': Flags.boolean({
|
|
307
305
|
description: '[default: true] Enable content hashing in browser code',
|
|
308
306
|
default: true,
|
|
309
307
|
allowNo: true
|
|
310
308
|
}),
|
|
311
|
-
open:
|
|
309
|
+
open: Flags.boolean({
|
|
312
310
|
description: 'Open the default web browser after a successful deploy, only valid if your app has a front-end',
|
|
313
311
|
default: false
|
|
314
312
|
}),
|
|
315
|
-
extension:
|
|
313
|
+
extension: Flags.string({
|
|
316
314
|
description: 'Deploy only a specific extension, the flags can be specified multiple times',
|
|
317
315
|
exclusive: ['action'],
|
|
318
316
|
char: 'e',
|
|
319
317
|
multiple: true
|
|
320
318
|
}),
|
|
321
|
-
publish:
|
|
319
|
+
publish: Flags.boolean({
|
|
322
320
|
description: '[default: true] Publish extension(s) to Exchange',
|
|
323
321
|
allowNo: true,
|
|
324
322
|
default: true,
|
|
325
323
|
exclusive: ['action']
|
|
326
324
|
}),
|
|
327
|
-
'force-publish':
|
|
325
|
+
'force-publish': Flags.boolean({
|
|
328
326
|
description: 'Force publish extension(s) to Exchange, delete previously published extension points',
|
|
329
327
|
default: false,
|
|
330
328
|
exclusive: ['action', 'publish'] // no-publish is excluded
|
|
331
329
|
}),
|
|
332
|
-
'web-optimize':
|
|
330
|
+
'web-optimize': Flags.boolean({
|
|
333
331
|
description: '[default: false] Enable optimization (minification) of web js/css/html',
|
|
334
332
|
default: false
|
|
335
333
|
}),
|
|
336
|
-
'log-forwarding-update':
|
|
334
|
+
'log-forwarding-update': Flags.boolean({
|
|
337
335
|
description: '[default: true] Update log forwarding configuration on server',
|
|
338
336
|
default: true,
|
|
339
337
|
allowNo: true
|
|
@@ -12,7 +12,7 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
|
|
13
13
|
const chalk = require('chalk')
|
|
14
14
|
|
|
15
|
-
const {
|
|
15
|
+
const { Flags } = require('@oclif/core')
|
|
16
16
|
|
|
17
17
|
const BaseCommand = require('../../BaseCommand')
|
|
18
18
|
const { wrapError } = require('../../lib/app-helper')
|
|
@@ -23,7 +23,7 @@ const { loadLocalDevConfig } = require('../../lib/run-local-runtime')
|
|
|
23
23
|
class GetUrlCommand extends BaseCommand {
|
|
24
24
|
async run () {
|
|
25
25
|
// cli input
|
|
26
|
-
const { args, flags } = this.parse(GetUrlCommand)
|
|
26
|
+
const { args, flags } = await this.parse(GetUrlCommand)
|
|
27
27
|
|
|
28
28
|
try {
|
|
29
29
|
const options = {}
|
|
@@ -68,7 +68,7 @@ class GetUrlCommand extends BaseCommand {
|
|
|
68
68
|
if (flags.json) {
|
|
69
69
|
this.log(JSON.stringify(urls))
|
|
70
70
|
} else if (flags.yml) {
|
|
71
|
-
this.log(yaml.
|
|
71
|
+
this.log(yaml.dump(urls))
|
|
72
72
|
} else if (flags.hson) {
|
|
73
73
|
this.log(urls)
|
|
74
74
|
} else {
|
|
@@ -96,22 +96,22 @@ GetUrlCommand.description = 'Get action URLs'
|
|
|
96
96
|
|
|
97
97
|
GetUrlCommand.flags = {
|
|
98
98
|
...BaseCommand.flags,
|
|
99
|
-
cdn:
|
|
99
|
+
cdn: Flags.boolean({
|
|
100
100
|
description: 'Display CDN based action URLs'
|
|
101
101
|
}),
|
|
102
|
-
json:
|
|
102
|
+
json: Flags.boolean({
|
|
103
103
|
description: 'Output json',
|
|
104
104
|
char: 'j'
|
|
105
105
|
}),
|
|
106
|
-
hson:
|
|
106
|
+
hson: Flags.boolean({
|
|
107
107
|
description: 'Output human readable json',
|
|
108
108
|
char: 'h'
|
|
109
109
|
}),
|
|
110
|
-
yml:
|
|
110
|
+
yml: Flags.boolean({
|
|
111
111
|
description: 'Output yml',
|
|
112
112
|
char: 'y'
|
|
113
113
|
}),
|
|
114
|
-
local:
|
|
114
|
+
local: Flags.boolean({
|
|
115
115
|
description: 'Display locally based action URLs'
|
|
116
116
|
})
|
|
117
117
|
}
|
|
@@ -10,13 +10,13 @@ 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
|
|
13
|
+
const { Help } = require('@oclif/core')
|
|
14
14
|
const BaseCommand = require('../../BaseCommand')
|
|
15
15
|
|
|
16
16
|
class IndexCommand extends BaseCommand {
|
|
17
17
|
async run () {
|
|
18
|
-
const help = new
|
|
19
|
-
help.showHelp(['app', '--help'])
|
|
18
|
+
const help = new Help(this.config)
|
|
19
|
+
await help.showHelp(['app', '--help'])
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
package/src/commands/app/info.js
CHANGED
|
@@ -11,14 +11,14 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
const BaseCommand = require('../../BaseCommand')
|
|
14
|
-
const {
|
|
14
|
+
const { Flags } = require('@oclif/core')
|
|
15
15
|
const yaml = require('js-yaml')
|
|
16
16
|
const deepCopy = require('lodash.clonedeep')
|
|
17
17
|
|
|
18
18
|
class Info extends BaseCommand {
|
|
19
19
|
async run () {
|
|
20
20
|
// cli input
|
|
21
|
-
const { flags } = this.parse(Info)
|
|
21
|
+
const { flags } = await this.parse(Info)
|
|
22
22
|
const appConfig = deepCopy(this.getFullConfig({ allowNoImpl: true }))
|
|
23
23
|
|
|
24
24
|
// includes .env secret delete all aio config for now
|
|
@@ -39,7 +39,7 @@ class Info extends BaseCommand {
|
|
|
39
39
|
this.log(JSON.stringify(appConfig))
|
|
40
40
|
} else if (flags.yml) {
|
|
41
41
|
// remove undefined fields
|
|
42
|
-
this.log(yaml.
|
|
42
|
+
this.log(yaml.dump(JSON.parse(JSON.stringify(appConfig)), {}))
|
|
43
43
|
} else { // flags.hson
|
|
44
44
|
this.log(JSON.stringify(appConfig, null, 2))
|
|
45
45
|
}
|
|
@@ -56,23 +56,23 @@ Info.description = `Display settings/configuration in use by an Adobe I/O App
|
|
|
56
56
|
|
|
57
57
|
Info.flags = {
|
|
58
58
|
...BaseCommand.flags,
|
|
59
|
-
json:
|
|
59
|
+
json: Flags.boolean({
|
|
60
60
|
description: 'Output json',
|
|
61
61
|
char: 'j',
|
|
62
62
|
exclusive: ['hson', 'yml']
|
|
63
63
|
}),
|
|
64
|
-
hson:
|
|
64
|
+
hson: Flags.boolean({
|
|
65
65
|
default: true,
|
|
66
66
|
description: 'Output human readable json',
|
|
67
67
|
char: 'h',
|
|
68
68
|
exclusive: ['json', 'yml']
|
|
69
69
|
}),
|
|
70
|
-
yml:
|
|
70
|
+
yml: Flags.boolean({
|
|
71
71
|
description: 'Output yml',
|
|
72
72
|
char: 'y',
|
|
73
73
|
exclusive: ['hson', 'json']
|
|
74
74
|
}),
|
|
75
|
-
mask:
|
|
75
|
+
mask: Flags.boolean({
|
|
76
76
|
description: 'Hide known private info',
|
|
77
77
|
default: true,
|
|
78
78
|
allowNo: true
|
package/src/commands/app/init.js
CHANGED
|
@@ -16,8 +16,9 @@ const fs = require('fs-extra')
|
|
|
16
16
|
const ora = require('ora')
|
|
17
17
|
const chalk = require('chalk')
|
|
18
18
|
// const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:init', { provider: 'debug' })
|
|
19
|
-
const {
|
|
19
|
+
const { Flags } = require('@oclif/core')
|
|
20
20
|
const generators = require('@adobe/generator-aio-app')
|
|
21
|
+
const hyperlinker = require('hyperlinker')
|
|
21
22
|
|
|
22
23
|
const { loadAndValidateConfigFile, importConfigJson } = require('../../lib/import')
|
|
23
24
|
const { atLeastOne } = require('../../lib/app-helper')
|
|
@@ -29,7 +30,7 @@ const DEFAULT_WORKSPACE = 'Stage'
|
|
|
29
30
|
|
|
30
31
|
class InitCommand extends AddCommand {
|
|
31
32
|
async run () {
|
|
32
|
-
const { args, flags } = this.parse(InitCommand)
|
|
33
|
+
const { args, flags } = await this.parse(InitCommand)
|
|
33
34
|
|
|
34
35
|
if (!flags.login && flags.workspace !== DEFAULT_WORKSPACE) {
|
|
35
36
|
this.error('--no-login and --workspace flags cannot be used together.')
|
|
@@ -133,7 +134,7 @@ class InitCommand extends AddCommand {
|
|
|
133
134
|
if (!isTermAccepted) {
|
|
134
135
|
const terms = await consoleCLI.getDevTermsForOrg()
|
|
135
136
|
const confirmDevTerms = await consoleCLI.prompt.promptConfirm(`${terms.text}
|
|
136
|
-
\
|
|
137
|
+
\nYou have not accepted the Developer Terms of Service. Go to ${hyperlinker('https://www.adobe.com/go/developer-terms', 'https://www.adobe.com/go/developer-terms')} to view the terms. Do you accept the terms? (y/n):`)
|
|
137
138
|
if (!confirmDevTerms) {
|
|
138
139
|
this.error('The Developer Terms of Service were declined')
|
|
139
140
|
} else {
|
|
@@ -271,15 +272,15 @@ class InitCommand extends AddCommand {
|
|
|
271
272
|
|
|
272
273
|
async runCodeGenerators (flags, extensionPoints, projectName) {
|
|
273
274
|
let env = yeoman.createEnv()
|
|
275
|
+
// by default yeoman runs the install, we control installation from the app plugin
|
|
276
|
+
env.options = { skipInstall: true }
|
|
274
277
|
const initialGenerators = ['base-app', 'add-ci']
|
|
275
278
|
// first run app generator that will generate the root skeleton + ci
|
|
276
279
|
for (const generatorKey of initialGenerators) {
|
|
277
280
|
const appGen = env.instantiate(generators[generatorKey], {
|
|
278
281
|
options: {
|
|
279
282
|
'skip-prompt': flags.yes,
|
|
280
|
-
'project-name': projectName
|
|
281
|
-
// by default yeoman runs the install, we control installation from the app plugin
|
|
282
|
-
'skip-install': true
|
|
283
|
+
'project-name': projectName
|
|
283
284
|
}
|
|
284
285
|
})
|
|
285
286
|
await env.runGenerator(appGen)
|
|
@@ -289,6 +290,8 @@ class InitCommand extends AddCommand {
|
|
|
289
290
|
// https://github.com/yeoman/environment/issues/324
|
|
290
291
|
|
|
291
292
|
env = yeoman.createEnv()
|
|
293
|
+
// by default yeoman runs the install, we control installation from the app plugin
|
|
294
|
+
env.options = { skipInstall: true }
|
|
292
295
|
// try to use appGen.composeWith
|
|
293
296
|
for (let i = 0; i < extensionPoints.length; ++i) {
|
|
294
297
|
const extGen = env.instantiate(
|
|
@@ -297,9 +300,7 @@ class InitCommand extends AddCommand {
|
|
|
297
300
|
options: {
|
|
298
301
|
'skip-prompt': flags.yes,
|
|
299
302
|
// do not prompt for overwrites
|
|
300
|
-
force: true
|
|
301
|
-
// by default yeoman runs the install, we control installation from the app plugin
|
|
302
|
-
'skip-install': true
|
|
303
|
+
force: true
|
|
303
304
|
}
|
|
304
305
|
})
|
|
305
306
|
await env.runGenerator(extGen)
|
|
@@ -329,38 +330,38 @@ InitCommand.description = `Create a new Adobe I/O App
|
|
|
329
330
|
|
|
330
331
|
InitCommand.flags = {
|
|
331
332
|
...AddCommand.flags,
|
|
332
|
-
yes:
|
|
333
|
+
yes: Flags.boolean({
|
|
333
334
|
description: 'Skip questions, and use all default values',
|
|
334
335
|
default: false,
|
|
335
336
|
char: 'y'
|
|
336
337
|
}),
|
|
337
|
-
import:
|
|
338
|
+
import: Flags.string({
|
|
338
339
|
description: 'Import an Adobe I/O Developer Console configuration file',
|
|
339
340
|
char: 'i'
|
|
340
341
|
}),
|
|
341
|
-
login:
|
|
342
|
+
login: Flags.boolean({
|
|
342
343
|
description: 'Login using your Adobe ID for interacting with Adobe I/O Developer Console',
|
|
343
344
|
default: true,
|
|
344
345
|
allowNo: true
|
|
345
346
|
}),
|
|
346
|
-
extensions:
|
|
347
|
+
extensions: Flags.boolean({
|
|
347
348
|
description: 'Use --no-extensions to create a blank application that does not integrate with Exchange',
|
|
348
349
|
default: true,
|
|
349
350
|
allowNo: true
|
|
350
351
|
}),
|
|
351
|
-
extension:
|
|
352
|
+
extension: Flags.string({
|
|
352
353
|
description: 'Extension point(s) to implement',
|
|
353
354
|
char: 'e',
|
|
354
355
|
multiple: true,
|
|
355
356
|
exclusive: ['extensions']
|
|
356
357
|
}),
|
|
357
|
-
workspace:
|
|
358
|
+
workspace: Flags.string({
|
|
358
359
|
description: 'Specify the Adobe Developer Console Workspace to init from, defaults to Stage',
|
|
359
360
|
default: DEFAULT_WORKSPACE,
|
|
360
361
|
char: 'w',
|
|
361
362
|
exclusive: ['import'] // also no-login
|
|
362
363
|
}),
|
|
363
|
-
'confirm-new-workspace':
|
|
364
|
+
'confirm-new-workspace': Flags.boolean({
|
|
364
365
|
description: 'Skip and confirm prompt for creating a new workspace',
|
|
365
366
|
default: false
|
|
366
367
|
})
|
|
@@ -12,7 +12,7 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
const BaseCommand = require('../../../BaseCommand')
|
|
13
13
|
|
|
14
14
|
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:list:extension-points', { provider: 'debug' })
|
|
15
|
-
const {
|
|
15
|
+
const { Flags } = require('@oclif/core')
|
|
16
16
|
|
|
17
17
|
const { EXTENSION_POINT_LIST } = require('../../../lib/defaults')
|
|
18
18
|
const chalk = require('chalk')
|
|
@@ -20,14 +20,14 @@ const yaml = require('js-yaml')
|
|
|
20
20
|
|
|
21
21
|
class ListExtensionPointsCommand extends BaseCommand {
|
|
22
22
|
async run () {
|
|
23
|
-
const { flags } = this.parse(ListExtensionPointsCommand)
|
|
23
|
+
const { flags } = await this.parse(ListExtensionPointsCommand)
|
|
24
24
|
aioLogger.debug(`list all extensions points with flags: ${JSON.stringify(flags)}`)
|
|
25
25
|
|
|
26
26
|
// print
|
|
27
27
|
if (flags.json) {
|
|
28
28
|
this.log(JSON.stringify(EXTENSION_POINT_LIST))
|
|
29
29
|
} else if (flags.yml) {
|
|
30
|
-
this.log(yaml.
|
|
30
|
+
this.log(yaml.dump(EXTENSION_POINT_LIST))
|
|
31
31
|
} else {
|
|
32
32
|
this.log(chalk.bold('Extensions Points'))
|
|
33
33
|
Object.keys(EXTENSION_POINT_LIST).forEach(key => {
|
|
@@ -45,11 +45,11 @@ ListExtensionPointsCommand.description = `List all extension points for the sele
|
|
|
45
45
|
`
|
|
46
46
|
ListExtensionPointsCommand.flags = {
|
|
47
47
|
...BaseCommand.flags,
|
|
48
|
-
json:
|
|
48
|
+
json: Flags.boolean({
|
|
49
49
|
description: 'Output json',
|
|
50
50
|
char: 'j'
|
|
51
51
|
}),
|
|
52
|
-
yml:
|
|
52
|
+
yml: Flags.boolean({
|
|
53
53
|
description: 'Output yml',
|
|
54
54
|
char: 'y'
|
|
55
55
|
})
|
|
@@ -12,7 +12,7 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
const BaseCommand = require('../../../BaseCommand')
|
|
13
13
|
|
|
14
14
|
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:list:extensions', { provider: 'debug' })
|
|
15
|
-
const {
|
|
15
|
+
const { Flags } = require('@oclif/core')
|
|
16
16
|
|
|
17
17
|
const { EXTENSION_POINT_LIST } = require('../../../lib/defaults')
|
|
18
18
|
const chalk = require('chalk')
|
|
@@ -20,7 +20,7 @@ const yaml = require('js-yaml')
|
|
|
20
20
|
|
|
21
21
|
class ListExtensionCommand extends BaseCommand {
|
|
22
22
|
async run () {
|
|
23
|
-
const { flags } = this.parse(ListExtensionCommand)
|
|
23
|
+
const { flags } = await this.parse(ListExtensionCommand)
|
|
24
24
|
aioLogger.debug(`list extensions with flags: ${JSON.stringify(flags)}`)
|
|
25
25
|
|
|
26
26
|
const extConfig = this.getAppExtConfigs(flags)
|
|
@@ -54,7 +54,7 @@ class ListExtensionCommand extends BaseCommand {
|
|
|
54
54
|
if (flags.json) {
|
|
55
55
|
this.log(JSON.stringify(extSummary))
|
|
56
56
|
} else if (flags.yml) {
|
|
57
|
-
this.log(yaml.
|
|
57
|
+
this.log(yaml.dump(extSummary))
|
|
58
58
|
} else {
|
|
59
59
|
if (Object.keys(extSummary).length > 0) {
|
|
60
60
|
this.log(chalk.bold('Extensions'))
|
|
@@ -81,11 +81,11 @@ ListExtensionCommand.description = `List implemented extensions
|
|
|
81
81
|
`
|
|
82
82
|
ListExtensionCommand.flags = {
|
|
83
83
|
...BaseCommand.flags,
|
|
84
|
-
json:
|
|
84
|
+
json: Flags.boolean({
|
|
85
85
|
description: 'Output json',
|
|
86
86
|
char: 'j'
|
|
87
87
|
}),
|
|
88
|
-
yml:
|
|
88
|
+
yml: Flags.boolean({
|
|
89
89
|
description: 'Output yml',
|
|
90
90
|
char: 'y'
|
|
91
91
|
})
|
|
@@ -9,13 +9,13 @@ 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
|
|
12
|
+
const { Help } = require('@oclif/core')
|
|
13
13
|
const BaseCommand = require('../../../BaseCommand')
|
|
14
14
|
|
|
15
15
|
class ListCommand extends BaseCommand {
|
|
16
16
|
async run () {
|
|
17
|
-
const help = new
|
|
18
|
-
help.showHelp(['app:list', '--help'])
|
|
17
|
+
const help = new Help(this.config)
|
|
18
|
+
await help.showHelp(['app:list', '--help'])
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
package/src/commands/app/logs.js
CHANGED
|
@@ -10,7 +10,7 @@ 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 {
|
|
13
|
+
const { Flags } = require('@oclif/core')
|
|
14
14
|
const BaseCommand = require('../../BaseCommand')
|
|
15
15
|
const { wrapError } = require('../../lib/app-helper')
|
|
16
16
|
const rtLib = require('@adobe/aio-lib-runtime')
|
|
@@ -35,7 +35,7 @@ class Logs extends BaseCommand {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
async run () {
|
|
38
|
-
const { flags } = this.parse(Logs)
|
|
38
|
+
const { flags } = await this.parse(Logs)
|
|
39
39
|
const fullConfig = this.getFullConfig()
|
|
40
40
|
|
|
41
41
|
// has any backend
|
|
@@ -95,7 +95,7 @@ class Logs extends BaseCommand {
|
|
|
95
95
|
|
|
96
96
|
try {
|
|
97
97
|
const owConfig = { ow: Object.values(fullConfig.all)[0].ow }
|
|
98
|
-
await rtLib.printActionLogs(owConfig, this.log, flags.limit, filterActions, flags.strip, flags.poll || flags.tail || flags.watch)
|
|
98
|
+
await rtLib.printActionLogs(owConfig, this.log.bind(this), flags.limit, filterActions, flags.strip, flags.poll || flags.tail || flags.watch)
|
|
99
99
|
} catch (error) {
|
|
100
100
|
this.error(wrapError(error))
|
|
101
101
|
}
|
|
@@ -107,34 +107,34 @@ Logs.description = `Fetch logs for an Adobe I/O App
|
|
|
107
107
|
|
|
108
108
|
Logs.flags = {
|
|
109
109
|
...BaseCommand.flags,
|
|
110
|
-
limit:
|
|
110
|
+
limit: Flags.integer({
|
|
111
111
|
description: 'Limit number of activations to fetch logs from ( 1-50 )',
|
|
112
112
|
default: 1,
|
|
113
113
|
char: 'l'
|
|
114
114
|
}),
|
|
115
|
-
action:
|
|
115
|
+
action: Flags.string({
|
|
116
116
|
description: 'Fetch logs for a specific action',
|
|
117
117
|
char: 'a',
|
|
118
118
|
multiple: true
|
|
119
119
|
}),
|
|
120
|
-
strip:
|
|
120
|
+
strip: Flags.boolean({
|
|
121
121
|
char: 'r',
|
|
122
122
|
description: 'strip timestamp information and output first line only',
|
|
123
123
|
default: false
|
|
124
124
|
}),
|
|
125
|
-
tail:
|
|
125
|
+
tail: Flags.boolean({
|
|
126
126
|
description: 'Fetch logs continuously',
|
|
127
127
|
char: 't',
|
|
128
128
|
default: false,
|
|
129
129
|
exclusive: ['watch', 'poll']
|
|
130
130
|
}),
|
|
131
|
-
watch:
|
|
131
|
+
watch: Flags.boolean({
|
|
132
132
|
description: 'Fetch logs continuously',
|
|
133
133
|
default: false,
|
|
134
134
|
char: 'w',
|
|
135
135
|
exclusive: ['tail', 'poll']
|
|
136
136
|
}),
|
|
137
|
-
poll:
|
|
137
|
+
poll: Flags.boolean({
|
|
138
138
|
description: 'Fetch logs continuously',
|
|
139
139
|
default: false,
|
|
140
140
|
char: 'o',
|
package/src/commands/app/run.js
CHANGED
|
@@ -15,9 +15,8 @@ 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 { cli } = require('cli-ux')
|
|
19
18
|
|
|
20
|
-
const {
|
|
19
|
+
const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
|
|
21
20
|
const coreConfig = require('@adobe/aio-lib-core-config')
|
|
22
21
|
|
|
23
22
|
const BaseCommand = require('../../BaseCommand')
|
|
@@ -33,7 +32,7 @@ const CONFIG_KEY = 'aio-dev.dev-keys'
|
|
|
33
32
|
class Run extends BaseCommand {
|
|
34
33
|
async run () {
|
|
35
34
|
// cli input
|
|
36
|
-
const { flags } = this.parse(Run)
|
|
35
|
+
const { flags } = await this.parse(Run)
|
|
37
36
|
// aliases
|
|
38
37
|
flags.actions = flags.actions && !flags['skip-actions']
|
|
39
38
|
|
|
@@ -42,7 +41,7 @@ class Run extends BaseCommand {
|
|
|
42
41
|
const runConfigs = this.getAppExtConfigs(flags)
|
|
43
42
|
const entries = Object.entries(runConfigs)
|
|
44
43
|
if (entries.length > 1) {
|
|
45
|
-
this.error('You can only run one
|
|
44
|
+
this.error('Your app implements multiple extensions. You can only run one at the time, please select which extension to run with the \'-e\' flag.')
|
|
46
45
|
}
|
|
47
46
|
const name = entries[0][0]
|
|
48
47
|
const config = entries[0][1]
|
|
@@ -78,7 +77,7 @@ class Run extends BaseCommand {
|
|
|
78
77
|
shouldContentHash: false
|
|
79
78
|
},
|
|
80
79
|
fetchLogs: true,
|
|
81
|
-
|
|
80
|
+
isLocal: flags.local,
|
|
82
81
|
verbose: flags.verbose
|
|
83
82
|
}
|
|
84
83
|
|
|
@@ -203,31 +202,31 @@ Run.description = 'Run an Adobe I/O App'
|
|
|
203
202
|
|
|
204
203
|
Run.flags = {
|
|
205
204
|
...BaseCommand.flags,
|
|
206
|
-
local:
|
|
205
|
+
local: Flags.boolean({
|
|
207
206
|
description: 'Run/debug actions locally ( requires Docker running )',
|
|
208
207
|
exclusive: ['skip-actions']
|
|
209
208
|
}),
|
|
210
|
-
serve:
|
|
209
|
+
serve: Flags.boolean({
|
|
211
210
|
description: '[default: true] Start frontend server (experimental)',
|
|
212
211
|
default: true,
|
|
213
212
|
allowNo: true
|
|
214
213
|
}),
|
|
215
|
-
'skip-actions':
|
|
214
|
+
'skip-actions': Flags.boolean({
|
|
216
215
|
description: '[deprecated] Please use --no-actions',
|
|
217
216
|
exclusive: ['local'],
|
|
218
217
|
default: false
|
|
219
218
|
}),
|
|
220
|
-
actions:
|
|
219
|
+
actions: Flags.boolean({
|
|
221
220
|
description: '[default: true] Run actions, defaults to true, to skip actions use --no-actions',
|
|
222
221
|
exclusive: ['local'], // no-actions and local don't work together
|
|
223
222
|
default: true,
|
|
224
223
|
allowNo: true
|
|
225
224
|
}),
|
|
226
|
-
open:
|
|
225
|
+
open: Flags.boolean({
|
|
227
226
|
description: 'Open the default web browser after a successful run, only valid if your app has a front-end',
|
|
228
227
|
default: false
|
|
229
228
|
}),
|
|
230
|
-
extension:
|
|
229
|
+
extension: Flags.string({
|
|
231
230
|
description: 'Run only a specific extension, this flag can only be specified once',
|
|
232
231
|
char: 'e',
|
|
233
232
|
// we do not support multiple yet
|
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
|
})
|