@adobe/aio-cli-plugin-app 13.1.3 → 13.3.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 +30 -30
- package/oclif.manifest.json +2 -2
- package/package.json +2 -2
- package/src/commands/app/build.js +2 -2
- package/src/commands/app/config/set/log-forwarding.js +7 -1
- package/src/commands/app/deploy.js +8 -3
- package/src/commands/app/undeploy.js +4 -1
- package/src/lib/auth-helper.js +63 -0
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ DESCRIPTION
|
|
|
72
72
|
Create, run, test, and deploy Adobe I/O Apps
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
_See code: [src/commands/app/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
75
|
+
_See code: [src/commands/app/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/index.js)_
|
|
76
76
|
|
|
77
77
|
## `aio app add`
|
|
78
78
|
|
|
@@ -90,7 +90,7 @@ DESCRIPTION
|
|
|
90
90
|
Add a new component to an existing Adobe I/O App
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
_See code: [src/commands/app/add/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
93
|
+
_See code: [src/commands/app/add/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/add/index.js)_
|
|
94
94
|
|
|
95
95
|
## `aio app add action`
|
|
96
96
|
|
|
@@ -115,7 +115,7 @@ ALIASES
|
|
|
115
115
|
$ aio app add actions
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
_See code: [src/commands/app/add/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
118
|
+
_See code: [src/commands/app/add/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/add/action.js)_
|
|
119
119
|
|
|
120
120
|
## `aio app add ci`
|
|
121
121
|
|
|
@@ -133,7 +133,7 @@ DESCRIPTION
|
|
|
133
133
|
Add CI files
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
_See code: [src/commands/app/add/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
136
|
+
_See code: [src/commands/app/add/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/add/ci.js)_
|
|
137
137
|
|
|
138
138
|
## `aio app add event`
|
|
139
139
|
|
|
@@ -158,7 +158,7 @@ ALIASES
|
|
|
158
158
|
$ aio app add events
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
_See code: [src/commands/app/add/event.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
161
|
+
_See code: [src/commands/app/add/event.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/add/event.js)_
|
|
162
162
|
|
|
163
163
|
## `aio app add extension`
|
|
164
164
|
|
|
@@ -184,7 +184,7 @@ ALIASES
|
|
|
184
184
|
$ aio app add extensions
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
_See code: [src/commands/app/add/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
187
|
+
_See code: [src/commands/app/add/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/add/extension.js)_
|
|
188
188
|
|
|
189
189
|
## `aio app add service`
|
|
190
190
|
|
|
@@ -208,7 +208,7 @@ ALIASES
|
|
|
208
208
|
$ aio app add services
|
|
209
209
|
```
|
|
210
210
|
|
|
211
|
-
_See code: [src/commands/app/add/service.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
211
|
+
_See code: [src/commands/app/add/service.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/add/service.js)_
|
|
212
212
|
|
|
213
213
|
## `aio app add web-assets`
|
|
214
214
|
|
|
@@ -229,7 +229,7 @@ DESCRIPTION
|
|
|
229
229
|
Add web assets support
|
|
230
230
|
```
|
|
231
231
|
|
|
232
|
-
_See code: [src/commands/app/add/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
232
|
+
_See code: [src/commands/app/add/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/add/web-assets.js)_
|
|
233
233
|
|
|
234
234
|
## `aio app build`
|
|
235
235
|
|
|
@@ -247,7 +247,7 @@ FLAGS
|
|
|
247
247
|
-v, --verbose Verbose output
|
|
248
248
|
--[no-]actions [default: true] Build actions if any
|
|
249
249
|
--[no-]content-hash [default: true] Enable content hashing in browser code
|
|
250
|
-
--[no-]force-build [default:
|
|
250
|
+
--[no-]force-build [default: true] Force a build even if one already exists
|
|
251
251
|
--version Show version
|
|
252
252
|
--[no-]web-assets [default: true] Build web-assets if any
|
|
253
253
|
--web-optimize [default: false] Enable optimization (minification) of js/css/html
|
|
@@ -259,7 +259,7 @@ DESCRIPTION
|
|
|
259
259
|
Use the --force-build flag to force a build even if one already exists.
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
-
_See code: [src/commands/app/build.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
262
|
+
_See code: [src/commands/app/build.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/build.js)_
|
|
263
263
|
|
|
264
264
|
## `aio app create [PATH]`
|
|
265
265
|
|
|
@@ -281,7 +281,7 @@ DESCRIPTION
|
|
|
281
281
|
Create a new Adobe I/O App with default parameters
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
-
_See code: [src/commands/app/create.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
284
|
+
_See code: [src/commands/app/create.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/create.js)_
|
|
285
285
|
|
|
286
286
|
## `aio app delete`
|
|
287
287
|
|
|
@@ -299,7 +299,7 @@ DESCRIPTION
|
|
|
299
299
|
Delete a component from an existing Adobe I/O App
|
|
300
300
|
```
|
|
301
301
|
|
|
302
|
-
_See code: [src/commands/app/delete/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
302
|
+
_See code: [src/commands/app/delete/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/delete/index.js)_
|
|
303
303
|
|
|
304
304
|
## `aio app delete action [ACTION-NAME]`
|
|
305
305
|
|
|
@@ -325,7 +325,7 @@ ALIASES
|
|
|
325
325
|
$ aio app delete actions
|
|
326
326
|
```
|
|
327
327
|
|
|
328
|
-
_See code: [src/commands/app/delete/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
328
|
+
_See code: [src/commands/app/delete/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/delete/action.js)_
|
|
329
329
|
|
|
330
330
|
## `aio app delete ci`
|
|
331
331
|
|
|
@@ -344,7 +344,7 @@ DESCRIPTION
|
|
|
344
344
|
Delete existing CI files
|
|
345
345
|
```
|
|
346
346
|
|
|
347
|
-
_See code: [src/commands/app/delete/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
347
|
+
_See code: [src/commands/app/delete/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/delete/ci.js)_
|
|
348
348
|
|
|
349
349
|
## `aio app delete extension`
|
|
350
350
|
|
|
@@ -370,7 +370,7 @@ ALIASES
|
|
|
370
370
|
$ aio app delete extensions
|
|
371
371
|
```
|
|
372
372
|
|
|
373
|
-
_See code: [src/commands/app/delete/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
373
|
+
_See code: [src/commands/app/delete/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/delete/extension.js)_
|
|
374
374
|
|
|
375
375
|
## `aio app delete service`
|
|
376
376
|
|
|
@@ -394,7 +394,7 @@ ALIASES
|
|
|
394
394
|
$ aio app delete services
|
|
395
395
|
```
|
|
396
396
|
|
|
397
|
-
_See code: [src/commands/app/delete/service.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
397
|
+
_See code: [src/commands/app/delete/service.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/delete/service.js)_
|
|
398
398
|
|
|
399
399
|
## `aio app delete web-assets`
|
|
400
400
|
|
|
@@ -413,7 +413,7 @@ DESCRIPTION
|
|
|
413
413
|
Delete existing web assets
|
|
414
414
|
```
|
|
415
415
|
|
|
416
|
-
_See code: [src/commands/app/delete/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
416
|
+
_See code: [src/commands/app/delete/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/delete/web-assets.js)_
|
|
417
417
|
|
|
418
418
|
## `aio app deploy`
|
|
419
419
|
|
|
@@ -459,7 +459,7 @@ DESCRIPTION
|
|
|
459
459
|
Use the --force-deploy flag to force deploy changes, regardless of production Workspace being published in Exchange.
|
|
460
460
|
```
|
|
461
461
|
|
|
462
|
-
_See code: [src/commands/app/deploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
462
|
+
_See code: [src/commands/app/deploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/deploy.js)_
|
|
463
463
|
|
|
464
464
|
## `aio app get-url [ACTION]`
|
|
465
465
|
|
|
@@ -482,7 +482,7 @@ DESCRIPTION
|
|
|
482
482
|
Get action URLs
|
|
483
483
|
```
|
|
484
484
|
|
|
485
|
-
_See code: [src/commands/app/get-url.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
485
|
+
_See code: [src/commands/app/get-url.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/get-url.js)_
|
|
486
486
|
|
|
487
487
|
## `aio app info`
|
|
488
488
|
|
|
@@ -504,7 +504,7 @@ DESCRIPTION
|
|
|
504
504
|
Display settings/configuration in use by an Adobe I/O App
|
|
505
505
|
```
|
|
506
506
|
|
|
507
|
-
_See code: [src/commands/app/info.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
507
|
+
_See code: [src/commands/app/info.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/info.js)_
|
|
508
508
|
|
|
509
509
|
## `aio app init [PATH]`
|
|
510
510
|
|
|
@@ -543,7 +543,7 @@ DESCRIPTION
|
|
|
543
543
|
Create a new Adobe I/O App
|
|
544
544
|
```
|
|
545
545
|
|
|
546
|
-
_See code: [src/commands/app/init.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
546
|
+
_See code: [src/commands/app/init.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/init.js)_
|
|
547
547
|
|
|
548
548
|
## `aio app install PATH`
|
|
549
549
|
|
|
@@ -566,7 +566,7 @@ DESCRIPTION
|
|
|
566
566
|
This command will support installing apps packaged by 'aio app pack'.
|
|
567
567
|
```
|
|
568
568
|
|
|
569
|
-
_See code: [src/commands/app/install.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
569
|
+
_See code: [src/commands/app/install.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/install.js)_
|
|
570
570
|
|
|
571
571
|
## `aio app list`
|
|
572
572
|
|
|
@@ -584,7 +584,7 @@ DESCRIPTION
|
|
|
584
584
|
List components for Adobe I/O App
|
|
585
585
|
```
|
|
586
586
|
|
|
587
|
-
_See code: [src/commands/app/list/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
587
|
+
_See code: [src/commands/app/list/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/list/index.js)_
|
|
588
588
|
|
|
589
589
|
## `aio app list extension`
|
|
590
590
|
|
|
@@ -609,7 +609,7 @@ ALIASES
|
|
|
609
609
|
$ aio app list extensions
|
|
610
610
|
```
|
|
611
611
|
|
|
612
|
-
_See code: [src/commands/app/list/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
612
|
+
_See code: [src/commands/app/list/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/list/extension.js)_
|
|
613
613
|
|
|
614
614
|
## `aio app logs`
|
|
615
615
|
|
|
@@ -633,7 +633,7 @@ DESCRIPTION
|
|
|
633
633
|
Fetch logs for an Adobe I/O App
|
|
634
634
|
```
|
|
635
635
|
|
|
636
|
-
_See code: [src/commands/app/logs.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
636
|
+
_See code: [src/commands/app/logs.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/logs.js)_
|
|
637
637
|
|
|
638
638
|
## `aio app pack [PATH]`
|
|
639
639
|
|
|
@@ -655,7 +655,7 @@ DESCRIPTION
|
|
|
655
655
|
This command will support packaging apps for redistribution.
|
|
656
656
|
```
|
|
657
657
|
|
|
658
|
-
_See code: [src/commands/app/pack.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
658
|
+
_See code: [src/commands/app/pack.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/pack.js)_
|
|
659
659
|
|
|
660
660
|
## `aio app run`
|
|
661
661
|
|
|
@@ -679,7 +679,7 @@ DESCRIPTION
|
|
|
679
679
|
Run an Adobe I/O App
|
|
680
680
|
```
|
|
681
681
|
|
|
682
|
-
_See code: [src/commands/app/run.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
682
|
+
_See code: [src/commands/app/run.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/run.js)_
|
|
683
683
|
|
|
684
684
|
## `aio app test`
|
|
685
685
|
|
|
@@ -707,7 +707,7 @@ DESCRIPTION
|
|
|
707
707
|
If the extension has a hook called 'test' in its 'ext.config.yaml', the script specified will be run instead.
|
|
708
708
|
```
|
|
709
709
|
|
|
710
|
-
_See code: [src/commands/app/test.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
710
|
+
_See code: [src/commands/app/test.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/test.js)_
|
|
711
711
|
|
|
712
712
|
## `aio app undeploy`
|
|
713
713
|
|
|
@@ -732,7 +732,7 @@ DESCRIPTION
|
|
|
732
732
|
Undeploys an Adobe I/O App
|
|
733
733
|
```
|
|
734
734
|
|
|
735
|
-
_See code: [src/commands/app/undeploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
735
|
+
_See code: [src/commands/app/undeploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/undeploy.js)_
|
|
736
736
|
|
|
737
737
|
## `aio app use [CONFIG_FILE_PATH]`
|
|
738
738
|
|
|
@@ -779,5 +779,5 @@ DESCRIPTION
|
|
|
779
779
|
page in https://developer.adobe.com/console/
|
|
780
780
|
```
|
|
781
781
|
|
|
782
|
-
_See code: [src/commands/app/use.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.
|
|
782
|
+
_See code: [src/commands/app/use.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.3.0/src/commands/app/use.js)_
|
|
783
783
|
<!-- commandsstop -->
|
package/oclif.manifest.json
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"type": "boolean"
|
|
46
46
|
},
|
|
47
47
|
"force-build": {
|
|
48
|
-
"description": "[default:
|
|
48
|
+
"description": "[default: true] Force a build even if one already exists",
|
|
49
49
|
"name": "force-build",
|
|
50
50
|
"allowNo": true,
|
|
51
51
|
"type": "boolean"
|
|
@@ -2171,5 +2171,5 @@
|
|
|
2171
2171
|
]
|
|
2172
2172
|
}
|
|
2173
2173
|
},
|
|
2174
|
-
"version": "13.
|
|
2174
|
+
"version": "13.3.0"
|
|
2175
2175
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/aio-cli-plugin-app",
|
|
3
3
|
"description": "Create, Build and Deploy Adobe I/O Applications",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.3.0",
|
|
5
5
|
"author": "Adobe Inc.",
|
|
6
6
|
"bugs": "https://github.com/adobe/aio-cli-plugin-app/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@adobe/aio-lib-core-networking": "^5",
|
|
13
13
|
"@adobe/aio-lib-env": "^3",
|
|
14
14
|
"@adobe/aio-lib-ims": "^7",
|
|
15
|
-
"@adobe/aio-lib-runtime": "^7.0
|
|
15
|
+
"@adobe/aio-lib-runtime": "^7.1.0",
|
|
16
16
|
"@adobe/aio-lib-templates": "^3",
|
|
17
17
|
"@adobe/aio-lib-web": "^7",
|
|
18
18
|
"@adobe/generator-aio-app": "^7",
|
|
@@ -167,8 +167,8 @@ Build.flags = {
|
|
|
167
167
|
allowNo: true
|
|
168
168
|
}),
|
|
169
169
|
'force-build': Flags.boolean({
|
|
170
|
-
description: '[default:
|
|
171
|
-
default:
|
|
170
|
+
description: '[default: true] Force a build even if one already exists',
|
|
171
|
+
default: true,
|
|
172
172
|
allowNo: true
|
|
173
173
|
}),
|
|
174
174
|
'content-hash': Flags.boolean({
|
|
@@ -12,10 +12,16 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
const BaseCommand = require('../../../../BaseCommand')
|
|
13
13
|
const LogForwarding = require('../../../../lib/log-forwarding')
|
|
14
14
|
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:lf:set', { provider: 'debug' })
|
|
15
|
+
const { setRuntimeApiHostAndAuthHandler } = require('../../../../lib/auth-helper')
|
|
15
16
|
|
|
16
17
|
class LogForwardingCommand extends BaseCommand {
|
|
17
18
|
async run () {
|
|
18
|
-
|
|
19
|
+
let aioConfig = (await this.getFullConfig()).aio
|
|
20
|
+
// TODO: remove this check once the deploy service is enabled by default
|
|
21
|
+
if (process.env.IS_DEPLOY_SERVICE_ENABLED === 'true') {
|
|
22
|
+
aioConfig = setRuntimeApiHostAndAuthHandler(aioConfig)
|
|
23
|
+
}
|
|
24
|
+
const lf = await LogForwarding.init(aioConfig)
|
|
19
25
|
|
|
20
26
|
const destination = await this.promptDestination(lf.getSupportedDestinations())
|
|
21
27
|
const destinationSettingsConfig = lf.getSettingsConfig(destination)
|
|
@@ -22,6 +22,7 @@ const { runInProcess, buildExtensionPointPayloadWoMetadata, buildExcShellViewExt
|
|
|
22
22
|
const rtLib = require('@adobe/aio-lib-runtime')
|
|
23
23
|
const LogForwarding = require('../../lib/log-forwarding')
|
|
24
24
|
const { sendAuditLogs, getAuditLogEvent, getFilesCountWithExtension } = require('../../lib/audit-logger')
|
|
25
|
+
const { setRuntimeApiHostAndAuthHandler } = require('../../lib/auth-helper')
|
|
25
26
|
const logActions = require('../../lib/log-actions')
|
|
26
27
|
|
|
27
28
|
const PRE_DEPLOY_EVENT_REG = 'pre-deploy-event-reg'
|
|
@@ -100,7 +101,8 @@ class Deploy extends BuildCommand {
|
|
|
100
101
|
// - break into smaller pieces deploy, allowing to first deploy all actions then all web assets
|
|
101
102
|
for (let i = 0; i < keys.length; ++i) {
|
|
102
103
|
const k = keys[i]
|
|
103
|
-
const v = values[i]
|
|
104
|
+
const v = setRuntimeApiHostAndAuthHandler(values[i])
|
|
105
|
+
|
|
104
106
|
await this.deploySingleConfig(k, v, flags, spinner)
|
|
105
107
|
if (v.app.hasFrontend && flags['web-assets']) {
|
|
106
108
|
const opItems = getFilesCountWithExtension(v.web.distProd)
|
|
@@ -111,7 +113,10 @@ class Deploy extends BuildCommand {
|
|
|
111
113
|
// only send logs in case of web-assets deployment
|
|
112
114
|
await sendAuditLogs(cliDetails.accessToken, assetDeployedLogEvent, cliDetails.env)
|
|
113
115
|
} catch (error) {
|
|
114
|
-
|
|
116
|
+
if (flags.verbose) {
|
|
117
|
+
this.warn('Error: Audit Log Service Error: Failed to send audit log event for deployment.')
|
|
118
|
+
this.warn(error.message)
|
|
119
|
+
}
|
|
115
120
|
}
|
|
116
121
|
}
|
|
117
122
|
}
|
|
@@ -328,7 +333,7 @@ Deploy.flags = {
|
|
|
328
333
|
'force-build': Flags.boolean({
|
|
329
334
|
description: '[default: true] Force a build even if one already exists',
|
|
330
335
|
exclusive: ['no-build'], // no-build
|
|
331
|
-
default:
|
|
336
|
+
default: true,
|
|
332
337
|
allowNo: true
|
|
333
338
|
}),
|
|
334
339
|
'content-hash': Flags.boolean({
|
|
@@ -20,6 +20,7 @@ const webLib = require('@adobe/aio-lib-web')
|
|
|
20
20
|
const { runInProcess, buildExtensionPointPayloadWoMetadata, getCliInfo } = require('../../lib/app-helper')
|
|
21
21
|
const rtLib = require('@adobe/aio-lib-runtime')
|
|
22
22
|
const { sendAuditLogs, getAuditLogEvent } = require('../../lib/audit-logger')
|
|
23
|
+
const { setRuntimeApiHostAndAuthHandler } = require('../../lib/auth-helper')
|
|
23
24
|
|
|
24
25
|
class Undeploy extends BaseCommand {
|
|
25
26
|
async run () {
|
|
@@ -55,7 +56,9 @@ class Undeploy extends BaseCommand {
|
|
|
55
56
|
|
|
56
57
|
for (let i = 0; i < keys.length; ++i) {
|
|
57
58
|
const k = keys[i]
|
|
58
|
-
|
|
59
|
+
// TODO: remove this check once the deploy service is enabled by default
|
|
60
|
+
const v = process.env.IS_DEPLOY_SERVICE_ENABLED === 'true' ? setRuntimeApiHostAndAuthHandler(values[i]) : values[i]
|
|
61
|
+
|
|
59
62
|
await this.undeployOneExt(k, v, flags, spinner)
|
|
60
63
|
const assetUndeployLogEvent = getAuditLogEvent(flags, aioConfig.project, 'AB_APP_ASSETS_UNDEPLOYED')
|
|
61
64
|
// send logs for case of web-assets undeployment
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
+
governing permissions and limitations under the License.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const { getToken, context } = require('@adobe/aio-lib-ims')
|
|
13
|
+
const { CLI } = require('@adobe/aio-lib-ims/src/context')
|
|
14
|
+
const { getCliEnv } = require('@adobe/aio-lib-env')
|
|
15
|
+
const defaultRuntimeUrl = 'https://adobeioruntime.net'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* For use with the openwhisk client js library to send a bearer token instead of basic
|
|
19
|
+
* auth to the openwhisk service. Set this to the auth_handler option when initializing
|
|
20
|
+
*/
|
|
21
|
+
const bearerAuthHandler = {
|
|
22
|
+
getAuthHeader: async () => {
|
|
23
|
+
await context.setCli({ 'cli.bare-output': true }, false) // set this globally
|
|
24
|
+
|
|
25
|
+
const env = getCliEnv()
|
|
26
|
+
|
|
27
|
+
console.debug(`Retrieving CLI Token using env=${env}`)
|
|
28
|
+
const accessToken = await getToken(CLI)
|
|
29
|
+
|
|
30
|
+
return `Bearer ${accessToken}`
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const setRuntimeApiHostAndAuthHandler = (config) => {
|
|
35
|
+
// TODO: remove this check once the deploy service is enabled by default
|
|
36
|
+
if (process.env.IS_DEPLOY_SERVICE_ENABLED === 'true') {
|
|
37
|
+
const aioConfig = (config && 'runtime' in config) ? config : null
|
|
38
|
+
if (aioConfig) {
|
|
39
|
+
aioConfig.runtime.apihost = process.env.AIO_RUNTIME_APIHOST ?? defaultRuntimeUrl
|
|
40
|
+
aioConfig.runtime.auth_handler = bearerAuthHandler
|
|
41
|
+
return aioConfig
|
|
42
|
+
}
|
|
43
|
+
const owConfig = (config && 'ow' in config) ? config : null
|
|
44
|
+
if (owConfig) {
|
|
45
|
+
owConfig.ow.apihost = process.env.AIO_RUNTIME_APIHOST ?? defaultRuntimeUrl
|
|
46
|
+
owConfig.ow.auth_handler = bearerAuthHandler
|
|
47
|
+
return owConfig
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
if (config && config.runtime) {
|
|
51
|
+
config.runtime.apihost = process.env.AIO_RUNTIME_APIHOST ?? defaultRuntimeUrl
|
|
52
|
+
}
|
|
53
|
+
if (config && config.ow) {
|
|
54
|
+
config.ow.apihost = process.env.AIO_RUNTIME_APIHOST ?? defaultRuntimeUrl
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return config
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = {
|
|
61
|
+
bearerAuthHandler,
|
|
62
|
+
setRuntimeApiHostAndAuthHandler
|
|
63
|
+
}
|