@contentstack/cli-cm-bootstrap 2.0.0-beta.10 → 2.0.0-beta.12
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 +4 -4
- package/lib/bootstrap/github/client.d.ts +0 -1
- package/lib/bootstrap/index.d.ts +1 -1
- package/lib/bootstrap/index.js +1 -1
- package/lib/bootstrap/interactive.js +18 -20
- package/lib/bootstrap/utils.js +6 -5
- package/lib/commands/cm/bootstrap.js +3 -3
- package/lib/config.js +1 -2
- package/oclif.manifest.json +3 -4
- package/package.json +11 -11
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/2.0.0-beta.
|
|
18
|
+
@contentstack/cli-cm-bootstrap/2.0.0-beta.12 linux-x64 node-v22.22.1
|
|
19
19
|
$ csdx --help [COMMAND]
|
|
20
20
|
USAGE
|
|
21
21
|
$ csdx COMMAND
|
|
@@ -44,14 +44,14 @@ Bootstrap contentstack apps
|
|
|
44
44
|
|
|
45
45
|
```
|
|
46
46
|
USAGE
|
|
47
|
-
$ csdx cm:bootstrap [--app-name <value>] [--project-dir <value>] [-k <value> | --org <value> | -n <value>] [-y
|
|
48
|
-
|
|
47
|
+
$ csdx cm:bootstrap [--app-name <value>] [--project-dir <value>] [-k <value> | --org <value> | -n <value>] [-y]
|
|
48
|
+
[--run-dev-server] [-a <value>]
|
|
49
49
|
|
|
50
50
|
FLAGS
|
|
51
51
|
-a, --alias=<value> Alias of the management token
|
|
52
52
|
-k, --stack-api-key=<value> Provide stack API key to seed content
|
|
53
53
|
-n, --stack-name=<value> Name of the new stack that will be created.
|
|
54
|
-
-y, --yes
|
|
54
|
+
-y, --yes [Optional] Skip stack confirmation
|
|
55
55
|
--app-name=<value> App name, kickstart-next, kickstart-next-ssr, kickstart-next-ssg, kickstart-next-graphql,
|
|
56
56
|
kickstart-next-middleware, kickstart-nuxt, kickstart-nuxt-ssr
|
|
57
57
|
--org=<value> Provide organization UID to create a new stack
|
package/lib/bootstrap/index.d.ts
CHANGED
package/lib/bootstrap/index.js
CHANGED
|
@@ -60,7 +60,7 @@ class Bootstrap {
|
|
|
60
60
|
cmd.push('-n', this.options.seedParams.stackName);
|
|
61
61
|
}
|
|
62
62
|
if (this.options.seedParams.yes) {
|
|
63
|
-
cmd.push('-y'
|
|
63
|
+
cmd.push('-y');
|
|
64
64
|
}
|
|
65
65
|
if (this.options.seedParams.managementTokenAlias) {
|
|
66
66
|
cmd.push('--alias', this.options.seedParams.managementTokenAlias);
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.inquireApp = inquireApp;
|
|
4
|
+
exports.inquireCloneDirectory = inquireCloneDirectory;
|
|
5
|
+
exports.inquireGithubAccessToken = inquireGithubAccessToken;
|
|
6
|
+
exports.inquireAppType = inquireAppType;
|
|
7
|
+
exports.inquireLivePreviewSupport = inquireLivePreviewSupport;
|
|
8
|
+
exports.inquireRunDevServer = inquireRunDevServer;
|
|
9
|
+
exports.continueBootstrapCommand = continueBootstrapCommand;
|
|
10
|
+
const inquirer_1 = require("inquirer");
|
|
5
11
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
6
12
|
const messages_1 = require("../messages");
|
|
7
13
|
/**
|
|
@@ -22,14 +28,13 @@ async function inquireApp(apps) {
|
|
|
22
28
|
choices: [...appsPreview, 'Exit'],
|
|
23
29
|
},
|
|
24
30
|
];
|
|
25
|
-
const selectedApp = await
|
|
31
|
+
const selectedApp = await inquirer_1.default.prompt(actions);
|
|
26
32
|
if (selectedApp.app === 'Exit') {
|
|
27
33
|
cli_utilities_1.cliux.print('Exiting...');
|
|
28
34
|
throw new Error('Exit');
|
|
29
35
|
}
|
|
30
36
|
return selectedApp.app;
|
|
31
37
|
}
|
|
32
|
-
exports.inquireApp = inquireApp;
|
|
33
38
|
/**
|
|
34
39
|
* @description Inquire clone destination directory
|
|
35
40
|
*/
|
|
@@ -42,25 +47,23 @@ async function inquireCloneDirectory() {
|
|
|
42
47
|
choices: ['Current Folder', 'Other'],
|
|
43
48
|
},
|
|
44
49
|
];
|
|
45
|
-
const selectedPath = await
|
|
50
|
+
const selectedPath = await inquirer_1.default.prompt(actions);
|
|
46
51
|
if (selectedPath.path === 'Current Folder') {
|
|
47
52
|
return process.cwd();
|
|
48
53
|
}
|
|
49
54
|
// Ask for the custom path
|
|
50
|
-
|
|
55
|
+
const selectedCustomPath = await inquirer_1.default.prompt([
|
|
51
56
|
{
|
|
52
|
-
type: '
|
|
57
|
+
type: 'input',
|
|
53
58
|
name: 'path',
|
|
54
59
|
message: messages_1.default.parse('CLI_BOOTSTRAP_APP_COPY_SOURCE_CODE_DESTINATION_ENQUIRY'),
|
|
55
60
|
},
|
|
56
61
|
]);
|
|
57
|
-
|
|
58
|
-
return selectedCustomPath;
|
|
62
|
+
return (0, cli_utilities_1.pathValidator)(selectedCustomPath.path);
|
|
59
63
|
}
|
|
60
|
-
exports.inquireCloneDirectory = inquireCloneDirectory;
|
|
61
64
|
async function inquireGithubAccessToken() {
|
|
62
65
|
// Ask for the access token
|
|
63
|
-
const accessToken = await
|
|
66
|
+
const accessToken = await inquirer_1.default.prompt([
|
|
64
67
|
{
|
|
65
68
|
type: 'string',
|
|
66
69
|
name: 'token',
|
|
@@ -69,7 +72,6 @@ async function inquireGithubAccessToken() {
|
|
|
69
72
|
]);
|
|
70
73
|
return accessToken.token;
|
|
71
74
|
}
|
|
72
|
-
exports.inquireGithubAccessToken = inquireGithubAccessToken;
|
|
73
75
|
async function inquireAppType() {
|
|
74
76
|
const actions = [
|
|
75
77
|
{
|
|
@@ -82,21 +84,19 @@ async function inquireAppType() {
|
|
|
82
84
|
],
|
|
83
85
|
},
|
|
84
86
|
];
|
|
85
|
-
const appType = await
|
|
87
|
+
const appType = await inquirer_1.default.prompt(actions);
|
|
86
88
|
return appType.type;
|
|
87
89
|
}
|
|
88
|
-
exports.inquireAppType = inquireAppType;
|
|
89
90
|
async function inquireLivePreviewSupport() {
|
|
90
|
-
const { livePreviewEnabled } = await
|
|
91
|
+
const { livePreviewEnabled } = await inquirer_1.default.prompt({
|
|
91
92
|
type: 'confirm',
|
|
92
93
|
name: 'livePreviewEnabled',
|
|
93
94
|
message: 'Enable live preview?',
|
|
94
95
|
});
|
|
95
96
|
return livePreviewEnabled;
|
|
96
97
|
}
|
|
97
|
-
exports.inquireLivePreviewSupport = inquireLivePreviewSupport;
|
|
98
98
|
async function inquireRunDevServer() {
|
|
99
|
-
const { runDevServer } = await
|
|
99
|
+
const { runDevServer } = await inquirer_1.default.prompt({
|
|
100
100
|
type: 'confirm',
|
|
101
101
|
name: 'runDevServer',
|
|
102
102
|
message: messages_1.default.parse('CLI_BOOTSTRAP_RUN_DEV_SERVER_ENQUIRY'),
|
|
@@ -104,9 +104,8 @@ async function inquireRunDevServer() {
|
|
|
104
104
|
});
|
|
105
105
|
return runDevServer;
|
|
106
106
|
}
|
|
107
|
-
exports.inquireRunDevServer = inquireRunDevServer;
|
|
108
107
|
async function continueBootstrapCommand() {
|
|
109
|
-
const { shouldContinue } = await
|
|
108
|
+
const { shouldContinue } = await inquirer_1.default.prompt({
|
|
110
109
|
type: 'list',
|
|
111
110
|
name: 'shouldContinue',
|
|
112
111
|
message: `To continue with the Bootstrap command without Live Preview, please select Yes.`,
|
|
@@ -115,4 +114,3 @@ async function continueBootstrapCommand() {
|
|
|
115
114
|
});
|
|
116
115
|
return shouldContinue;
|
|
117
116
|
}
|
|
118
|
-
exports.continueBootstrapCommand = continueBootstrapCommand;
|
package/lib/bootstrap/utils.js
CHANGED
|
@@ -25,11 +25,11 @@ const setupEnvironments = async (managementAPIClient, api_key, appConfig, cloned
|
|
|
25
25
|
if (!managementToken) {
|
|
26
26
|
const managementBody = {
|
|
27
27
|
token: {
|
|
28
|
-
name: '
|
|
29
|
-
description: 'This is a
|
|
28
|
+
name: 'Compass Starter App',
|
|
29
|
+
description: 'This is a compass starter app management token.',
|
|
30
30
|
scope: [
|
|
31
31
|
{
|
|
32
|
-
module: '
|
|
32
|
+
module: '$all',
|
|
33
33
|
acl: {
|
|
34
34
|
read: true,
|
|
35
35
|
write: true,
|
|
@@ -43,8 +43,9 @@ const setupEnvironments = async (managementAPIClient, api_key, appConfig, cloned
|
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
],
|
|
46
|
-
expires_on:
|
|
46
|
+
expires_on: null,
|
|
47
47
|
is_email_notification_enabled: false,
|
|
48
|
+
rate_limit_enabled: false,
|
|
48
49
|
},
|
|
49
50
|
};
|
|
50
51
|
managementTokenResult = await managementAPIClient
|
|
@@ -234,7 +235,7 @@ const envFileHandler = async (appConfigKey, environmentVariables, clonedDirector
|
|
|
234
235
|
filePath = (0, cli_utilities_1.pathValidator)(path.join((0, cli_utilities_1.sanitizePath)(clonedDirectory), (0, cli_utilities_1.sanitizePath)(fileName)));
|
|
235
236
|
content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\nCONTENTSTACK_BRANCH=main${livePreviewEnabled
|
|
236
237
|
? `\nCONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\n`
|
|
237
|
-
: '\n'}CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}\nCONTENTSTACK_LIVE_EDIT_TAGS=false\nCONTENTSTACK_API_HOST=${customHost ? customHost : managementAPIHost}${!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''}\nCONTENTSTACK_APP_HOST=${appHost}\nCONTENTSTACK_MANAGEMENT_TOKEN=${managementTokenResult.
|
|
238
|
+
: '\n'}CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}\nCONTENTSTACK_LIVE_EDIT_TAGS=false\nCONTENTSTACK_API_HOST=${customHost ? customHost : managementAPIHost}${!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''}\nCONTENTSTACK_APP_HOST=${appHost}\nCONTENTSTACK_MANAGEMENT_TOKEN=${managementTokenResult.token}\nCONTENTSTACK_HOST=${cdnHost}`;
|
|
238
239
|
result = await writeEnvFile(content, filePath);
|
|
239
240
|
break;
|
|
240
241
|
case 'gatsby':
|
|
@@ -67,7 +67,7 @@ class BootstrapCommand extends cli_command_1.Command {
|
|
|
67
67
|
if (stackName)
|
|
68
68
|
seedParams.stackName = stackName;
|
|
69
69
|
if (yes)
|
|
70
|
-
seedParams.yes =
|
|
70
|
+
seedParams.yes = true;
|
|
71
71
|
if (managementTokenAlias) {
|
|
72
72
|
seedParams.managementTokenAlias = managementTokenAlias;
|
|
73
73
|
const listOfTokens = cli_utilities_1.configHandler.get('tokens');
|
|
@@ -94,7 +94,6 @@ class BootstrapCommand extends cli_command_1.Command {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
exports.default = BootstrapCommand;
|
|
98
97
|
BootstrapCommand.description = 'Bootstrap contentstack apps';
|
|
99
98
|
BootstrapCommand.examples = [
|
|
100
99
|
'$ csdx cm:bootstrap',
|
|
@@ -141,7 +140,7 @@ BootstrapCommand.flags = {
|
|
|
141
140
|
required: false,
|
|
142
141
|
exclusive: ['stack-api-key'],
|
|
143
142
|
}),
|
|
144
|
-
yes: cli_utilities_1.flags.
|
|
143
|
+
yes: cli_utilities_1.flags.boolean({
|
|
145
144
|
description: '[Optional] Skip stack confirmation',
|
|
146
145
|
char: 'y',
|
|
147
146
|
required: false,
|
|
@@ -156,3 +155,4 @@ BootstrapCommand.flags = {
|
|
|
156
155
|
description: 'Alias of the management token',
|
|
157
156
|
}),
|
|
158
157
|
};
|
|
158
|
+
exports.default = BootstrapCommand;
|
package/lib/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAppLevelConfigByName =
|
|
3
|
+
exports.getAppLevelConfigByName = getAppLevelConfigByName;
|
|
4
4
|
const messages_1 = require("./messages");
|
|
5
5
|
const config = {
|
|
6
6
|
sampleApps: [
|
|
@@ -123,4 +123,3 @@ function getAppLevelConfigByName(appConfigKey) {
|
|
|
123
123
|
config.appLevelConfig[appConfigKey].appConfigKey = appConfigKey;
|
|
124
124
|
return config.appLevelConfig[appConfigKey];
|
|
125
125
|
}
|
|
126
|
-
exports.getAppLevelConfigByName = getAppLevelConfigByName;
|
package/oclif.manifest.json
CHANGED
|
@@ -79,9 +79,8 @@
|
|
|
79
79
|
"description": "[Optional] Skip stack confirmation",
|
|
80
80
|
"name": "yes",
|
|
81
81
|
"required": false,
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"type": "option"
|
|
82
|
+
"allowNo": false,
|
|
83
|
+
"type": "boolean"
|
|
85
84
|
},
|
|
86
85
|
"run-dev-server": {
|
|
87
86
|
"description": "Automatically start the development server after setup",
|
|
@@ -115,5 +114,5 @@
|
|
|
115
114
|
]
|
|
116
115
|
}
|
|
117
116
|
},
|
|
118
|
-
"version": "2.0.0-beta.
|
|
117
|
+
"version": "2.0.0-beta.12"
|
|
119
118
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-bootstrap",
|
|
3
3
|
"description": "Bootstrap contentstack apps",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.12",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "
|
|
9
|
-
"clean": "rm -rf ./lib ./node_modules tsconfig.
|
|
8
|
+
"build": "pnpm compile && oclif manifest && oclif readme",
|
|
9
|
+
"clean": "rm -rf ./lib ./node_modules tsconfig.tsbuildinfo",
|
|
10
10
|
"compile": "tsc -b tsconfig.json",
|
|
11
11
|
"postpack": "rm -f oclif.manifest.json",
|
|
12
12
|
"prepack": "pnpm compile && oclif manifest && oclif readme",
|
|
@@ -16,21 +16,21 @@
|
|
|
16
16
|
"test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\""
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@contentstack/cli-cm-seed": "~2.0.0-beta.
|
|
20
|
-
"@contentstack/cli-command": "~2.0.0-beta",
|
|
21
|
-
"@contentstack/cli-utilities": "~2.0.0-beta.
|
|
22
|
-
"@contentstack/cli-config": "~2.0.0-beta.
|
|
19
|
+
"@contentstack/cli-cm-seed": "~2.0.0-beta.11",
|
|
20
|
+
"@contentstack/cli-command": "~2.0.0-beta.3",
|
|
21
|
+
"@contentstack/cli-utilities": "~2.0.0-beta.3",
|
|
22
|
+
"@contentstack/cli-config": "~2.0.0-beta.4",
|
|
23
23
|
"@oclif/core": "^4.3.0",
|
|
24
24
|
"@oclif/plugin-help": "^6.2.37",
|
|
25
|
-
"inquirer": "
|
|
25
|
+
"inquirer": "12.11.1",
|
|
26
26
|
"mkdirp": "^1.0.4",
|
|
27
|
-
"tar": "^7.5.
|
|
27
|
+
"tar": "^7.5.11"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@oclif/test": "^4.1.13",
|
|
31
31
|
"@types/inquirer": "^9.0.8",
|
|
32
32
|
"@types/mkdirp": "^1.0.2",
|
|
33
|
-
"@types/node": "^
|
|
33
|
+
"@types/node": "^18.11.9",
|
|
34
34
|
"@types/tar": "^6.1.13",
|
|
35
35
|
"chai": "^4.5.0",
|
|
36
36
|
"eslint": "^8.57.1",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"oclif": "^4.17.46",
|
|
42
42
|
"tmp": "^0.2.5",
|
|
43
43
|
"ts-node": "^8.10.2",
|
|
44
|
-
"typescript": "^
|
|
44
|
+
"typescript": "^5.9.3"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=14.0.0"
|