@adobe/aio-cli-plugin-app 10.6.0 → 10.7.1

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 CHANGED
@@ -71,7 +71,7 @@ DESCRIPTION
71
71
  Create, run, test, and deploy Adobe I/O Apps
72
72
  ```
73
73
 
74
- _See code: [src/commands/app/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/index.ts)_
74
+ _See code: [src/commands/app/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/index.ts)_
75
75
 
76
76
  ## `aio app add`
77
77
 
@@ -89,7 +89,7 @@ DESCRIPTION
89
89
  Add a new component to an existing Adobe I/O App
90
90
  ```
91
91
 
92
- _See code: [src/commands/app/add/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/index.ts)_
92
+ _See code: [src/commands/app/add/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/add/index.ts)_
93
93
 
94
94
  ## `aio app add action`
95
95
 
@@ -114,7 +114,7 @@ ALIASES
114
114
  $ aio app add actions
115
115
  ```
116
116
 
117
- _See code: [src/commands/app/add/action.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/action.ts)_
117
+ _See code: [src/commands/app/add/action.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/add/action.ts)_
118
118
 
119
119
  ## `aio app add ci`
120
120
 
@@ -132,7 +132,7 @@ DESCRIPTION
132
132
  Add CI files
133
133
  ```
134
134
 
135
- _See code: [src/commands/app/add/ci.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/ci.ts)_
135
+ _See code: [src/commands/app/add/ci.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/add/ci.ts)_
136
136
 
137
137
  ## `aio app add event`
138
138
 
@@ -159,7 +159,7 @@ ALIASES
159
159
  $ aio app add events
160
160
  ```
161
161
 
162
- _See code: [src/commands/app/add/event.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/event.ts)_
162
+ _See code: [src/commands/app/add/event.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/add/event.ts)_
163
163
 
164
164
  ## `aio app add extension`
165
165
 
@@ -185,7 +185,7 @@ ALIASES
185
185
  $ aio app add extensions
186
186
  ```
187
187
 
188
- _See code: [src/commands/app/add/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/extension.ts)_
188
+ _See code: [src/commands/app/add/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/add/extension.ts)_
189
189
 
190
190
  ## `aio app add service`
191
191
 
@@ -209,7 +209,7 @@ ALIASES
209
209
  $ aio app add services
210
210
  ```
211
211
 
212
- _See code: [src/commands/app/add/service.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/service.ts)_
212
+ _See code: [src/commands/app/add/service.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/add/service.ts)_
213
213
 
214
214
  ## `aio app add web-assets`
215
215
 
@@ -230,7 +230,7 @@ DESCRIPTION
230
230
  Add web assets support
231
231
  ```
232
232
 
233
- _See code: [src/commands/app/add/web-assets.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/add/web-assets.ts)_
233
+ _See code: [src/commands/app/add/web-assets.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/add/web-assets.ts)_
234
234
 
235
235
  ## `aio app build`
236
236
 
@@ -259,7 +259,7 @@ DESCRIPTION
259
259
  This will always force a rebuild unless --no-force-build is set.
260
260
  ```
261
261
 
262
- _See code: [src/commands/app/build.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/build.ts)_
262
+ _See code: [src/commands/app/build.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/build.ts)_
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.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/create.ts)_
284
+ _See code: [src/commands/app/create.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/create.ts)_
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.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/index.ts)_
302
+ _See code: [src/commands/app/delete/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/delete/index.ts)_
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.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/action.ts)_
328
+ _See code: [src/commands/app/delete/action.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/delete/action.ts)_
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.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/ci.ts)_
347
+ _See code: [src/commands/app/delete/ci.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/delete/ci.ts)_
348
348
 
349
349
  ## `aio app delete event [EVENT-ACTION-NAME]`
350
350
 
@@ -370,7 +370,7 @@ ALIASES
370
370
  $ aio app delete events
371
371
  ```
372
372
 
373
- _See code: [src/commands/app/delete/event.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/event.ts)_
373
+ _See code: [src/commands/app/delete/event.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/delete/event.ts)_
374
374
 
375
375
  ## `aio app delete extension`
376
376
 
@@ -396,7 +396,7 @@ ALIASES
396
396
  $ aio app delete extensions
397
397
  ```
398
398
 
399
- _See code: [src/commands/app/delete/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/extension.ts)_
399
+ _See code: [src/commands/app/delete/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/delete/extension.ts)_
400
400
 
401
401
  ## `aio app delete service`
402
402
 
@@ -420,7 +420,7 @@ ALIASES
420
420
  $ aio app delete services
421
421
  ```
422
422
 
423
- _See code: [src/commands/app/delete/service.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/service.ts)_
423
+ _See code: [src/commands/app/delete/service.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/delete/service.ts)_
424
424
 
425
425
  ## `aio app delete web-assets`
426
426
 
@@ -439,7 +439,7 @@ DESCRIPTION
439
439
  Delete existing web assets
440
440
  ```
441
441
 
442
- _See code: [src/commands/app/delete/web-assets.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/delete/web-assets.ts)_
442
+ _See code: [src/commands/app/delete/web-assets.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/delete/web-assets.ts)_
443
443
 
444
444
  ## `aio app deploy`
445
445
 
@@ -479,7 +479,7 @@ DESCRIPTION
479
479
  This will always force a rebuild unless --no-force-build is set.
480
480
  ```
481
481
 
482
- _See code: [src/commands/app/deploy.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/deploy.ts)_
482
+ _See code: [src/commands/app/deploy.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/deploy.ts)_
483
483
 
484
484
  ## `aio app get-url [ACTION]`
485
485
 
@@ -502,7 +502,7 @@ DESCRIPTION
502
502
  Get action URLs
503
503
  ```
504
504
 
505
- _See code: [src/commands/app/get-url.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/get-url.ts)_
505
+ _See code: [src/commands/app/get-url.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/get-url.ts)_
506
506
 
507
507
  ## `aio app info`
508
508
 
@@ -524,7 +524,7 @@ DESCRIPTION
524
524
  Display settings/configuration in use by an Adobe I/O App
525
525
  ```
526
526
 
527
- _See code: [src/commands/app/info.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/info.ts)_
527
+ _See code: [src/commands/app/info.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/info.ts)_
528
528
 
529
529
  ## `aio app init [PATH]`
530
530
 
@@ -558,7 +558,7 @@ DESCRIPTION
558
558
  Create a new Adobe I/O App
559
559
  ```
560
560
 
561
- _See code: [src/commands/app/init.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/init.ts)_
561
+ _See code: [src/commands/app/init.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/init.ts)_
562
562
 
563
563
  ## `aio app list`
564
564
 
@@ -576,7 +576,7 @@ DESCRIPTION
576
576
  List components for Adobe I/O App
577
577
  ```
578
578
 
579
- _See code: [src/commands/app/list/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/list/index.ts)_
579
+ _See code: [src/commands/app/list/index.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/list/index.ts)_
580
580
 
581
581
  ## `aio app list extension`
582
582
 
@@ -601,7 +601,7 @@ ALIASES
601
601
  $ aio app list extensions
602
602
  ```
603
603
 
604
- _See code: [src/commands/app/list/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/list/extension.ts)_
604
+ _See code: [src/commands/app/list/extension.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/list/extension.ts)_
605
605
 
606
606
  ## `aio app logs`
607
607
 
@@ -625,7 +625,7 @@ DESCRIPTION
625
625
  Fetch logs for an Adobe I/O App
626
626
  ```
627
627
 
628
- _See code: [src/commands/app/logs.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/logs.ts)_
628
+ _See code: [src/commands/app/logs.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/logs.ts)_
629
629
 
630
630
  ## `aio app run`
631
631
 
@@ -648,7 +648,7 @@ DESCRIPTION
648
648
  Run an Adobe I/O App
649
649
  ```
650
650
 
651
- _See code: [src/commands/app/run.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/run.ts)_
651
+ _See code: [src/commands/app/run.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/run.ts)_
652
652
 
653
653
  ## `aio app test`
654
654
 
@@ -676,7 +676,7 @@ DESCRIPTION
676
676
  If the extension has a hook called 'test' in its 'ext.config.yaml', the script specified will be run instead.
677
677
  ```
678
678
 
679
- _See code: [src/commands/app/test.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/test.ts)_
679
+ _See code: [src/commands/app/test.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/test.ts)_
680
680
 
681
681
  ## `aio app undeploy`
682
682
 
@@ -701,7 +701,7 @@ DESCRIPTION
701
701
  Undeploys an Adobe I/O App
702
702
  ```
703
703
 
704
- _See code: [src/commands/app/undeploy.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/undeploy.ts)_
704
+ _See code: [src/commands/app/undeploy.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/undeploy.ts)_
705
705
 
706
706
  ## `aio app use [CONFIG_FILE_PATH]`
707
707
 
@@ -749,5 +749,5 @@ DESCRIPTION
749
749
  page in https://developer.adobe.com/console/
750
750
  ```
751
751
 
752
- _See code: [src/commands/app/use.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.6.0/src/commands/app/use.ts)_
752
+ _See code: [src/commands/app/use.ts](https://github.com/adobe/aio-cli-plugin-app/blob/10.7.1/src/commands/app/use.ts)_
753
753
  <!-- commandsstop -->
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "10.6.0",
2
+ "version": "10.7.1",
3
3
  "commands": {
4
4
  "app:build": {
5
5
  "id": "app:build",
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@adobe/aio-cli-plugin-app",
3
3
  "description": "Create, Build and Deploy Adobe I/O Applications",
4
- "version": "10.6.0",
4
+ "version": "10.7.1",
5
5
  "author": "Adobe Inc.",
6
6
  "bugs": "https://github.com/adobe/aio-cli-plugin-app/issues",
7
7
  "dependencies": {
8
8
  "@adobe/aio-cli-lib-app-config": "^1.1.0",
9
+ "@adobe/aio-cli-lib-app-config-next": "npm:@adobe/aio-cli-lib-app-config@^3.0.0",
9
10
  "@adobe/aio-cli-lib-console": "^4.1.0",
10
11
  "@adobe/aio-lib-core-config": "^4.0.0",
11
12
  "@adobe/aio-lib-core-logging": "^2.0.0",
@@ -212,8 +212,7 @@
212
212
  "redirect_uri": {
213
213
  "type": "array",
214
214
  "items": {
215
- "type": "string",
216
- "format": "uri"
215
+ "type": "string"
217
216
  }
218
217
  }
219
218
  },
@@ -230,8 +229,7 @@
230
229
  "redirect_uri": {
231
230
  "type": "array",
232
231
  "items": {
233
- "type": "string",
234
- "format": "uri"
232
+ "type": "string"
235
233
  }
236
234
  }
237
235
  },
@@ -19,7 +19,7 @@
19
19
  "type": "object",
20
20
  "properties": {
21
21
  "id": { "type": "string" },
22
- "version": { "type": "string" }
22
+ "version": { "type": "string", "pattern": "^[0-9]+.[0-9]+.[0-9]+$" }
23
23
  },
24
24
  "required": ["id", "version"]
25
25
  },
@@ -29,22 +29,6 @@
29
29
  "default": []
30
30
  },
31
31
  "meshConfig": {
32
- "type": "object",
33
- "properties": {
34
- "meshConfig": { "$ref": "#/definitions/meshConfigNested" },
35
- "meshId": {
36
- "type": "string"
37
- },
38
- "lastUpdatedBy": { "type": "object" },
39
- "lastUpdated": {
40
- "type": "string",
41
- "pattern": "(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2}(?:\\.\\d*)?)((-(\\d{2}):(\\d{2})|Z)?)"
42
- },
43
- "meshStatus": { "type": "string" }
44
- },
45
- "required": ["meshConfig", "meshId"]
46
- },
47
- "meshConfigNested": {
48
32
  "type": "object",
49
33
  "properties": {
50
34
  "sources": {
package/schema/index.js CHANGED
@@ -10,10 +10,9 @@ 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 { USER_CONFIG_FILE, DEPLOY_CONFIG_FILE, IMPORT_CONFIG_FILE } = require('../src/lib/defaults')
13
+ const { DEPLOY_CONFIG_FILE, IMPORT_CONFIG_FILE } = require('../src/lib/defaults')
14
14
 
15
15
  module.exports = {
16
16
  [IMPORT_CONFIG_FILE]: require('./config.schema.json'),
17
- [USER_CONFIG_FILE]: require('./app.config.yaml.schema.json'),
18
17
  [DEPLOY_CONFIG_FILE]: require('./deploy.yaml.schema.json')
19
18
  }
@@ -18,19 +18,19 @@ const fs = require('fs-extra')
18
18
  const execa = require('execa')
19
19
  const unzipper = require('unzipper')
20
20
  const { validateJsonWithSchema } = require('../../lib/install-helper')
21
- const { loadConfigFile, writeFile } = require('../../lib/import-helper')
22
- const { getObjectValue } = require('../../lib/app-helper')
23
21
  const jsYaml = require('js-yaml')
24
22
  const { USER_CONFIG_FILE, DEPLOY_CONFIG_FILE } = require('../../lib/defaults')
25
23
  const ora = require('ora')
26
24
  const chalk = require('chalk')
27
25
 
26
+ // eslint-disable-next-line node/no-missing-require
27
+ const libConfigNext = require('@adobe/aio-cli-lib-app-config-next')
28
+
28
29
  class InstallCommand extends BaseCommand {
29
30
  async run () {
30
31
  const { args, flags } = await this.parse(InstallCommand)
31
32
 
32
33
  this.preRelease()
33
- const appConfig = this.getFullConfig()
34
34
 
35
35
  aioLogger.debug(`flags: ${JSON.stringify(flags, null, 2)}`)
36
36
  aioLogger.debug(`args: ${JSON.stringify(args, null, 2)}`)
@@ -52,9 +52,8 @@ class InstallCommand extends BaseCommand {
52
52
  try {
53
53
  await this.validateZipDirectoryStructure(args.path)
54
54
  await this.unzipFile(args.path, outputPath)
55
- await this.addCodeDownloadAnnotation(outputPath, appConfig)
56
- await this.validateConfig(outputPath, USER_CONFIG_FILE)
57
- await this.validateConfig(outputPath, DEPLOY_CONFIG_FILE)
55
+ await this.validateAppConfig(outputPath, USER_CONFIG_FILE)
56
+ await this.validateDeployConfig(outputPath, DEPLOY_CONFIG_FILE)
58
57
  await this.npmInstall(flags.verbose)
59
58
  await this.runTests()
60
59
  this.spinner.succeed('Install done.')
@@ -111,7 +110,16 @@ class InstallCommand extends BaseCommand {
111
110
  .then(() => this.spinner.succeed(`Extracted app package to ${destFolderPath}`))
112
111
  }
113
112
 
114
- async validateConfig (outputPath, configFileName, configFilePath = path.join(outputPath, configFileName)) {
113
+ async validateAppConfig (outputPath, configFileName, configFilePath = path.join(outputPath, configFileName)) {
114
+ this.spinner.start(`Validating ${configFileName}...`)
115
+ aioLogger.debug(`validateConfig: ${configFileName} at ${configFilePath}`)
116
+ // first coalesce the app config (resolving $include files), then validate it
117
+ const config = (await libConfigNext.coalesce(configFilePath)).config
118
+ await libConfigNext.validate(config, { throws: true }) // throws on error
119
+ this.spinner.succeed(`Validated ${configFileName}`)
120
+ }
121
+
122
+ async validateDeployConfig (outputPath, configFileName, configFilePath = path.join(outputPath, configFileName)) {
115
123
  this.spinner.start(`Validating ${configFileName}...`)
116
124
  aioLogger.debug(`validateConfig: ${configFileName} at ${configFilePath}`)
117
125
 
@@ -143,67 +151,6 @@ class InstallCommand extends BaseCommand {
143
151
  }
144
152
  })
145
153
  }
146
-
147
- /**
148
- * An annotation called disable-download will be added to all actions in app.config.yaml
149
- * (and linked yaml configs for example in extensions). This value will be set to true.
150
- * The annotation will by default be false if not set.
151
- *
152
- * @param {object} outputPath the path to the app package
153
- * @param {object} appConfig the app's configuration file
154
- */
155
- async addCodeDownloadAnnotation (outputPath, appConfig) {
156
- this.spinner.start('Adding disable-download annotations...')
157
- // get each annotation key relative to the file it is defined in
158
- /// iterate only over extensions that have actions defined
159
- const fileToAnnotationKey = {}
160
- Object.entries(appConfig.all)
161
- .filter(([_, extConf]) => extConf.manifest?.full?.packages)
162
- .forEach(([ext, extConf]) => {
163
- Object.entries(extConf.manifest.full.packages)
164
- .filter(([pkg, pkgConf]) => pkgConf.actions)
165
- .forEach(([pkg, pkgConf]) => {
166
- Object.entries(pkgConf.actions).forEach(([action, actionConf]) => {
167
- const baseFullKey = ext === 'application'
168
- ? `application.runtimeManifest.packages.${pkg}.actions.${action}`
169
- : `extensions.${ext}.runtimeManifest.packages.${pkg}.actions.${action}`
170
-
171
- let index
172
- if (actionConf.annotations) {
173
- index = appConfig.includeIndex[`${baseFullKey}.annotations`]
174
- } else {
175
- // the annotation object is not defined, take the parent key
176
- index = appConfig.includeIndex[baseFullKey]
177
- }
178
- if (!fileToAnnotationKey[index.file]) {
179
- fileToAnnotationKey[index.file] = []
180
- }
181
- fileToAnnotationKey[index.file].push(index.key) // index.key is relative to the file
182
- })
183
- })
184
- })
185
-
186
- // rewrite config files
187
- for (const [file, keys] of Object.entries(fileToAnnotationKey)) {
188
- const configFilePath = path.join(outputPath, file)
189
- const { values } = loadConfigFile(configFilePath)
190
-
191
- keys.forEach(key => {
192
- const object = getObjectValue(values, key)
193
- if (key.endsWith('.annotations') || key === 'annotations') {
194
- // object is the annotations object
195
- object['disable-download'] = true
196
- } else {
197
- // annotation object is not defined, the object is the action object
198
- object.annotations = { 'disable-download': true }
199
- }
200
- })
201
-
202
- // write back the modified manifest to disk
203
- await writeFile(configFilePath, jsYaml.dump(values), { overwrite: true })
204
- }
205
- this.spinner.succeed('Added disable-download annotations')
206
- }
207
154
  }
208
155
 
209
156
  InstallCommand.hidden = true // hide from help for pre-release
@@ -17,10 +17,14 @@ const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-
17
17
  const archiver = require('archiver')
18
18
  const yaml = require('js-yaml')
19
19
  const execa = require('execa')
20
- const { writeFile } = require('../../lib/import-helper')
20
+ const { loadConfigFile, writeFile } = require('../../lib/import-helper')
21
+ const { getObjectValue } = require('../../lib/app-helper')
21
22
  const ora = require('ora')
22
23
  const chalk = require('chalk')
23
24
 
25
+ // eslint-disable-next-line node/no-missing-require
26
+ const libConfigNext = require('@adobe/aio-cli-lib-app-config-next')
27
+
24
28
  const DEFAULTS = {
25
29
  OUTPUT_ZIP_FILE: 'app.zip',
26
30
  ARTIFACTS_FOLDER: 'app-package',
@@ -36,7 +40,8 @@ class Pack extends BaseCommand {
36
40
  aioLogger.debug(`flags: ${JSON.stringify(flags, null, 2)}`)
37
41
  aioLogger.debug(`args: ${JSON.stringify(args, null, 2)}`)
38
42
 
39
- const appConfig = this.getFullConfig()
43
+ // this will also validate the app.config.yaml
44
+ const appConfig = await libConfigNext.load()
40
45
 
41
46
  // resolve to absolute path before any chdir
42
47
  const outputZipFile = path.resolve(flags.output)
@@ -69,6 +74,10 @@ class Pack extends BaseCommand {
69
74
  await this.createDeployYamlFile(appConfig)
70
75
  this.spinner.succeed('Created configuration files')
71
76
 
77
+ this.spinner.start('Adding code-download annotations...')
78
+ await this.addCodeDownloadAnnotation(appConfig)
79
+ this.spinner.succeed('Added code-download annotations')
80
+
72
81
  // doing this before zip so other things can be added to the zip
73
82
  await this.config.runHook('post-pack', { appConfig, artifactsFolder: DEFAULTS.ARTIFACTS_FOLDER })
74
83
 
@@ -123,6 +132,10 @@ class Pack extends BaseCommand {
123
132
  version: appConfig.packagejson.version
124
133
  }
125
134
 
135
+ if (!application.version.match(/^[0-9]+.[0-9]+.[0-9]+$/)) {
136
+ throw new Error('Application version format must be "X.Y.Z", where X, Y, and Z are non-negative integers.')
137
+ }
138
+
126
139
  let meshConfig
127
140
  // ACNA-2041
128
141
  // get the mesh config by running the `aio api-mesh:get` command (if available)
@@ -135,7 +148,7 @@ class Pack extends BaseCommand {
135
148
  const { stdout } = await execa('aio', ['api-mesh', 'get'], { cwd: process.cwd() })
136
149
  // until we get the --json flag, we parse the output
137
150
  const idx = stdout.indexOf('{')
138
- meshConfig = JSON.parse(stdout.substring(idx))
151
+ meshConfig = JSON.parse(stdout.substring(idx)).meshConfig
139
152
  aioLogger.debug(`api-mesh:get - ${JSON.stringify(meshConfig, null, 2)}`)
140
153
  this.spinner.succeed('Got api-mesh config')
141
154
  } catch (err) {
@@ -238,6 +251,64 @@ class Pack extends BaseCommand {
238
251
  .map(file => file.path)
239
252
  .filter(file => !filesToExclude.includes(file))
240
253
  }
254
+
255
+ /**
256
+ * An annotation called code-download will be added to all actions in app.config.yaml
257
+ * (and linked yaml configs for example in extensions). This value will be set to false.
258
+ * The annotation will by default be true if not set.
259
+ *
260
+ * @param {object} appConfig the app's configuration file
261
+ */
262
+ async addCodeDownloadAnnotation (appConfig) {
263
+ // get each annotation key relative to the file it is defined in
264
+ /// iterate only over extensions that have actions defined
265
+ const fileToAnnotationKey = {}
266
+ Object.entries(appConfig.all)
267
+ .filter(([_, extConf]) => extConf.manifest?.full?.packages)
268
+ .forEach(([ext, extConf]) => {
269
+ Object.entries(extConf.manifest.full.packages)
270
+ .filter(([pkg, pkgConf]) => pkgConf.actions)
271
+ .forEach(([pkg, pkgConf]) => {
272
+ Object.entries(pkgConf.actions).forEach(([action, actionConf]) => {
273
+ const baseFullKey = ext === 'application'
274
+ ? `application.runtimeManifest.packages.${pkg}.actions.${action}`
275
+ : `extensions.${ext}.runtimeManifest.packages.${pkg}.actions.${action}`
276
+
277
+ let index
278
+ if (actionConf.annotations) {
279
+ index = appConfig.includeIndex[`${baseFullKey}.annotations`]
280
+ } else {
281
+ // the annotation object is not defined, take the parent key
282
+ index = appConfig.includeIndex[baseFullKey]
283
+ }
284
+ if (!fileToAnnotationKey[index.file]) {
285
+ fileToAnnotationKey[index.file] = []
286
+ }
287
+ fileToAnnotationKey[index.file].push(index.key) // index.key is relative to the file
288
+ })
289
+ })
290
+ })
291
+
292
+ // rewrite config files
293
+ for (const [file, keys] of Object.entries(fileToAnnotationKey)) {
294
+ const configFilePath = path.join(DEFAULTS.ARTIFACTS_FOLDER, file)
295
+ const { values } = loadConfigFile(configFilePath)
296
+
297
+ keys.forEach(key => {
298
+ const object = getObjectValue(values, key)
299
+ if (key.endsWith('.annotations') || key === 'annotations') {
300
+ // object is the annotations object
301
+ object['code-download'] = false
302
+ } else {
303
+ // annotation object is not defined, the object is the action object
304
+ object.annotations = { 'code-download': false }
305
+ }
306
+ })
307
+
308
+ // write back the modified manifest to disk
309
+ await writeFile(configFilePath, yaml.dump(values), { overwrite: true })
310
+ }
311
+ }
241
312
  }
242
313
 
243
314
  Pack.hidden = true // hide from help for pre-release
@@ -1,157 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://adobe.io/schemas/app-builder/app.config.yaml.json/v1",
4
- "type": "object",
5
- "properties": {
6
- "application": { "$ref": "#/definitions/application" },
7
- "extensions": { "$ref": "#/definitions/extensions" }
8
- },
9
- "oneOf": [
10
- {
11
- "required": ["application"],
12
- "allOf": [
13
- { "not": { "required": ["extensions"] } }
14
- ]
15
- },
16
- {
17
- "required": ["extensions"],
18
- "allOf": [
19
- { "not": { "required": ["application"] } }
20
- ]
21
- }
22
- ],
23
- "definitions": {
24
- "application": {
25
- "type": "object",
26
- "properties": {
27
- "runtimeManifest": { "$ref": "#/definitions/runtimeManifest" },
28
- "actions": { "type": "string" },
29
- "unitTest": { "type": "string" },
30
- "e2eTest": { "type": "string" },
31
- "dist": { "type": "string" },
32
- "tvmurl": { "type": "string" },
33
- "awsaccesskeyid": { "type": "string" },
34
- "awssecretaccesskey": { "type": "string" },
35
- "s3bucket": { "type": "string" },
36
- "events": { "type": "object" },
37
- "hostname": { "type": "string" },
38
- "htmlcacheduration": { "type": "number" },
39
- "jscacheduration": { "type": "number" },
40
- "csscacheduration": { "type": "number" },
41
- "imagecacheduration": { "type": "number" },
42
- "hooks": { "$ref": "#/definitions/hooks" },
43
- "web": { "$ref": "#/definitions/web" }
44
- },
45
- "required": ["runtimeManifest"]
46
- },
47
- "extensions": {
48
- "type": "object",
49
- "patternProperties": {
50
- "^[A-Za-z0-9-_/\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff]{1,20}$": {
51
- "$ref": "#/definitions/extension"
52
- }
53
- },
54
- "additionalProperties": false
55
- },
56
- "extension": {
57
- "type": "object",
58
- "properties": {
59
- "$include": { "type": "string" }
60
- }
61
- },
62
- "web": {
63
- "anyOf": [
64
- {
65
- "type": "string"
66
- },
67
- {
68
- "type": "object",
69
- "properties": {
70
- "response-headers": { "type": "object" }
71
- }
72
- }
73
- ]
74
- },
75
- "runtimeManifest": {
76
- "type": "object",
77
- "properties": {
78
- "packages": { "$ref": "#/definitions/packages" }
79
- },
80
- "required": ["packages"]
81
- },
82
- "packages": {
83
- "type": "object",
84
- "patternProperties": {
85
- "^[A-Za-z0-9-_\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff]{1,20}$": {
86
- "$ref": "#/definitions/package"
87
- }
88
- },
89
- "additionalProperties": false
90
- },
91
- "package": {
92
- "type": "object",
93
- "properties": {
94
- "license": { "type": "string" },
95
- "actions": { "$ref": "#/definitions/actions" }
96
- }
97
- },
98
- "actions": {
99
- "type": "object",
100
- "patternProperties": {
101
- "^[A-Za-z0-9-_\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff]{1,20}$": {
102
- "$ref": "#/definitions/action"
103
- }
104
- },
105
- "additionalProperties": false
106
- },
107
- "action": {
108
- "type": "object",
109
- "properties": {
110
- "function": { "type": "string" },
111
- "web": { "type": "string" },
112
- "runtime": { "type": "string" },
113
- "inputs": { "$ref": "#/definitions/inputs" },
114
- "annotations": { "$ref": "#/definitions/annotations" }
115
- },
116
- "required": ["function", "runtime"]
117
- },
118
- "inputs": {
119
- "type": "object",
120
- "patternProperties": {
121
- "^[A-Za-z0-9-_\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff]{1,20}$": {
122
- "type": ["string", "boolean"]
123
- }
124
- },
125
- "additionalProperties": false
126
- },
127
- "annotations": {
128
- "type": "object",
129
- "patternProperties": {
130
- "^[A-Za-z0-9-_\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff]{1,20}$": {
131
- "type": ["string", "boolean"]
132
- }
133
- },
134
- "additionalProperties": false
135
- },
136
- "hooks": {
137
- "type": "object",
138
- "properties": {
139
- "pre-app-build": { "type": "string" },
140
- "post-app-build": { "type": "string" },
141
- "build-actions": { "type": "string" },
142
- "build-static": { "type": "string" },
143
- "pre-app-deploy": { "type": "string" },
144
- "post-app-deploy": { "type": "string" },
145
- "deploy-actions": { "type": "string" },
146
- "deploy-static": { "type": "string" },
147
- "pre-app-undeploy": { "type": "string" },
148
- "post-app-undeploy": { "type": "string" },
149
- "undeploy-actions": { "type": "string" },
150
- "undeploy-static": { "type": "string" },
151
- "pre-app-run": { "type": "string" },
152
- "post-app-run": { "type": "string" },
153
- "serve-static": { "type": "string" }
154
- }
155
- }
156
- }
157
- }