@contentstack/cli-cm-bootstrap 1.0.7 → 1.0.8
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 +2 -2
- package/lib/bootstrap/index.js +1 -1
- package/lib/bootstrap/utils.js +2 -1
- package/lib/commands/cm/bootstrap.js +19 -12
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ $ npm install -g @contentstack/cli-cm-bootstrap
|
|
|
13
13
|
$ csdx COMMAND
|
|
14
14
|
running command...
|
|
15
15
|
$ csdx (-v|--version|version)
|
|
16
|
-
@contentstack/cli-cm-bootstrap/1.0.
|
|
16
|
+
@contentstack/cli-cm-bootstrap/1.0.8 linux-x64 node-v16.14.2
|
|
17
17
|
$ csdx --help [COMMAND]
|
|
18
18
|
USAGE
|
|
19
19
|
$ csdx COMMAND
|
|
@@ -57,5 +57,5 @@ EXAMPLES
|
|
|
57
57
|
$ csdx cm:bootstrap -t <github access token>
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
_See code: [src/commands/cm/bootstrap.ts](https://github.com/contentstack/cli/blob/v1.0.
|
|
60
|
+
_See code: [src/commands/cm/bootstrap.ts](https://github.com/contentstack/cli/blob/v1.0.8/src/commands/cm/bootstrap.ts)_
|
|
61
61
|
<!-- commandsstop -->
|
package/lib/bootstrap/index.js
CHANGED
|
@@ -50,7 +50,7 @@ class Bootstrap {
|
|
|
50
50
|
try {
|
|
51
51
|
const result = await seed_1.default.run(["-r", this.appConfig.stack]);
|
|
52
52
|
if (result.api_key) {
|
|
53
|
-
await utils_1.setupEnvironments(this.managementAPIClient, result.api_key, this.appConfig, this.cloneDirectory, this.region);
|
|
53
|
+
await (0, utils_1.setupEnvironments)(this.managementAPIClient, result.api_key, this.appConfig, this.cloneDirectory, this.region);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
56
|
throw new Error(messages_1.default.parse("CLI_BOOTSTRAP_NO_API_KEY_FOUND"));
|
package/lib/bootstrap/utils.js
CHANGED
|
@@ -11,7 +11,7 @@ const messages_1 = require("../messages");
|
|
|
11
11
|
* Create delivery token
|
|
12
12
|
* Create enviroment
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
const setupEnvironments = async (managementAPIClient, api_key, appConfig, clonedDirectory, region) => {
|
|
15
15
|
const environmentResult = await managementAPIClient.stack({ api_key }).environment().query().find();
|
|
16
16
|
if (Array.isArray(environmentResult.items) && environmentResult.items.length > 0) {
|
|
17
17
|
for (const environment of environmentResult.items) {
|
|
@@ -62,6 +62,7 @@ exports.setupEnvironments = async (managementAPIClient, api_key, appConfig, clon
|
|
|
62
62
|
cli_ux_1.default.error(messages_1.default.parse('CLI_BOOTSTRAP_APP_ENV_NOT_FOUND_FOR_THE_STACK'));
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
+
exports.setupEnvironments = setupEnvironments;
|
|
65
66
|
const writeEnvFile = (content, fileName) => {
|
|
66
67
|
if (!content || !fileName) {
|
|
67
68
|
return;
|
|
@@ -15,38 +15,45 @@ class BootstrapCommand extends cli_command_1.Command {
|
|
|
15
15
|
const bootstrapCommandFlags = this.parse(BootstrapCommand).flags;
|
|
16
16
|
try {
|
|
17
17
|
if (!this.authToken) {
|
|
18
|
-
this.error(messages_1.default.parse(
|
|
18
|
+
this.error(messages_1.default.parse("CLI_BOOTSTRAP_LOGIN_FAILED"), {
|
|
19
|
+
exit: 2,
|
|
20
|
+
suggestions: [
|
|
21
|
+
"https://www.contentstack.com/docs/developers/cli/authentication/",
|
|
22
|
+
],
|
|
23
|
+
});
|
|
19
24
|
}
|
|
20
25
|
// inquire user inputs
|
|
21
|
-
let appType = bootstrapCommandFlags.appType ||
|
|
26
|
+
let appType = bootstrapCommandFlags.appType || "starterapp";
|
|
22
27
|
if (!appType) {
|
|
23
|
-
appType = await interactive_1.inquireAppType();
|
|
28
|
+
appType = await (0, interactive_1.inquireAppType)();
|
|
24
29
|
}
|
|
25
30
|
const selectedAppName = bootstrapCommandFlags.appName;
|
|
26
31
|
let selectedApp;
|
|
27
32
|
if (!selectedAppName) {
|
|
28
|
-
if (appType ===
|
|
29
|
-
selectedApp = await interactive_1.inquireApp(config_1.default.sampleApps);
|
|
33
|
+
if (appType === "sampleapp") {
|
|
34
|
+
selectedApp = await (0, interactive_1.inquireApp)(config_1.default.sampleApps);
|
|
30
35
|
}
|
|
31
|
-
else if (appType ===
|
|
32
|
-
selectedApp = await interactive_1.inquireApp(config_1.default.starterApps);
|
|
36
|
+
else if (appType === "starterapp") {
|
|
37
|
+
selectedApp = await (0, interactive_1.inquireApp)(config_1.default.starterApps);
|
|
33
38
|
}
|
|
34
39
|
else {
|
|
35
|
-
this.error(
|
|
40
|
+
this.error("Invalid app type provided " + appType, { exit: 1 });
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
43
|
if (!selectedAppName && !selectedApp) {
|
|
39
|
-
this.error(messages_1.default.parse(
|
|
44
|
+
this.error(messages_1.default.parse("CLI_BOOTSTRAP_INVALID_APP_NAME"), {
|
|
45
|
+
exit: 1,
|
|
46
|
+
});
|
|
40
47
|
}
|
|
41
|
-
const appConfig = config_1.getAppLevelConfigByName(selectedAppName || selectedApp.configKey);
|
|
48
|
+
const appConfig = (0, config_1.getAppLevelConfigByName)(selectedAppName || selectedApp.configKey);
|
|
42
49
|
let cloneDirectory = bootstrapCommandFlags.directory;
|
|
43
50
|
if (!cloneDirectory) {
|
|
44
|
-
cloneDirectory = await interactive_1.inquireCloneDirectory();
|
|
51
|
+
cloneDirectory = await (0, interactive_1.inquireCloneDirectory)();
|
|
45
52
|
}
|
|
46
53
|
// Check the access token
|
|
47
54
|
let accessToken = bootstrapCommandFlags.accessToken;
|
|
48
55
|
if (appConfig.private && !accessToken) {
|
|
49
|
-
accessToken = await interactive_1.inquireGithubAccessToken();
|
|
56
|
+
accessToken = await (0, interactive_1.inquireGithubAccessToken)();
|
|
50
57
|
}
|
|
51
58
|
// initiate bootstrsourceap
|
|
52
59
|
const options = {
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.
|
|
1
|
+
{"version":"1.0.8","commands":{"cm:bootstrap":{"id":"cm:bootstrap","description":"Bootstrap contentstack apps","pluginName":"@contentstack/cli-cm-bootstrap","pluginType":"core","aliases":[],"examples":["$ csdx cm:bootstrap","$ csdx cm:bootstrap -d <path/to/setup/the/app>","$ csdx cm:bootstrap -t <github access token>"],"flags":{"appName":{"name":"appName","type":"option","char":"a","description":"App name, reactjs-starter, nextjs-starter, gatsby-starter, angular-starter, nuxt-starter","required":false},"directory":{"name":"directory","type":"option","char":"d","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","required":false},"accessToken":{"name":"accessToken","type":"option","char":"t","description":"Access token for private github repo","required":false},"appType":{"name":"appType","type":"option","char":"s","description":"Sample or Starter app","hidden":true,"required":false}},"args":[]}}}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-bootstrap",
|
|
3
3
|
"description": "Bootstrap contentstack apps",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.8",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"scripts": {
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\""
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@contentstack/cli-cm-seed": "^1.0.12",
|
|
20
21
|
"@contentstack/cli-command": "^0.1.1-beta.6",
|
|
21
|
-
"@contentstack/cli-cm-seed": "^1.0.11",
|
|
22
22
|
"@contentstack/management": "^1.3.0",
|
|
23
23
|
"@oclif/command": "^1.8.0",
|
|
24
24
|
"@oclif/config": "^1.17.0",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"eslint-config-oclif": "^3.1.0",
|
|
42
42
|
"eslint-config-oclif-typescript": "^0.1.0",
|
|
43
43
|
"globby": "^10.0.2",
|
|
44
|
-
"mocha": "^
|
|
44
|
+
"mocha": "^10.0.0",
|
|
45
45
|
"nyc": "^15.1.0",
|
|
46
46
|
"rimraf": "^2.7.1",
|
|
47
47
|
"tmp": "^0.2.1",
|
|
48
48
|
"ts-node": "^8.10.2",
|
|
49
|
-
"typescript": "^
|
|
49
|
+
"typescript": "^4.7.4"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=8.0.0"
|