@adobe/aio-cli-plugin-app-storage 1.0.0 → 1.0.2

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
@@ -43,7 +43,7 @@ DESCRIPTION
43
43
  Display help for aio.
44
44
  ```
45
45
 
46
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.8/src/commands/help.ts)_
46
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.10/src/commands/help.ts)_
47
47
  <!-- commandsstop -->
48
48
 
49
49
  ## Contributing
@@ -312,5 +312,5 @@
312
312
  ]
313
313
  }
314
314
  },
315
- "version": "1.0.0"
315
+ "version": "1.0.2"
316
316
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/aio-cli-plugin-app-storage",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "dependencies": {
5
5
  "@adobe/aio-lib-core-config": "^5",
6
6
  "@adobe/aio-lib-core-logging": "^3",
@@ -8,7 +8,8 @@
8
8
  "@inquirer/prompts": "^5",
9
9
  "@oclif/core": "^4",
10
10
  "@oclif/plugin-help": "^6",
11
- "chalk": "^5"
11
+ "chalk": "^5",
12
+ "semver": "^7.6.3"
12
13
  },
13
14
  "devDependencies": {
14
15
  "@adobe/eslint-config-aio-lib-config": "^4",
@@ -16,6 +17,7 @@
16
17
  "eslint": "^8",
17
18
  "execa": "^8",
18
19
  "jest": "^29",
20
+ "memfs": "^4.11.1",
19
21
  "oclif": "^4",
20
22
  "stdout-stderr": "^0.1.9"
21
23
  },
@@ -58,6 +60,7 @@
58
60
  },
59
61
  "jest": {
60
62
  "collectCoverage": true,
61
- "testEnvironment": "node"
63
+ "testEnvironment": "node",
64
+ "transform": {}
62
65
  }
63
66
  }
@@ -16,10 +16,13 @@ import AioLogger from '@adobe/aio-lib-core-logging'
16
16
 
17
17
  import { CONFIG_STATE_REGION } from './constants.js'
18
18
  import chalk from 'chalk'
19
+ import semver from 'semver'
19
20
 
20
21
  export class BaseCommand extends Command {
21
22
  async init () {
22
23
  await super.init()
24
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
25
+ const { readFile } = await import('fs/promises') // dynamic import to be able to mock fs, ESM and Jest are not friends
23
26
 
24
27
  // setup debug logger
25
28
  const command = this.constructor.name.toLowerCase() // hacky but convenient
@@ -36,6 +39,23 @@ export class BaseCommand extends Command {
36
39
  this.args = args
37
40
  this.debugLogger.debug(`${command} args=${JSON.stringify(this.args)} flags=${JSON.stringify(this.flags)}`)
38
41
 
42
+ // check application dependencies
43
+ let packageJson
44
+ try {
45
+ const file = await readFile('package.json')
46
+ packageJson = JSON.parse(file.toString())
47
+ } catch (e) {
48
+ this.debugLogger.debug('package.json not found, skipping dependency check')
49
+ }
50
+ if (packageJson) {
51
+ const aioLibStateVersion = packageJson.dependencies?.['@adobe/aio-lib-state']
52
+ const aioSdkVersion = packageJson.dependencies?.['@adobe/aio-sdk']
53
+ if ((aioLibStateVersion && semver.lt(semver.coerce(aioLibStateVersion), '4.0.0')) ||
54
+ (aioSdkVersion && semver.lt(semver.coerce(aioSdkVersion), '6.0.0'))) {
55
+ this.error('State commands are not available for legacy State, please migrate to the latest "@adobe/aio-lib-state" (or "@adobe/aio-sdk" >= 6.0.0).')
56
+ }
57
+ }
58
+
39
59
  // init state client
40
60
  const owOptions = {
41
61
  namespace: config.get('runtime.namespace'),