@contentstack/cli 1.2.4 → 1.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/bin/run CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const oclif = require('@oclif/core');
3
+ const oclif = require('@oclif/core')
4
4
 
5
- oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'));
5
+ oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'))
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const cli_utilities_1 = require("@contentstack/cli-utilities");
4
+ const ContentstackManagementSDK = require("@contentstack/management");
4
5
  // TBD: run region command if region is not there
5
6
  async function default_1(opts) {
6
7
  const { context: { plugin: { config: { protectedCommands = {} } = {} } = {}, region = null } = {} } = this.config;
@@ -20,9 +21,10 @@ async function default_1(opts) {
20
21
  cli_utilities_1.cliux.error('Please login to execute the command');
21
22
  this.exit();
22
23
  }
24
+ const client = ContentstackManagementSDK.client({ host: region.cma, authtoken: authToken });
23
25
  try {
24
- const result = await cli_utilities_1.HttpClient.create().headers({ authtoken: authToken }).get(`${region.cma}/v3/user`);
25
- if (result.status !== 200) {
26
+ const result = await client.getUser();
27
+ if (!result) {
26
28
  cli_utilities_1.logger.error('error in auth validation');
27
29
  cli_utilities_1.cliux.error('Please login to execute the command');
28
30
  this.exit();
@@ -32,8 +34,7 @@ async function default_1(opts) {
32
34
  catch (error) {
33
35
  cli_utilities_1.logger.error('error in auth validation', error);
34
36
  cli_utilities_1.cliux.error('Please login to execute the command');
35
- this.exit();
36
- return;
37
+ process.exit();
37
38
  }
38
39
  }
39
40
  }
package/lib/index.js CHANGED
@@ -1,5 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.run = void 0;
4
- var core_1 = require("@oclif/core");
5
- Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
3
+ exports.default = '@oclif/core';
@@ -1 +1,4 @@
1
- {"version":"1.2.4","commands":{}}
1
+ {
2
+ "version": "1.3.0",
3
+ "commands": {}
4
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contentstack/cli",
3
3
  "description": "Command-line tool (CLI) to interact with Contentstack",
4
- "version": "1.2.4",
4
+ "version": "1.3.0",
5
5
  "author": "Contentstack",
6
6
  "bin": {
7
7
  "csdx": "./bin/run"
@@ -12,8 +12,8 @@
12
12
  "clean": "rm -rf ./lib && rm -rf tsconfig.build.tsbuildinfo",
13
13
  "compile": "tsc -b tsconfig.json",
14
14
  "postpack": "rm -f oclif.manifest.json",
15
- "prepack": "npm run build && oclif-dev manifest && oclif-dev readme",
16
- "version": "oclif-dev readme && git add README.md",
15
+ "prepack": "npm run build && oclif manifest && oclif readme",
16
+ "version": "oclif readme && git add README.md",
17
17
  "test:report": "tsc -p test && nyc --reporter=lcov --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
18
18
  "pretest": "tsc -p test",
19
19
  "test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
@@ -21,26 +21,24 @@
21
21
  "lint": "eslint src/**/*.ts"
22
22
  },
23
23
  "dependencies": {
24
- "@contentstack/cli-auth": "^1.0.4",
25
- "@contentstack/cli-cm-bootstrap": "^1.1.5",
26
- "@contentstack/cli-cm-bulk-publish": "^1.0.3",
27
- "@contentstack/cli-cm-clone": "^1.1.5",
28
- "@contentstack/cli-cm-export": "^1.2.2",
29
- "@contentstack/cli-cm-export-to-csv": "^1.0.3",
30
- "@contentstack/cli-cm-import": "^1.2.3",
31
- "@contentstack/cli-cm-migrate-rte": "^1.1.4",
32
- "@contentstack/cli-cm-seed": "^1.1.5",
33
- "@contentstack/cli-command": "^1.0.3",
34
- "@contentstack/cli-config": "^1.0.3",
35
- "@contentstack/cli-migration": "^1.0.3",
36
- "@contentstack/cli-utilities": "^1.0.4",
37
- "@contentstack/management": "^1.6.0",
38
- "@oclif/command": "^1.8.16",
39
- "@oclif/config": "^1.18.3",
40
- "@oclif/core": "^1.9.5",
41
- "@oclif/errors": "^1.3.3",
42
- "@oclif/plugin-not-found": "^2.3.1",
43
- "@oclif/plugin-plugins": "^2.1.0",
24
+ "@contentstack/cli-auth": "^1.1.0",
25
+ "@contentstack/cli-cm-bootstrap": "^1.2.0",
26
+ "@contentstack/cli-cm-bulk-publish": "^1.1.0",
27
+ "@contentstack/cli-cm-clone": "^1.2.0",
28
+ "@contentstack/cli-cm-export": "^1.3.0",
29
+ "@contentstack/cli-cm-export-to-csv": "^1.1.0",
30
+ "@contentstack/cli-cm-import": "^1.3.0",
31
+ "@contentstack/cli-cm-migrate-rte": "^1.2.0",
32
+ "@contentstack/cli-cm-seed": "^1.2.0",
33
+ "@contentstack/cli-command": "^1.1.0",
34
+ "@contentstack/cli-config": "^1.1.0",
35
+ "@contentstack/cli-migration": "^1.1.0",
36
+ "@contentstack/cli-utilities": "^1.1.0",
37
+ "@contentstack/management": "^1.6.1",
38
+ "@oclif/core": "^1.21.0",
39
+ "@oclif/plugin-help": "^5",
40
+ "@oclif/plugin-not-found": "^2.3.9",
41
+ "@oclif/plugin-plugins": "^2.1.7",
44
42
  "chalk": "^4.1.2",
45
43
  "debug": "^4.1.1",
46
44
  "figlet": "^1.5.2",
@@ -49,9 +47,9 @@
49
47
  "winston": "^3.7.2"
50
48
  },
51
49
  "devDependencies": {
52
- "@oclif/dev-cli": "^1.22.2",
53
- "@oclif/plugin-help": "^5.1.12",
54
- "@oclif/test": "^1.2.8",
50
+ "oclif": "^3.1.2",
51
+ "@oclif/dev-cli": "^1.26.10",
52
+ "@oclif/test": "^2.2.10",
55
53
  "@types/chai": "^4.2.18",
56
54
  "@types/inquirer": "^9.0.3",
57
55
  "@types/mkdirp": "^1.0.1",
@@ -69,7 +67,7 @@
69
67
  "nyc": "^15.1.0",
70
68
  "rimraf": "^2.7.1",
71
69
  "shelljs": "^0.8.4",
72
- "sinon": "^11.1.1",
70
+ "sinon": "^15.0.1",
73
71
  "tmp": "^0.2.1",
74
72
  "ts-node": "^10.9.1",
75
73
  "typescript": "^4.9.3"
@@ -91,6 +89,13 @@
91
89
  ],
92
90
  "license": "MIT",
93
91
  "oclif": {
92
+ "topicSeparator": ":",
93
+ "additionalHelpFlags": [
94
+ "-h"
95
+ ],
96
+ "additionalVersionFlags": [
97
+ "-v"
98
+ ],
94
99
  "topics": {
95
100
  "auth": {
96
101
  "description": "Perform authentication-related activities"
@@ -117,6 +122,7 @@
117
122
  "helpClass": "./lib/help.js",
118
123
  "bin": "csdx",
119
124
  "plugins": [
125
+ "@oclif/plugin-help",
120
126
  "@oclif/plugin-not-found",
121
127
  "@oclif/plugin-plugins",
122
128
  "@contentstack/cli-config",
@@ -143,4 +149,4 @@
143
149
  }
144
150
  },
145
151
  "repository": "https://github.com/contentstack/cli"
146
- }
152
+ }