Skip to content

Commit

Permalink
Merge pull request #1299 from contentstack/fix/CS-43755
Browse files Browse the repository at this point in the history
CS-43755- nuxt3 added, deperaction warning for nuxt, env file creation for angular app and version bump
  • Loading branch information
cs-raj authored Feb 20, 2024
2 parents f11bec2 + deaee27 commit 43e4768
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 21 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/contentstack-bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-bootstrap",
"description": "Bootstrap contentstack apps",
"version": "1.8.0",
"version": "1.9.0",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"scripts": {
Expand Down
34 changes: 19 additions & 15 deletions packages/contentstack-bootstrap/src/bootstrap/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ const envFileHandler = async (
environmentVariables.deliveryToken
}\n${
livePreviewEnabled
? `\nCONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\nCONTENTSTACK_APP_HOST=${appHost}\n`: '\n'
? `\nCONTENTSTACK_PREVIEW_TOKEN=${
environmentVariables.preview_token || `''`
}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\nCONTENTSTACK_APP_HOST=${appHost}\n`
: '\n'
}\nCONTENTSTACK_ENVIRONMENT=${
environmentVariables.environment
}\nCONTENTSTACK_API_HOST=${managementAPIHost}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}`;
Expand All @@ -217,29 +220,31 @@ const envFileHandler = async (
},\n\t\tenvironment: '${environmentVariables.environment}'${
!isUSRegion && !customHost ? `,\n\t\tregion: '${region.name}'` : ''
} \n\t } \n };`;
fileName = `environment${environmentVariables.environment === 'production' ? '.prod.' : '.'}ts`;
fileName = `.env${environmentVariables.environment === 'production' ? '.prod' : ''}`;
filePath = path.join(clonedDirectory, 'src', 'environments', fileName);
result = await writeEnvFile(content, filePath);
break;
case 'angular-starter':
content = `export const environment = { \n\tproduction: true \n}; \nexport const Config = { \n\tapi_key: '${
environmentVariables.api_key
}', \n\tdelivery_token: '${environmentVariables.deliveryToken}',\n\t${
content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${
environmentVariables.deliveryToken
}\n${
livePreviewEnabled
? `\npreview_token:'${environmentVariables.preview_token || ''}',\npreview_host:'${previewHost
}',\napp_host:'${appHost}'`
? `\nCONTENTSTACK_PREVIEW_TOKEN=${
environmentVariables.preview_token || `''`
}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\nCONTENTSTACK_APP_HOST=${appHost}\n`
: '\n'
},\n\tenvironment: '${environmentVariables.environment}'${
!isUSRegion && !customHost ? `,\n\tregion: '${region.name}'` : ''
},\n\tapi_host: '${
}CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}\nCONTENTSTACK_API_HOST=${
customHost ? customHost : managementAPIHost
}',\n\tlive_preview: ${livePreviewEnabled}\n};`;
fileName = `environment${environmentVariables.environment === 'production' ? '.prod.' : '.'}ts`;
filePath = path.join(clonedDirectory, 'src', 'environments', fileName);
}${
!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''
}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}\nCONTENTSTACK_LIVE_EDIT_TAGS=false`;
fileName = `.env${environmentVariables.environment === 'production' ? '.prod' : ''}`;
filePath = path.join(clonedDirectory, fileName);
result = await writeEnvFile(content, filePath);
break;
case 'nuxtjs':
case 'nuxt-starter':
case 'nuxt3-starter':
case 'stencil-starter':
fileName = production ? '.env.production' : '.env';
filePath = path.join(clonedDirectory, fileName);
Expand Down Expand Up @@ -268,8 +273,7 @@ const envFileHandler = async (
livePreviewEnabled
? `\nVUE_APP_CONTENTSTACK_PREVIEW_TOKEN=${
environmentVariables.preview_token || `''`
}\nVUE_APP_CONTENTSTACK_PREVIEW_HOST=${previewHost
}\nVUE_APP_CONTENTSTACK_APP_HOST=${appHost}\n`
}\nVUE_APP_CONTENTSTACK_PREVIEW_HOST=${previewHost}\nVUE_APP_CONTENTSTACK_APP_HOST=${appHost}\n`
: '\n'
}\nVUE_APP_CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${
customHost ? '\nVUE_APP_CONTENTSTACK_API_HOST=' + customHost : ''
Expand Down
7 changes: 6 additions & 1 deletion packages/contentstack-bootstrap/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ const config: Configuration = {
{ displayName: 'Next JS', configKey: 'nextjs-starter' },
{ displayName: 'Gatsby', configKey: 'gatsby-starter' },
{ displayName: 'Angular', configKey: 'angular-starter' },
{ displayName: 'Nuxt JS', configKey: 'nuxt-starter' },
{ displayName: 'Nuxt JS (To be Deprecated)', configKey: 'nuxt-starter' },
{ displayName: 'Vue JS', configKey: 'vue-starter' },
{ displayName: 'Stencil', configKey: 'stencil-starter' },
{ displayName: 'Nuxt3', configKey: 'nuxt3-starter' },
],
appLevelConfig: {
nextjs: {
Expand Down Expand Up @@ -78,6 +79,10 @@ const config: Configuration = {
source: 'contentstack/contentstack-stencil-starter-app',
stack: 'contentstack/stack-starter-app',
},
'nuxt3-starter': {
source: 'contentstack/contentstack-nuxt3-starter-app',
stack: 'contentstack/stack-starter-app',
},
},
};
export default config;
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dependencies": {
"@contentstack/cli-audit": "~1.4.0",
"@contentstack/cli-auth": "~1.3.17",
"@contentstack/cli-cm-bootstrap": "~1.8.0",
"@contentstack/cli-cm-bootstrap": "~1.9.0",
"@contentstack/cli-cm-branches": "~1.0.22",
"@contentstack/cli-cm-bulk-publish": "~1.4.0",
"@contentstack/cli-cm-export": "~1.10.5",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 43e4768

Please sign in to comment.