@contentstack/cli-cm-bootstrap 1.2.0 → 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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Contentstack
3
+ Copyright (c) 2023 Contentstack
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -15,7 +15,7 @@ $ npm install -g @contentstack/cli-cm-bootstrap
15
15
  $ csdx COMMAND
16
16
  running command...
17
17
  $ csdx (--version)
18
- @contentstack/cli-cm-bootstrap/1.2.0 linux-x64 node-v16.19.0
18
+ @contentstack/cli-cm-bootstrap/1.3.0 linux-x64 node-v16.19.1
19
19
  $ csdx --help [COMMAND]
20
20
  USAGE
21
21
  $ csdx COMMAND
@@ -62,7 +62,7 @@ class Bootstrap {
62
62
  cmd.push('-y', this.options.seedParams.yes);
63
63
  }
64
64
  const result = await seed_1.default.run(cmd);
65
- if (result.api_key) {
65
+ if (result && result.api_key) {
66
66
  await (0, utils_1.setupEnvironments)(this.managementAPIClient, result.api_key, this.appConfig, this.cloneDirectory, this.region, this.options.livePreviewEnabled);
67
67
  }
68
68
  else {
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const cli_command_1 = require("@contentstack/cli-command");
4
4
  const path_1 = require("path");
5
- const ContentstackManagementSDK = require('@contentstack/management');
6
5
  const bootstrap_1 = require("../../bootstrap");
7
6
  const interactive_1 = require("../../bootstrap/interactive");
8
7
  const cli_utilities_1 = require("@contentstack/cli-utilities");
@@ -10,11 +9,11 @@ const config_1 = require("../../config");
10
9
  const messages_1 = require("../../messages");
11
10
  class BootstrapCommand extends cli_command_1.Command {
12
11
  get managementAPIClient() {
13
- this.bootstrapManagementAPIClient = ContentstackManagementSDK.client({
14
- host: this.cmaHost,
15
- authtoken: this.authToken,
16
- });
17
- return this.bootstrapManagementAPIClient;
12
+ return (async () => {
13
+ const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)({ host: this.cmaHost });
14
+ this.bootstrapManagementAPIClient = managementAPIClient;
15
+ return this.bootstrapManagementAPIClient;
16
+ })();
18
17
  }
19
18
  async run() {
20
19
  const { flags: bootstrapCommandFlags } = await this.parse(BootstrapCommand);
@@ -55,7 +54,7 @@ class BootstrapCommand extends cli_command_1.Command {
55
54
  cloneDirectory = await (0, interactive_1.inquireCloneDirectory)();
56
55
  }
57
56
  cloneDirectory = (0, path_1.resolve)(cloneDirectory);
58
- const livePreviewEnabled = await (0, interactive_1.inquireLivePreviewSupport)();
57
+ const livePreviewEnabled = (bootstrapCommandFlags.yes) ? true : await (0, interactive_1.inquireLivePreviewSupport)();
59
58
  const seedParams = {};
60
59
  const stackAPIKey = bootstrapCommandFlags['stack-api-key'];
61
60
  const org = bootstrapCommandFlags['org'];
@@ -73,7 +72,7 @@ class BootstrapCommand extends cli_command_1.Command {
73
72
  appConfig,
74
73
  seedParams,
75
74
  cloneDirectory,
76
- managementAPIClient: this.managementAPIClient,
75
+ managementAPIClient: await this.managementAPIClient,
77
76
  region: this.region,
78
77
  appType,
79
78
  livePreviewEnabled,
@@ -96,49 +95,49 @@ BootstrapCommand.examples = [
96
95
  '$ csdx cm:bootstrap --app-name "reactjs-starter" --project-dir <path/to/setup/the/app> --org "your-org-uid" --stack-name "stack-name"',
97
96
  ];
98
97
  BootstrapCommand.flags = {
99
- 'app-name': cli_command_1.flags.string({
98
+ 'app-name': cli_utilities_1.flags.string({
100
99
  description: 'App name, reactjs-starter, nextjs-starter, gatsby-starter, angular-starter, nuxt-starter, vue-starter, stencil-starter',
101
100
  multiple: false,
102
101
  required: false,
103
102
  }),
104
- 'project-dir': cli_command_1.flags.string({
103
+ 'project-dir': cli_utilities_1.flags.string({
105
104
  description: 'Directory to setup the project. If directory name has a space then provide the path as a string or escap the space using back slash eg: "../../test space" or ../../test\\ space',
106
105
  multiple: false,
107
106
  required: false,
108
107
  }),
109
- 'app-type': cli_command_1.flags.string({
108
+ 'app-type': cli_utilities_1.flags.string({
110
109
  description: 'Sample or Starter app',
111
110
  multiple: false,
112
111
  required: false,
113
112
  hidden: true,
114
113
  }),
115
- 'stack-api-key': cli_command_1.flags.string({
114
+ 'stack-api-key': cli_utilities_1.flags.string({
116
115
  char: 'k',
117
116
  description: 'Provide stack API key to seed content',
118
117
  multiple: false,
119
118
  required: false,
120
119
  exclusive: ['org', 'stack-name'],
121
120
  }),
122
- org: cli_command_1.flags.string({
121
+ org: cli_utilities_1.flags.string({
123
122
  description: 'Provide organization UID to create a new stack',
124
123
  multiple: false,
125
124
  required: false,
126
125
  exclusive: ['stack-api-key'],
127
126
  }),
128
- 'stack-name': cli_command_1.flags.string({
127
+ 'stack-name': cli_utilities_1.flags.string({
129
128
  char: 'n',
130
129
  description: 'Name of a new stack that will be created.',
131
130
  multiple: false,
132
131
  required: false,
133
132
  exclusive: ['stack-api-key'],
134
133
  }),
135
- yes: cli_command_1.flags.string({
134
+ yes: cli_utilities_1.flags.string({
136
135
  description: '[Optional] Skip stack confirmation',
137
136
  char: 'y',
138
137
  required: false,
139
138
  }),
140
139
  // To be deprecated
141
- appName: cli_command_1.flags.string({
140
+ appName: cli_utilities_1.flags.string({
142
141
  char: 'a',
143
142
  description: 'App name, reactjs-starter, nextjs-starter, gatsby-starter, angular-starter, nuxt-starter',
144
143
  multiple: false,
@@ -146,7 +145,7 @@ BootstrapCommand.flags = {
146
145
  hidden: true,
147
146
  parse: (0, cli_utilities_1.printFlagDeprecation)(['-a', '--appName'], ['--app-name']),
148
147
  }),
149
- directory: cli_command_1.flags.string({
148
+ directory: cli_utilities_1.flags.string({
150
149
  char: 'd',
151
150
  description: 'Directory to set up the project. If directory name has a space then provide the path as a string or escape the space using backslash eg: "../../test space" or ../../test\\ space',
152
151
  multiple: false,
@@ -154,7 +153,7 @@ BootstrapCommand.flags = {
154
153
  hidden: true,
155
154
  parse: (0, cli_utilities_1.printFlagDeprecation)(['-d', '--directory'], ['--project-dir']),
156
155
  }),
157
- appType: cli_command_1.flags.string({
156
+ appType: cli_utilities_1.flags.string({
158
157
  char: 's',
159
158
  description: 'Sample or Starter app',
160
159
  multiple: false,
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.0",
2
+ "version": "1.3.0",
3
3
  "commands": {
4
4
  "cm:bootstrap": {
5
5
  "id": "cm:bootstrap",
package/package.json CHANGED
@@ -1,51 +1,51 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-bootstrap",
3
3
  "description": "Bootstrap contentstack apps",
4
- "version": "1.2.0",
4
+ "version": "1.3.0",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "scripts": {
8
8
  "build": "npm run clean && npm run compile",
9
- "clean": "rm -rf ./lib && rm -rf tsconfig.build.tsbuildinfo",
9
+ "clean": "rm -rf ./lib ./node_modules tsconfig.build.tsbuildinfo",
10
10
  "compile": "tsc -b tsconfig.json",
11
11
  "postpack": "rm -f oclif.manifest.json",
12
12
  "posttest": "eslint . --ext .ts --config .eslintrc",
13
- "prepack": "npm run build && oclif manifest && oclif readme",
13
+ "prepack": "pnpm compile && oclif manifest && oclif readme",
14
14
  "version": "oclif readme && git add README.md",
15
15
  "test": "npm run build && npm run test:e2e",
16
16
  "test:e2e": "nyc mocha \"test/**/*.test.js\"",
17
17
  "test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\""
18
18
  },
19
19
  "dependencies": {
20
- "@contentstack/cli-cm-seed": "^1.2.0",
21
- "@contentstack/cli-command": "^1.1.0",
22
- "@contentstack/cli-utilities": "^1.1.0",
20
+ "@contentstack/cli-cm-seed": "^1.3.0",
21
+ "@contentstack/cli-command": "^1.2.0",
22
+ "@contentstack/cli-utilities": "^1.2.0",
23
23
  "@contentstack/management": "^1.6.1",
24
24
  "inquirer": "8.2.4",
25
25
  "mkdirp": "^1.0.4",
26
- "tar": "^6.0.5"
26
+ "tar": "^6.1.13"
27
27
  },
28
28
  "devDependencies": {
29
- "oclif": "^3.1.2",
30
29
  "@oclif/test": "^2.2.10",
31
30
  "@types/inquirer": "^9.0.3",
32
31
  "@types/mkdirp": "^1.0.1",
33
32
  "@types/node": "^14.14.32",
34
- "@types/tar": "^4.0.3",
33
+ "@types/tar": "^6.1.3",
35
34
  "chai": "^4.3.4",
36
35
  "eslint": "^8.18.0",
37
- "eslint-config-oclif": "^3.1.0",
36
+ "eslint-config-oclif": "^4.0.0",
38
37
  "eslint-config-oclif-typescript": "^0.1.0",
39
38
  "globby": "^10.0.2",
40
39
  "mocha": "^10.0.0",
41
40
  "nyc": "^15.1.0",
41
+ "oclif": "^3.1.2",
42
42
  "rimraf": "^2.7.1",
43
43
  "tmp": "^0.2.1",
44
44
  "ts-node": "^8.10.2",
45
45
  "typescript": "^4.9.3"
46
46
  },
47
47
  "engines": {
48
- "node": ">=8.0.0"
48
+ "node": ">=14.0.0"
49
49
  },
50
50
  "files": [
51
51
  "/lib",