@adobe/aio-cli-plugin-app 8.5.0 → 8.6.1-pre.2022-06-25.2ab6c018
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 +686 -256
- package/oclif.manifest.json +1 -1
- package/package.json +23 -27
- package/schema/config.schema.json +10 -1
- package/src/AddCommand.js +3 -3
- package/src/BaseCommand.js +13 -8
- package/src/commands/app/add/action.js +4 -4
- package/src/commands/app/add/ci.js +2 -2
- package/src/commands/app/add/event.js +4 -4
- package/src/commands/app/add/extension.js +4 -4
- 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 +4 -4
- package/src/commands/app/build.js +13 -13
- 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 +3 -3
- 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 +28 -9
- 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 +12 -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/build-actions.js +3 -2
- package/src/lib/deploy-actions.js +3 -3
- package/src/lib/run-dev.js +3 -4
- package/src/lib/run-local-runtime.js +22 -12
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
|
|
|
@@ -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?'))
|
|
@@ -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
|
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')
|
|
@@ -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,7 +94,7 @@ 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
|
|