@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
|
@@ -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,17 +12,18 @@ 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')
|
|
19
19
|
const { getActionUrls } = require('@adobe/aio-lib-runtime').utils
|
|
20
20
|
const yaml = require('js-yaml')
|
|
21
|
+
const { loadLocalDevConfig } = require('../../lib/run-local-runtime')
|
|
21
22
|
|
|
22
23
|
class GetUrlCommand extends BaseCommand {
|
|
23
24
|
async run () {
|
|
24
25
|
// cli input
|
|
25
|
-
const { args, flags } = this.parse(GetUrlCommand)
|
|
26
|
+
const { args, flags } = await this.parse(GetUrlCommand)
|
|
26
27
|
|
|
27
28
|
try {
|
|
28
29
|
const options = {}
|
|
@@ -45,9 +46,16 @@ class GetUrlCommand extends BaseCommand {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
const actionUrls = {}
|
|
48
|
-
|
|
49
|
-
Object.
|
|
50
|
-
|
|
49
|
+
if (flags.local) {
|
|
50
|
+
Object.values(fullConfig.all).forEach(config => {
|
|
51
|
+
const localDevConfig = loadLocalDevConfig(config)
|
|
52
|
+
Object.assign(actionUrls, getActionUrls(localDevConfig, false, true))
|
|
53
|
+
})
|
|
54
|
+
} else {
|
|
55
|
+
Object.values(fullConfig.all).forEach(config => {
|
|
56
|
+
Object.assign(actionUrls, getActionUrls(config, true))
|
|
57
|
+
})
|
|
58
|
+
}
|
|
51
59
|
urls.runtime = actionUrls
|
|
52
60
|
const cdnUrls = {}
|
|
53
61
|
if (options.cdn) {
|
|
@@ -88,20 +96,23 @@ GetUrlCommand.description = 'Get action URLs'
|
|
|
88
96
|
|
|
89
97
|
GetUrlCommand.flags = {
|
|
90
98
|
...BaseCommand.flags,
|
|
91
|
-
cdn:
|
|
99
|
+
cdn: Flags.boolean({
|
|
92
100
|
description: 'Display CDN based action URLs'
|
|
93
101
|
}),
|
|
94
|
-
json:
|
|
102
|
+
json: Flags.boolean({
|
|
95
103
|
description: 'Output json',
|
|
96
104
|
char: 'j'
|
|
97
105
|
}),
|
|
98
|
-
hson:
|
|
106
|
+
hson: Flags.boolean({
|
|
99
107
|
description: 'Output human readable json',
|
|
100
108
|
char: 'h'
|
|
101
109
|
}),
|
|
102
|
-
yml:
|
|
110
|
+
yml: Flags.boolean({
|
|
103
111
|
description: 'Output yml',
|
|
104
112
|
char: 'y'
|
|
113
|
+
}),
|
|
114
|
+
local: Flags.boolean({
|
|
115
|
+
description: 'Display locally based action URLs'
|
|
105
116
|
})
|
|
106
117
|
}
|
|
107
118
|
|
|
@@ -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.safeDump(JSON.parse(JSON.stringify(appConfig))))
|
|
42
|
+
this.log(yaml.safeDump(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,7 +16,7 @@ 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
21
|
|
|
22
22
|
const { loadAndValidateConfigFile, importConfigJson } = require('../../lib/import')
|
|
@@ -29,7 +29,7 @@ const DEFAULT_WORKSPACE = 'Stage'
|
|
|
29
29
|
|
|
30
30
|
class InitCommand extends AddCommand {
|
|
31
31
|
async run () {
|
|
32
|
-
const { args, flags } = this.parse(InitCommand)
|
|
32
|
+
const { args, flags } = await this.parse(InitCommand)
|
|
33
33
|
|
|
34
34
|
if (!flags.login && flags.workspace !== DEFAULT_WORKSPACE) {
|
|
35
35
|
this.error('--no-login and --workspace flags cannot be used together.')
|
|
@@ -128,6 +128,24 @@ class InitCommand extends AddCommand {
|
|
|
128
128
|
this.log(chalk.blue(chalk.bold(`Project initialized for Workspace ${workspace.name}, you can run 'aio app use -w <workspace>' to switch workspace.`)))
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
async ensureDevTermAccepted (consoleCLI, orgId) {
|
|
132
|
+
const isTermAccepted = await consoleCLI.checkDevTermsForOrg(orgId)
|
|
133
|
+
if (!isTermAccepted) {
|
|
134
|
+
const terms = await consoleCLI.getDevTermsForOrg()
|
|
135
|
+
const confirmDevTerms = await consoleCLI.prompt.promptConfirm(`${terms.text}
|
|
136
|
+
\nDo you agree with the new Developer Terms?`)
|
|
137
|
+
if (!confirmDevTerms) {
|
|
138
|
+
this.error('The Developer Terms of Service were declined')
|
|
139
|
+
} else {
|
|
140
|
+
const accepted = await consoleCLI.acceptDevTermsForOrg(orgId)
|
|
141
|
+
if (!accepted) {
|
|
142
|
+
this.error('The Developer Terms of Service could not be accepted')
|
|
143
|
+
}
|
|
144
|
+
this.log(`The Developer Terms of Service were successfully accepted for org ${orgId}`)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
131
149
|
async selectExtensionPoints (flags, orgSupportedServices = null) {
|
|
132
150
|
if (!flags.extensions) {
|
|
133
151
|
return [implPromptChoices.find(i => i.value.name === 'application').value]
|
|
@@ -167,6 +185,7 @@ class InitCommand extends AddCommand {
|
|
|
167
185
|
async selectConsoleOrg (consoleCLI) {
|
|
168
186
|
const organizations = await consoleCLI.getOrganizations()
|
|
169
187
|
const selectedOrg = await consoleCLI.promptForSelectOrganization(organizations)
|
|
188
|
+
await this.ensureDevTermAccepted(consoleCLI, selectedOrg.id)
|
|
170
189
|
return selectedOrg
|
|
171
190
|
}
|
|
172
191
|
|
|
@@ -252,15 +271,15 @@ class InitCommand extends AddCommand {
|
|
|
252
271
|
|
|
253
272
|
async runCodeGenerators (flags, extensionPoints, projectName) {
|
|
254
273
|
let env = yeoman.createEnv()
|
|
274
|
+
// by default yeoman runs the install, we control installation from the app plugin
|
|
275
|
+
env.options = { skipInstall: true }
|
|
255
276
|
const initialGenerators = ['base-app', 'add-ci']
|
|
256
277
|
// first run app generator that will generate the root skeleton + ci
|
|
257
278
|
for (const generatorKey of initialGenerators) {
|
|
258
279
|
const appGen = env.instantiate(generators[generatorKey], {
|
|
259
280
|
options: {
|
|
260
281
|
'skip-prompt': flags.yes,
|
|
261
|
-
'project-name': projectName
|
|
262
|
-
// by default yeoman runs the install, we control installation from the app plugin
|
|
263
|
-
'skip-install': true
|
|
282
|
+
'project-name': projectName
|
|
264
283
|
}
|
|
265
284
|
})
|
|
266
285
|
await env.runGenerator(appGen)
|
|
@@ -270,6 +289,8 @@ class InitCommand extends AddCommand {
|
|
|
270
289
|
// https://github.com/yeoman/environment/issues/324
|
|
271
290
|
|
|
272
291
|
env = yeoman.createEnv()
|
|
292
|
+
// by default yeoman runs the install, we control installation from the app plugin
|
|
293
|
+
env.options = { skipInstall: true }
|
|
273
294
|
// try to use appGen.composeWith
|
|
274
295
|
for (let i = 0; i < extensionPoints.length; ++i) {
|
|
275
296
|
const extGen = env.instantiate(
|
|
@@ -278,9 +299,7 @@ class InitCommand extends AddCommand {
|
|
|
278
299
|
options: {
|
|
279
300
|
'skip-prompt': flags.yes,
|
|
280
301
|
// do not prompt for overwrites
|
|
281
|
-
force: true
|
|
282
|
-
// by default yeoman runs the install, we control installation from the app plugin
|
|
283
|
-
'skip-install': true
|
|
302
|
+
force: true
|
|
284
303
|
}
|
|
285
304
|
})
|
|
286
305
|
await env.runGenerator(extGen)
|
|
@@ -310,38 +329,38 @@ InitCommand.description = `Create a new Adobe I/O App
|
|
|
310
329
|
|
|
311
330
|
InitCommand.flags = {
|
|
312
331
|
...AddCommand.flags,
|
|
313
|
-
yes:
|
|
332
|
+
yes: Flags.boolean({
|
|
314
333
|
description: 'Skip questions, and use all default values',
|
|
315
334
|
default: false,
|
|
316
335
|
char: 'y'
|
|
317
336
|
}),
|
|
318
|
-
import:
|
|
337
|
+
import: Flags.string({
|
|
319
338
|
description: 'Import an Adobe I/O Developer Console configuration file',
|
|
320
339
|
char: 'i'
|
|
321
340
|
}),
|
|
322
|
-
login:
|
|
341
|
+
login: Flags.boolean({
|
|
323
342
|
description: 'Login using your Adobe ID for interacting with Adobe I/O Developer Console',
|
|
324
343
|
default: true,
|
|
325
344
|
allowNo: true
|
|
326
345
|
}),
|
|
327
|
-
extensions:
|
|
346
|
+
extensions: Flags.boolean({
|
|
328
347
|
description: 'Use --no-extensions to create a blank application that does not integrate with Exchange',
|
|
329
348
|
default: true,
|
|
330
349
|
allowNo: true
|
|
331
350
|
}),
|
|
332
|
-
extension:
|
|
351
|
+
extension: Flags.string({
|
|
333
352
|
description: 'Extension point(s) to implement',
|
|
334
353
|
char: 'e',
|
|
335
354
|
multiple: true,
|
|
336
355
|
exclusive: ['extensions']
|
|
337
356
|
}),
|
|
338
|
-
workspace:
|
|
357
|
+
workspace: Flags.string({
|
|
339
358
|
description: 'Specify the Adobe Developer Console Workspace to init from, defaults to Stage',
|
|
340
359
|
default: DEFAULT_WORKSPACE,
|
|
341
360
|
char: 'w',
|
|
342
361
|
exclusive: ['import'] // also no-login
|
|
343
362
|
}),
|
|
344
|
-
'confirm-new-workspace':
|
|
363
|
+
'confirm-new-workspace': Flags.boolean({
|
|
345
364
|
description: 'Skip and confirm prompt for creating a new workspace',
|
|
346
365
|
default: false
|
|
347
366
|
})
|
|
@@ -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,7 +20,7 @@ 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
|
|
@@ -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)
|
|
@@ -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,28 +10,32 @@ 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')
|
|
17
17
|
const LogForwarding = require('../../lib/log-forwarding')
|
|
18
18
|
|
|
19
|
+
const SECURED = 'require-adobe-auth'
|
|
20
|
+
|
|
19
21
|
class Logs extends BaseCommand {
|
|
20
22
|
_processEachAction (fullConfig, processFn) {
|
|
23
|
+
const isSecuredAction = (pkg, aName) => pkg && pkg.actions && pkg.actions[aName] &&
|
|
24
|
+
pkg.actions[aName].annotations && pkg.actions[aName].annotations[SECURED]
|
|
25
|
+
|
|
21
26
|
Object.entries(fullConfig.all).forEach(([, config]) => {
|
|
22
27
|
Object.entries(config.manifest.full.packages).forEach(([packageName, pkg]) => {
|
|
23
28
|
// handle default package
|
|
24
29
|
packageName = packageName.replace(/__APP_PACKAGE__/g, config.ow.package)
|
|
25
|
-
|
|
26
30
|
Object.keys(pkg.actions).forEach((aName) => {
|
|
27
|
-
processFn(packageName, aName)
|
|
31
|
+
processFn(packageName, aName, isSecuredAction(pkg, aName))
|
|
28
32
|
})
|
|
29
33
|
})
|
|
30
34
|
})
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
async run () {
|
|
34
|
-
const { flags } = this.parse(Logs)
|
|
38
|
+
const { flags } = await this.parse(Logs)
|
|
35
39
|
const fullConfig = this.getFullConfig()
|
|
36
40
|
|
|
37
41
|
// has any backend
|
|
@@ -80,14 +84,18 @@ class Logs extends BaseCommand {
|
|
|
80
84
|
}
|
|
81
85
|
})
|
|
82
86
|
} else {
|
|
83
|
-
this._processEachAction(fullConfig, (packageName, aName) => {
|
|
87
|
+
this._processEachAction(fullConfig, (packageName, aName, isSecured) => {
|
|
88
|
+
if (isSecured) {
|
|
89
|
+
const securedAName = '__secured_' + aName
|
|
90
|
+
filterActions.push(`${packageName}/${securedAName}`)
|
|
91
|
+
}
|
|
84
92
|
filterActions.push(`${packageName}/${aName}`)
|
|
85
93
|
})
|
|
86
94
|
}
|
|
87
95
|
|
|
88
96
|
try {
|
|
89
97
|
const owConfig = { ow: Object.values(fullConfig.all)[0].ow }
|
|
90
|
-
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)
|
|
91
99
|
} catch (error) {
|
|
92
100
|
this.error(wrapError(error))
|
|
93
101
|
}
|
|
@@ -99,34 +107,34 @@ Logs.description = `Fetch logs for an Adobe I/O App
|
|
|
99
107
|
|
|
100
108
|
Logs.flags = {
|
|
101
109
|
...BaseCommand.flags,
|
|
102
|
-
limit:
|
|
110
|
+
limit: Flags.integer({
|
|
103
111
|
description: 'Limit number of activations to fetch logs from ( 1-50 )',
|
|
104
112
|
default: 1,
|
|
105
113
|
char: 'l'
|
|
106
114
|
}),
|
|
107
|
-
action:
|
|
115
|
+
action: Flags.string({
|
|
108
116
|
description: 'Fetch logs for a specific action',
|
|
109
117
|
char: 'a',
|
|
110
118
|
multiple: true
|
|
111
119
|
}),
|
|
112
|
-
strip:
|
|
120
|
+
strip: Flags.boolean({
|
|
113
121
|
char: 'r',
|
|
114
122
|
description: 'strip timestamp information and output first line only',
|
|
115
123
|
default: false
|
|
116
124
|
}),
|
|
117
|
-
tail:
|
|
125
|
+
tail: Flags.boolean({
|
|
118
126
|
description: 'Fetch logs continuously',
|
|
119
127
|
char: 't',
|
|
120
128
|
default: false,
|
|
121
129
|
exclusive: ['watch', 'poll']
|
|
122
130
|
}),
|
|
123
|
-
watch:
|
|
131
|
+
watch: Flags.boolean({
|
|
124
132
|
description: 'Fetch logs continuously',
|
|
125
133
|
default: false,
|
|
126
134
|
char: 'w',
|
|
127
135
|
exclusive: ['tail', 'poll']
|
|
128
136
|
}),
|
|
129
|
-
poll:
|
|
137
|
+
poll: Flags.boolean({
|
|
130
138
|
description: 'Fetch logs continuously',
|
|
131
139
|
default: false,
|
|
132
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]
|
|
@@ -60,6 +59,7 @@ class Run extends BaseCommand {
|
|
|
60
59
|
async runOneExtensionPoint (name, config, flags, spinner) {
|
|
61
60
|
const hasBackend = config.app.hasBackend
|
|
62
61
|
const hasFrontend = config.app.hasFrontend
|
|
62
|
+
const headlessApp = hasBackend && !hasFrontend
|
|
63
63
|
|
|
64
64
|
if (!hasBackend && !hasFrontend) {
|
|
65
65
|
this.error(new Error('nothing to run.. there is no frontend and no manifest.yml, are you in a valid app?'))
|
|
@@ -77,7 +77,7 @@ class Run extends BaseCommand {
|
|
|
77
77
|
shouldContentHash: false
|
|
78
78
|
},
|
|
79
79
|
fetchLogs: true,
|
|
80
|
-
|
|
80
|
+
isLocal: flags.local,
|
|
81
81
|
verbose: flags.verbose
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -97,7 +97,8 @@ class Run extends BaseCommand {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
const
|
|
100
|
+
const verboseOutput = flags.verbose || flags.local || headlessApp
|
|
101
|
+
const onProgress = !verboseOutput
|
|
101
102
|
? info => {
|
|
102
103
|
spinner.text = info
|
|
103
104
|
}
|
|
@@ -201,31 +202,31 @@ Run.description = 'Run an Adobe I/O App'
|
|
|
201
202
|
|
|
202
203
|
Run.flags = {
|
|
203
204
|
...BaseCommand.flags,
|
|
204
|
-
local:
|
|
205
|
+
local: Flags.boolean({
|
|
205
206
|
description: 'Run/debug actions locally ( requires Docker running )',
|
|
206
207
|
exclusive: ['skip-actions']
|
|
207
208
|
}),
|
|
208
|
-
serve:
|
|
209
|
+
serve: Flags.boolean({
|
|
209
210
|
description: '[default: true] Start frontend server (experimental)',
|
|
210
211
|
default: true,
|
|
211
212
|
allowNo: true
|
|
212
213
|
}),
|
|
213
|
-
'skip-actions':
|
|
214
|
+
'skip-actions': Flags.boolean({
|
|
214
215
|
description: '[deprecated] Please use --no-actions',
|
|
215
216
|
exclusive: ['local'],
|
|
216
217
|
default: false
|
|
217
218
|
}),
|
|
218
|
-
actions:
|
|
219
|
+
actions: Flags.boolean({
|
|
219
220
|
description: '[default: true] Run actions, defaults to true, to skip actions use --no-actions',
|
|
220
221
|
exclusive: ['local'], // no-actions and local don't work together
|
|
221
222
|
default: true,
|
|
222
223
|
allowNo: true
|
|
223
224
|
}),
|
|
224
|
-
open:
|
|
225
|
+
open: Flags.boolean({
|
|
225
226
|
description: 'Open the default web browser after a successful run, only valid if your app has a front-end',
|
|
226
227
|
default: false
|
|
227
228
|
}),
|
|
228
|
-
extension:
|
|
229
|
+
extension: Flags.string({
|
|
229
230
|
description: 'Run only a specific extension, this flag can only be specified once',
|
|
230
231
|
char: 'e',
|
|
231
232
|
// we do not support multiple yet
|