@contentstack/cli-cm-bootstrap 1.8.0 → 1.9.1
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 +1 -1
- package/lib/bootstrap/interactive.js +1 -2
- package/lib/bootstrap/utils.js +15 -13
- package/lib/config.js +6 -1
- package/oclif.manifest.json +1 -1
- package/package.json +3 -3
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.
|
|
18
|
+
@contentstack/cli-cm-bootstrap/1.9.1 linux-x64 node-v18.19.1
|
|
19
19
|
$ csdx --help [COMMAND]
|
|
20
20
|
USAGE
|
|
21
21
|
$ csdx COMMAND
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.continueBootstrapCommand = exports.inquireLivePreviewSupport = exports.inquireAppType = exports.inquireGithubAccessToken = exports.inquireCloneDirectory = exports.inquireApp = void 0;
|
|
4
|
-
const path = require("path");
|
|
5
4
|
const inquirer = require('inquirer');
|
|
6
5
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
7
6
|
const messages_1 = require("../messages");
|
|
@@ -55,7 +54,7 @@ async function inquireCloneDirectory() {
|
|
|
55
54
|
message: messages_1.default.parse('CLI_BOOTSTRAP_APP_COPY_SOURCE_CODE_DESTINATION_ENQUIRY'),
|
|
56
55
|
},
|
|
57
56
|
]);
|
|
58
|
-
selectedCustomPath =
|
|
57
|
+
selectedCustomPath = (0, cli_utilities_1.pathValidator)(selectedCustomPath.path);
|
|
59
58
|
return selectedCustomPath;
|
|
60
59
|
}
|
|
61
60
|
exports.inquireCloneDirectory = inquireCloneDirectory;
|
package/lib/bootstrap/utils.js
CHANGED
|
@@ -128,7 +128,7 @@ const envFileHandler = async (appConfigKey, environmentVariables, clonedDirector
|
|
|
128
128
|
case 'reactjs':
|
|
129
129
|
case 'reactjs-starter':
|
|
130
130
|
fileName = `.env.${environmentVariables.environment}.local`;
|
|
131
|
-
filePath = path.join(clonedDirectory, fileName);
|
|
131
|
+
filePath = (0, cli_utilities_1.pathValidator)(path.join(clonedDirectory, fileName));
|
|
132
132
|
content = `REACT_APP_CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nREACT_APP_CONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}${livePreviewEnabled
|
|
133
133
|
? `\nREACT_APP_CONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`}\nREACT_APP_CONTENTSTACK_PREVIEW_HOST=${previewHost}\nREACT_APP_CONTENTSTACK_APP_HOST=${appHost}\n`
|
|
134
134
|
: '\n'}\nREACT_APP_CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}\n${customHost ? '\nREACT_APP_CONTENTSTACK_API_HOST=' + customHost : ''}${!isUSRegion && !customHost ? '\nREACT_APP_CONTENTSTACK_REGION=' + region.name : ''}\nSKIP_PREFLIGHT_CHECK=true\nREACT_APP_CONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}`;
|
|
@@ -137,7 +137,7 @@ const envFileHandler = async (appConfigKey, environmentVariables, clonedDirector
|
|
|
137
137
|
case 'nextjs':
|
|
138
138
|
case 'nextjs-starter':
|
|
139
139
|
fileName = `.env.${environmentVariables.environment}.local`;
|
|
140
|
-
filePath = path.join(clonedDirectory, fileName);
|
|
140
|
+
filePath = (0, cli_utilities_1.pathValidator)(path.join(clonedDirectory, fileName));
|
|
141
141
|
content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\n${livePreviewEnabled
|
|
142
142
|
? `\nCONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\nCONTENTSTACK_APP_HOST=${appHost}\n`
|
|
143
143
|
: '\n'}CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}\nCONTENTSTACK_API_HOST=${customHost ? customHost : managementAPIHost}${!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}\nCONTENTSTACK_LIVE_EDIT_TAGS=false`;
|
|
@@ -146,32 +146,34 @@ const envFileHandler = async (appConfigKey, environmentVariables, clonedDirector
|
|
|
146
146
|
case 'gatsby':
|
|
147
147
|
case 'gatsby-starter':
|
|
148
148
|
fileName = `.env.${environmentVariables.environment}`;
|
|
149
|
-
filePath = path.join(clonedDirectory, fileName);
|
|
149
|
+
filePath = (0, cli_utilities_1.pathValidator)(path.join(clonedDirectory, fileName));
|
|
150
150
|
content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\n${livePreviewEnabled
|
|
151
|
-
? `\nCONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\nCONTENTSTACK_APP_HOST=${appHost}\n`
|
|
151
|
+
? `\nCONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\nCONTENTSTACK_APP_HOST=${appHost}\n`
|
|
152
|
+
: '\n'}\nCONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}\nCONTENTSTACK_API_HOST=${managementAPIHost}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}`;
|
|
152
153
|
result = await writeEnvFile(content, filePath);
|
|
153
154
|
break;
|
|
154
155
|
case 'angular':
|
|
155
156
|
content = `export const environment = { \n\tproduction:${environmentVariables.environment === 'production' ? true : false}, \n\tconfig : { \n\t\tapi_key: '${environmentVariables.api_key}', \n\t\tdelivery_token: '${environmentVariables.deliveryToken}',\n${livePreviewEnabled
|
|
156
157
|
? `\n\tpreivew_token:'${environmentVariables.preview_token || `''`}'\n\tpreview_host:'${previewHost}'\n\tapp_host:'${appHost}'\n`
|
|
157
158
|
: '\n'},\n\t\tenvironment: '${environmentVariables.environment}'${!isUSRegion && !customHost ? `,\n\t\tregion: '${region.name}'` : ''} \n\t } \n };`;
|
|
158
|
-
fileName =
|
|
159
|
-
filePath = path.join(clonedDirectory, 'src', 'environments', fileName);
|
|
159
|
+
fileName = `.env${environmentVariables.environment === 'production' ? '.prod' : ''}`;
|
|
160
|
+
filePath = (0, cli_utilities_1.pathValidator)(path.join(clonedDirectory, 'src', 'environments', fileName));
|
|
160
161
|
result = await writeEnvFile(content, filePath);
|
|
161
162
|
break;
|
|
162
163
|
case 'angular-starter':
|
|
163
|
-
content = `
|
|
164
|
-
? `\
|
|
165
|
-
: '\n'}
|
|
166
|
-
fileName =
|
|
167
|
-
filePath = path.join(clonedDirectory,
|
|
164
|
+
content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\n${livePreviewEnabled
|
|
165
|
+
? `\nCONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\nCONTENTSTACK_APP_HOST=${appHost}\n`
|
|
166
|
+
: '\n'}CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}\nCONTENTSTACK_API_HOST=${customHost ? customHost : managementAPIHost}${!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}\nCONTENTSTACK_LIVE_EDIT_TAGS=false`;
|
|
167
|
+
fileName = `.env${environmentVariables.environment === 'production' ? '.prod' : ''}`;
|
|
168
|
+
filePath = (0, cli_utilities_1.pathValidator)(path.join(clonedDirectory, fileName));
|
|
168
169
|
result = await writeEnvFile(content, filePath);
|
|
169
170
|
break;
|
|
170
171
|
case 'nuxtjs':
|
|
171
172
|
case 'nuxt-starter':
|
|
173
|
+
case 'nuxt3-starter':
|
|
172
174
|
case 'stencil-starter':
|
|
173
175
|
fileName = production ? '.env.production' : '.env';
|
|
174
|
-
filePath = path.join(clonedDirectory, fileName);
|
|
176
|
+
filePath = (0, cli_utilities_1.pathValidator)(path.join(clonedDirectory, fileName));
|
|
175
177
|
// Note: Stencil app needs all the env variables, even if they are not having values otherwise the rollup does not work properly and throws process in undefined error.
|
|
176
178
|
content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\n${livePreviewEnabled
|
|
177
179
|
? `\nCONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`}\nCONTENTSTACK_PREVIEW_HOST=${customHost !== null && customHost !== void 0 ? customHost : previewHost}\nCONTENTSTACK_APP_HOST=${appHost}`
|
|
@@ -180,7 +182,7 @@ const envFileHandler = async (appConfigKey, environmentVariables, clonedDirector
|
|
|
180
182
|
break;
|
|
181
183
|
case 'vue-starter':
|
|
182
184
|
fileName = '.env';
|
|
183
|
-
filePath = path.join(clonedDirectory, fileName);
|
|
185
|
+
filePath = (0, cli_utilities_1.pathValidator)(path.join(clonedDirectory, fileName));
|
|
184
186
|
content = `VUE_APP_CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nVUE_APP_CONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\n${livePreviewEnabled
|
|
185
187
|
? `\nVUE_APP_CONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`}\nVUE_APP_CONTENTSTACK_PREVIEW_HOST=${previewHost}\nVUE_APP_CONTENTSTACK_APP_HOST=${appHost}\n`
|
|
186
188
|
: '\n'}\nVUE_APP_CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${customHost ? '\nVUE_APP_CONTENTSTACK_API_HOST=' + customHost : ''}${!isUSRegion && !customHost ? '\nVUE_APP_CONTENTSTACK_REGION=' + region.name : ''}\nVUE_APP_CONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}`;
|
package/lib/config.js
CHANGED
|
@@ -14,9 +14,10 @@ const config = {
|
|
|
14
14
|
{ displayName: 'Next JS', configKey: 'nextjs-starter' },
|
|
15
15
|
{ displayName: 'Gatsby', configKey: 'gatsby-starter' },
|
|
16
16
|
{ displayName: 'Angular', configKey: 'angular-starter' },
|
|
17
|
-
{ displayName: 'Nuxt JS', configKey: 'nuxt-starter' },
|
|
17
|
+
{ displayName: 'Nuxt JS (To be Deprecated)', configKey: 'nuxt-starter' },
|
|
18
18
|
{ displayName: 'Vue JS', configKey: 'vue-starter' },
|
|
19
19
|
{ displayName: 'Stencil', configKey: 'stencil-starter' },
|
|
20
|
+
{ displayName: 'Nuxt3', configKey: 'nuxt3-starter' },
|
|
20
21
|
],
|
|
21
22
|
appLevelConfig: {
|
|
22
23
|
nextjs: {
|
|
@@ -67,6 +68,10 @@ const config = {
|
|
|
67
68
|
source: 'contentstack/contentstack-stencil-starter-app',
|
|
68
69
|
stack: 'contentstack/stack-starter-app',
|
|
69
70
|
},
|
|
71
|
+
'nuxt3-starter': {
|
|
72
|
+
source: 'contentstack/contentstack-nuxt3-starter-app',
|
|
73
|
+
stack: 'contentstack/stack-starter-app',
|
|
74
|
+
},
|
|
70
75
|
},
|
|
71
76
|
};
|
|
72
77
|
exports.default = config;
|
package/oclif.manifest.json
CHANGED
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.
|
|
4
|
+
"version": "1.9.1",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"scripts": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@contentstack/cli-cm-seed": "~1.7.0",
|
|
21
21
|
"@contentstack/cli-command": "~1.2.16",
|
|
22
|
-
"@contentstack/cli-utilities": "~1.
|
|
22
|
+
"@contentstack/cli-utilities": "~1.6.0",
|
|
23
23
|
"inquirer": "8.2.4",
|
|
24
24
|
"mkdirp": "^1.0.4",
|
|
25
25
|
"tar": "^6.1.13"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"nyc": "^15.1.0",
|
|
40
40
|
"oclif": "^3.8.1",
|
|
41
41
|
"rimraf": "^2.7.1",
|
|
42
|
-
"tmp": "^0.2.
|
|
42
|
+
"tmp": "^0.2.2",
|
|
43
43
|
"ts-node": "^8.10.2",
|
|
44
44
|
"typescript": "^4.9.3"
|
|
45
45
|
},
|