@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.
Files changed (41) hide show
  1. package/README.md +686 -256
  2. package/oclif.manifest.json +1 -1
  3. package/package.json +23 -27
  4. package/schema/config.schema.json +10 -1
  5. package/src/AddCommand.js +3 -3
  6. package/src/BaseCommand.js +13 -8
  7. package/src/commands/app/add/action.js +4 -4
  8. package/src/commands/app/add/ci.js +2 -2
  9. package/src/commands/app/add/event.js +4 -4
  10. package/src/commands/app/add/extension.js +4 -4
  11. package/src/commands/app/add/index.js +3 -3
  12. package/src/commands/app/add/service.js +3 -3
  13. package/src/commands/app/add/web-assets.js +4 -4
  14. package/src/commands/app/build.js +13 -13
  15. package/src/commands/app/config/get/index.js +3 -3
  16. package/src/commands/app/config/index.js +3 -3
  17. package/src/commands/app/config/set/index.js +3 -3
  18. package/src/commands/app/create.js +3 -3
  19. package/src/commands/app/delete/action.js +3 -3
  20. package/src/commands/app/delete/ci.js +3 -3
  21. package/src/commands/app/delete/event.js +3 -3
  22. package/src/commands/app/delete/extension.js +6 -6
  23. package/src/commands/app/delete/index.js +3 -3
  24. package/src/commands/app/delete/web-assets.js +3 -3
  25. package/src/commands/app/deploy.js +19 -21
  26. package/src/commands/app/get-url.js +20 -9
  27. package/src/commands/app/index.js +3 -3
  28. package/src/commands/app/info.js +7 -7
  29. package/src/commands/app/init.js +28 -9
  30. package/src/commands/app/list/extension-points.js +4 -4
  31. package/src/commands/app/list/extension.js +4 -4
  32. package/src/commands/app/list/index.js +3 -3
  33. package/src/commands/app/logs.js +20 -12
  34. package/src/commands/app/run.js +12 -11
  35. package/src/commands/app/test.js +7 -7
  36. package/src/commands/app/undeploy.js +10 -10
  37. package/src/commands/app/use.js +11 -11
  38. package/src/lib/build-actions.js +3 -2
  39. package/src/lib/deploy-actions.js +3 -3
  40. package/src/lib/run-dev.js +3 -4
  41. package/src/lib/run-local-runtime.js +22 -12
@@ -32,6 +32,12 @@ const OW_WAIT_INIT_TIME = 2000
32
32
  const OW_WAIT_PERIOD_TIME = 500
33
33
  const OW_TIMEOUT = 60000
34
34
 
35
+ const LOCAL_RUNTIME = {
36
+ namespace: OW_LOCAL_NAMESPACE,
37
+ auth: OW_LOCAL_AUTH,
38
+ apihost: OW_LOCAL_APIHOST
39
+ }
40
+
35
41
  /**
36
42
  * @typedef {object} RunDevLocalObject
37
43
  * @property {string} config the modified dev config
@@ -55,9 +61,8 @@ const OW_TIMEOUT = 60000
55
61
  * @returns {RunDevLocalObject} the RunDevLocalObject
56
62
  */
57
63
  async function runDevLocal (config, dataDir, log = () => undefined, verbose = false) {
58
- const devConfig = cloneDeep(config)
59
- devConfig.envFile = path.join(config.app.dist, '.env.local')
60
64
  const owJarFile = path.join(dataDir, OW_JAR_PATH)
65
+ const devConfig = loadLocalDevConfig(config)
61
66
 
62
67
  // take following steps only when we have a backend
63
68
  log('checking if java is installed...')
@@ -91,16 +96,8 @@ async function runDevLocal (config, dataDir, log = () => undefined, verbose = fa
91
96
  }
92
97
  const res = await utils.runOpenWhiskJar(owJarFile, OW_CONFIG_RUNTIMES_FILE, OW_LOCAL_APIHOST, OW_WAIT_INIT_TIME, OW_WAIT_PERIOD_TIME, OW_TIMEOUT, owExecaOptions)
93
98
 
94
- log('setting local openwhisk credentials...')
95
- const runtime = {
96
- namespace: OW_LOCAL_NAMESPACE,
97
- auth: OW_LOCAL_AUTH,
98
- apihost: OW_LOCAL_APIHOST
99
- }
100
- devConfig.ow = { ...devConfig.ow, ...runtime }
101
-
102
99
  log(`writing credentials to tmp wskdebug config '${devConfig.envFile}'`)
103
- await writeLocalEnvFile(devConfig, runtime)
100
+ await writeLocalEnvFile(devConfig, LOCAL_RUNTIME)
104
101
 
105
102
  const cleanup = () => {
106
103
  aioLogger.debug('stopping local OpenWhisk stack...')
@@ -118,6 +115,19 @@ async function runDevLocal (config, dataDir, log = () => undefined, verbose = fa
118
115
  }
119
116
  }
120
117
 
118
+ /**
119
+ * @param {object} config the app config
120
+ * @param {Function} [log] function to log application logs
121
+ * @returns {RunDevLocalObject} the RunDevLocalObject
122
+ */
123
+ function loadLocalDevConfig (config, log) {
124
+ const devConfig = cloneDeep(config)
125
+ devConfig.envFile = path.join(config.app.dist, '.env.local')
126
+ log && log('setting local openwhisk credentials...')
127
+ devConfig.ow = { ...devConfig.ow, ...LOCAL_RUNTIME }
128
+ return devConfig
129
+ }
130
+
121
131
  /**
122
132
  * Writes the local debugging .env file
123
133
  *
@@ -141,4 +151,4 @@ async function writeLocalEnvFile (appConfig, runtimeCredentials) {
141
151
  `))
142
152
  }
143
153
 
144
- module.exports = runDevLocal
154
+ module.exports = { runLocalRuntime: runDevLocal, loadLocalDevConfig }