@adobe/aio-cli-plugin-app 10.0.4 → 10.1.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/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": "10.0.4",
4
+ "version": "10.1.0",
5
5
  "author": "Adobe Inc.",
6
6
  "bugs": "https://github.com/adobe/aio-cli-plugin-app/issues",
7
7
  "dependencies": {
@@ -15,7 +15,7 @@
15
15
  "@adobe/aio-lib-runtime": "^5.0.0",
16
16
  "@adobe/aio-lib-templates": "^2.2.0",
17
17
  "@adobe/aio-lib-web": "^6.0.1",
18
- "@adobe/generator-aio-app": "^4.0.0",
18
+ "@adobe/generator-aio-app": "^5.1.0",
19
19
  "@adobe/generator-app-common-lib": "^0.3.3",
20
20
  "@adobe/inquirer-table-checkbox": "^1.2.0",
21
21
  "@oclif/core": "^1.15.0",
@@ -48,7 +48,7 @@
48
48
  "devDependencies": {
49
49
  "@adobe/aio-lib-test-proxy": "^1.0.0",
50
50
  "@adobe/eslint-config-aio-lib-config": "^2.0.0",
51
- "@types/jest": "^28",
51
+ "@types/jest": "^29",
52
52
  "babel-runtime": "^6.26.0",
53
53
  "core-js": "^3",
54
54
  "eol": "^0.9.1",
@@ -95,7 +95,7 @@
95
95
  "prepack": "oclif manifest && oclif readme --no-aliases",
96
96
  "test": "npm run unit-tests && npm run lint",
97
97
  "unit-tests": "jest -c jest.config.js",
98
- "version": "oclif readme && git add README.md",
98
+ "version": "oclif readme --no-aliases && git add README.md",
99
99
  "update-openwhisk-runtimes": "node bin/openwhisk-standalone-config/get-runtimes.js > bin/openwhisk-standalone-config/runtimes.json"
100
100
  },
101
101
  "bin": {
@@ -150,6 +150,14 @@ class TemplatesCommand extends AddCommand {
150
150
  } = {}) {
151
151
  const spinner = ora()
152
152
 
153
+ if (templates.length <= 0) {
154
+ aioLogger.debug('installTemplates: standalone-app')
155
+ await this.config.runHook('telemetry', { data: 'installTemplates:standalone-app' })
156
+ } else {
157
+ aioLogger.debug(`installTemplates: ${templates}`)
158
+ await this.config.runHook('telemetry', { data: `installTemplates:${templates}` })
159
+ }
160
+
153
161
  // install the templates in sequence
154
162
  for (const template of templates) {
155
163
  spinner.info(`Installing template ${template}`)
@@ -37,7 +37,7 @@ class Deploy extends BuildCommand {
37
37
 
38
38
  // if there are no extensions, then set publish to false
39
39
  flags.publish = flags.publish && !isStandaloneApp
40
- let libConsoleCLI
40
+ let libConsoleCLI // <= this can be undefined later on, and it was not checked
41
41
  if (flags.publish) {
42
42
  // force login at beginning (if required)
43
43
  libConsoleCLI = await this.getLibConsoleCLI()
@@ -158,6 +158,11 @@ class Deploy extends BuildCommand {
158
158
  try {
159
159
  const script = await runScript(config.hooks['deploy-actions'])
160
160
  if (!script) {
161
+ await this.config.runHook('deploy-actions', {
162
+ appConfig: config,
163
+ filterEntities: filterActions || [],
164
+ isLocalDev: false
165
+ })
161
166
  deployedRuntimeEntities = await rtLib.deployActions(config, { filterEntities }, onProgress)
162
167
  }
163
168
 
@@ -104,8 +104,8 @@ class Run extends BaseCommand {
104
104
  spinner.info(chalk.dim(`${info}`))
105
105
  spinner.start()
106
106
  }
107
-
108
- const frontendUrl = await runDev(config, this.config.dataDir, runOptions, onProgress)
107
+ const inprocHook = this.config.runHook.bind(this.config)
108
+ const frontendUrl = await runDev(config, this.config.dataDir, runOptions, onProgress, inprocHook)
109
109
  try {
110
110
  await runScript(config.hooks['post-app-run'])
111
111
  } catch (err) {
@@ -61,10 +61,9 @@ module.exports = async (watcherOptions) => {
61
61
  * @param {Array<string>} filterActions add filters to deploy only specified OpenWhisk actions
62
62
  */
63
63
  async function buildAndDeploy (watcherOptions, filterActions) {
64
- const { config, isLocal, log } = watcherOptions
65
-
64
+ const { config, isLocal, log, inprocHook } = watcherOptions
66
65
  await buildActions(config, filterActions)
67
- await deployActions(config, isLocal, log, filterActions)
66
+ await deployActions(config, isLocal, log, filterActions, inprocHook)
68
67
  }
69
68
 
70
69
  /**
@@ -22,7 +22,7 @@ const { deployActions } = require('@adobe/aio-lib-runtime')
22
22
  * @param {boolean} filter true if a filter by built actions is desired.
23
23
  */
24
24
  /** @private */
25
- module.exports = async (config, isLocalDev = false, log = () => {}, filter = false) => {
25
+ module.exports = async (config, isLocalDev = false, log = () => {}, filter = false, inprocHook) => {
26
26
  utils.runScript(config.hooks['pre-app-deploy'])
27
27
  const script = await utils.runScript(config.hooks['deploy-actions'])
28
28
  if (!script) {
@@ -32,6 +32,14 @@ module.exports = async (config, isLocalDev = false, log = () => {}, filter = fal
32
32
  byBuiltActions: filter
33
33
  }
34
34
  }
35
+ if (inprocHook) {
36
+ const hookFilterEntities = Array.isArray(filter) ? filter : []
37
+ await inprocHook('deploy-actions', {
38
+ appConfig: config,
39
+ filterEntities: hookFilterEntities,
40
+ isLocalDev
41
+ })
42
+ }
35
43
  const entities = await deployActions(config, deployConfig, log)
36
44
  if (entities.actions) {
37
45
  const web = entities.actions.filter(utils.createWebExportFilter(true))
@@ -30,7 +30,7 @@ const { run: logPoller } = require('./log-poller')
30
30
  const getPort = require('get-port')
31
31
 
32
32
  /** @private */
33
- async function runDev (config, dataDir, options = {}, log = () => {}) {
33
+ async function runDev (config, dataDir, options = {}, log = () => {}, inprocHook) {
34
34
  /* parcel bundle options */
35
35
  const bundleOptions = {
36
36
  shouldDisableCache: true,
@@ -38,6 +38,7 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
38
38
  shouldOptimize: false,
39
39
  ...options.parcel
40
40
  }
41
+
41
42
  /* skip actions */
42
43
  const skipActions = !!options.skipActions
43
44
  /* fetch logs for actions option */
@@ -48,6 +49,7 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
48
49
  const withBackend = config.app.hasBackend && !skipActions
49
50
  const isLocal = options.isLocal // applies only for backend
50
51
  const portToUse = parseInt(process.env.PORT) || SERVER_DEFAULT_PORT
52
+
51
53
  const uiPort = await getPort({ port: portToUse })
52
54
  if (uiPort !== portToUse) {
53
55
  log(`Could not use port:${portToUse}, using port:${uiPort} instead`)
@@ -82,7 +84,7 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
82
84
  log('building actions..')
83
85
  await buildActions(devConfig, null, true /* force build */)
84
86
 
85
- const { cleanup: watcherCleanup } = await actionsWatcher({ config: devConfig, isLocal, log })
87
+ const { cleanup: watcherCleanup } = await actionsWatcher({ config: devConfig, isLocal, log, inprocHook })
86
88
  cleanup.add(() => watcherCleanup(), 'stopping action watcher...')
87
89
  }
88
90
 
@@ -121,7 +123,7 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
121
123
  // Deploy Phase - deploy actions
122
124
  if (withBackend) {
123
125
  log('redeploying actions..')
124
- await deployActions(devConfig, isLocal, log, true)
126
+ await deployActions(devConfig, isLocal, log, true, inprocHook)
125
127
  }
126
128
 
127
129
  // Deploy Phase - serve the web UI