Skip to content

Commit 81ca843

Browse files
Merge pull request #2376 from contentstack/development
staging PR
2 parents 6ea16cb + 26baf62 commit 81ca843

File tree

21 files changed

+886
-1038
lines changed

21 files changed

+886
-1038
lines changed

.talismanrc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
fileignoreconfig:
22
- filename: package-lock.json
3-
checksum: 20001b2b16e2ab8cc8a3ccc30cebb5093c5c63f58e5b5fe64889d260a8d4cc56
3+
checksum: 09bde87514151440d68bc6154984a984c536728e37d18173bab4fdb53827dadd
44
- filename: pnpm-lock.yaml
5-
checksum: c2982bbd478bd9aabcc12bc162d2a76e2635d70023674a677dea996a8671e9ab
5+
checksum: e81b8b629ff23df0cd27af8c055c9bb3718b68e388fd9ff5e3485ef37bfe794b
6+
- filename: packages/contentstack-bootstrap/src/bootstrap/utils.ts
7+
checksum: 6e6fb00bb11b03141e5ad27eeaa4af9718dc30520c3e73970bc208cc0ba2a7d2
68
version: '1.0'

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
Please refer to the Contentstack Command-line Interface release notes [here](https://www.contentstack.com/docs/developers/cli/cli-changelog).
44

5+
6+
7+
8+
#### Date: Feb-09-2025
9+
## cli
10+
- Refactor Endpoints Integration using Utils SDK in cli-cm-config v1.9.0
11+
## cli beta
12+
- Updated @contentstack/cli-cm-export from ~2.0.0-beta.6 to ~2.0.0-beta.7
13+
- Updated @contentstack/cli-cm-clone from ~2.0.0-beta.7 to ~2.0.0-beta.8
14+
515
## @contentstack/cli-cm-clone
616
### Version: 1.8.2
717
#### Date: June-30-2025

package-lock.json

Lines changed: 361 additions & 465 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/contentstack-audit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"chalk": "^4.1.2",
2727
"fast-csv": "^4.3.6",
2828
"fs-extra": "^11.3.0",
29-
"lodash": "^4.17.21",
29+
"lodash": "^4.17.23",
3030
"uuid": "^9.0.1",
3131
"winston": "^3.17.0"
3232
},

packages/contentstack-bootstrap/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-cm-bootstrap",
33
"description": "Bootstrap contentstack apps",
4-
"version": "1.18.2",
4+
"version": "1.18.3",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"scripts": {
@@ -18,6 +18,7 @@
1818
"dependencies": {
1919
"@contentstack/cli-cm-seed": "~1.14.2",
2020
"@contentstack/cli-command": "~1.7.2",
21+
"@contentstack/cli-config": "~1.19.0",
2122
"@contentstack/cli-utilities": "~1.17.1",
2223
"@oclif/core": "^4.3.0",
2324
"@oclif/plugin-help": "^6.2.28",

packages/contentstack-bootstrap/src/bootstrap/utils.ts

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { cliux, pathValidator, sanitizePath } from '@contentstack/cli-utilities'
44
import { continueBootstrapCommand } from '../bootstrap/interactive';
55
import { AppConfig } from '../config';
66
import messageHandler from '../messages';
7+
import { regions } from '@contentstack/cli-config/lib/utils/region-handler';
78

89
interface EnvironmentVariables {
910
api_key: string;
@@ -187,27 +188,59 @@ const envFileHandler = async (
187188
const cdnHost = region?.cda?.substring('8');
188189
const appHost = region?.uiHost?.substring(8);
189190
const isUSRegion = regionName === 'us' || regionName === 'na';
191+
192+
const isPredefinedRegion = region?.name && Object.keys(regions).some(
193+
key => key.toLowerCase() === region.name.toLowerCase()
194+
);
195+
190196
if (regionName !== 'eu' && !isUSRegion) {
191197
customHost = region?.cma?.substring(8);
192198
}
193-
let graphqlHost = "graphql.contentstack.com";
194-
if(regionName != 'na'){
195-
graphqlHost = `${regionName}-.graphql.contentstack.com`;
196-
}
197-
198199

199-
// Construct image hostname based on the actual host being used
200-
let imageHostname = '*-images.contentstack.com'; // default fallback
201-
if (region?.cda) {
200+
const getGraphqlHost = (): string => {
201+
if (!isPredefinedRegion) {
202+
return cdnHost.replace('-cdn.', '-graphql.');
203+
}
204+
const normalizedRegion = regionName?.toLowerCase();
205+
if (!normalizedRegion || normalizedRegion === 'na' || normalizedRegion === 'aws-na' || normalizedRegion === 'us') {
206+
return cdnHost.replace('cdn.', 'graphql.').replace('.io', '.com');
207+
}
208+
return cdnHost.replace('-cdn.', '-graphql.');
209+
};
210+
const graphqlHost = getGraphqlHost();
211+
212+
let imageHostname: string;
213+
if (isPredefinedRegion && region?.cda) {
202214
const baseHost = region.cda.replace(/^https?:\/\//, '').replace(/^[^.]+\./, '');
203215
imageHostname = `images.${baseHost}`;
216+
} else if (region?.cda) {
217+
const baseHost = region.cda.replace(/^https?:\/\//, '').replace(/^[^.]+\./, '');
218+
imageHostname = `*-images.${baseHost}`;
219+
} else {
220+
//default
221+
imageHostname = '*-images.contentstack.com';
204222
}
205223
const production = environmentVariables.environment === 'production' ? true : false;
206224
switch (appConfigKey) {
207225
case 'kickstart-next':
208226
case 'kickstart-next-ssr':
209227
case 'kickstart-next-ssg':
210228
case 'kickstart-next-middleware':
229+
fileName = `.env`;
230+
filePath = pathValidator(path.join(sanitizePath(clonedDirectory), sanitizePath(fileName)));
231+
content = `NEXT_PUBLIC_CONTENTSTACK_API_KEY=${environmentVariables.api_key
232+
}\nNEXT_PUBLIC_CONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken
233+
}\nNEXT_PUBLIC_CONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || ''
234+
}\nNEXT_PUBLIC_CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment
235+
}\nNEXT_PUBLIC_CONTENTSTACK_REGION=${regionName
236+
}\nNEXT_PUBLIC_CONTENTSTACK_PREVIEW=${livePreviewEnabled ? 'true' : 'false'
237+
}\nNEXT_PUBLIC_CONTENTSTACK_CONTENT_DELIVERY = ${cdnHost
238+
}\nNEXT_PUBLIC_CONTENTSTACK_CONTENT_APPLICATION = ${appHost
239+
}\nNEXT_PUBLIC_CONTENTSTACK_PREVIEW_HOST = ${previewHost
240+
}\nNEXT_PUBLIC_CONTENTSTACK_IMAGE_HOSTNAME=${imageHostname}`;
241+
242+
result = await writeEnvFile(content, filePath);
243+
break;
211244
case 'kickstart-next-graphql':
212245
fileName = `.env`;
213246
filePath = pathValidator(path.join(sanitizePath(clonedDirectory), sanitizePath(fileName)));

packages/contentstack-branches/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@contentstack/cli-utilities": "~1.17.1",
1212
"chalk": "^4.1.2",
1313
"just-diff": "^6.0.2",
14-
"lodash": "^4.17.21"
14+
"lodash": "^4.17.23"
1515
},
1616
"devDependencies": {
1717
"@contentstack/cli-dev-dependencies": "~1.3.0",

packages/contentstack-bulk-publish/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
22
"name": "@contentstack/cli-cm-bulk-publish",
33
"description": "Contentstack CLI plugin for bulk publish actions",
4-
"version": "1.10.6",
4+
"version": "1.10.7",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"dependencies": {
88
"@contentstack/cli-command": "~1.7.2",
9-
"@contentstack/cli-config": "~1.18.0",
9+
"@contentstack/cli-config": "~1.19.0",
1010
"@contentstack/cli-utilities": "~1.17.1",
1111
"@oclif/core": "^4.3.0",
1212
"@oclif/plugin-help": "^6.2.28",
1313
"chalk": "^4.1.2",
1414
"dotenv": "^16.5.0",
1515
"inquirer": "8.2.7",
16-
"lodash": "^4.17.21",
16+
"lodash": "^4.17.23",
1717
"winston": "^3.17.0"
1818
},
1919
"devDependencies": {

packages/contentstack-clone/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
77
"dependencies": {
88
"@colors/colors": "^1.6.0",
9-
"@contentstack/cli-cm-export": "~1.23.1",
9+
"@contentstack/cli-cm-export": "~1.23.2",
1010
"@contentstack/cli-cm-import": "~1.31.2",
1111
"@contentstack/cli-command": "~1.7.2",
1212
"@contentstack/cli-utilities": "~1.17.1",
1313
"@oclif/core": "^4.3.0",
1414
"@oclif/plugin-help": "^6.2.28",
1515
"chalk": "^4.1.2",
1616
"inquirer": "8.2.7",
17-
"lodash": "^4.17.21",
17+
"lodash": "^4.17.23",
1818
"merge": "^2.1.1",
1919
"ora": "^5.4.1",
2020
"prompt": "^1.3.0",

packages/contentstack-config/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-config",
33
"description": "Contentstack CLI plugin for configuration",
4-
"version": "1.18.0",
4+
"version": "1.19.0",
55
"author": "Contentstack",
66
"scripts": {
77
"build": "npm run clean && npm run compile",
@@ -22,10 +22,11 @@
2222
},
2323
"dependencies": {
2424
"@contentstack/cli-command": "~1.7.2",
25-
"@contentstack/cli-utilities": "~1.17.1",
25+
"@contentstack/cli-utilities": "~1.17.0",
26+
"@contentstack/utils": "~1.7.0",
2627
"@oclif/core": "^4.3.0",
2728
"@oclif/plugin-help": "^6.2.28",
28-
"lodash": "^4.17.21"
29+
"lodash": "^4.17.23"
2930
},
3031
"devDependencies": {
3132
"@oclif/test": "^4.1.13",
@@ -80,4 +81,4 @@
8081
}
8182
},
8283
"repository": "contentstack/cli"
83-
}
84+
}

0 commit comments

Comments
 (0)