Skip to content

Commit cc3e47e

Browse files
fix: remove deprecated sample and starter apps
1 parent 75da976 commit cc3e47e

4 files changed

Lines changed: 82 additions & 369 deletions

File tree

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

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ const envFileHandler = async (
221221
//default
222222
imageHostname = '*-images.contentstack.com';
223223
}
224-
const production = environmentVariables.environment === 'production' ? true : false;
225224
switch (appConfigKey) {
226225
case 'kickstart-next':
227226
case 'kickstart-next-ssr':
@@ -275,34 +274,6 @@ const envFileHandler = async (
275274
result = await writeEnvFile(content, filePath);
276275
break;
277276

278-
case 'reactjs':
279-
case 'reactjs-starter':
280-
fileName = `.env.${environmentVariables.environment}.local`;
281-
filePath = pathValidator(path.join(sanitizePath(clonedDirectory), sanitizePath(fileName)));
282-
content = `REACT_APP_CONTENTSTACK_API_KEY=${environmentVariables.api_key
283-
}\nREACT_APP_CONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}${livePreviewEnabled
284-
? `\nREACT_APP_CONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`
285-
}\nREACT_APP_CONTENTSTACK_PREVIEW_HOST=${previewHost}\nREACT_APP_CONTENTSTACK_APP_HOST=${appHost}\n`
286-
: '\n'
287-
}\nREACT_APP_CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}\n${customHost ? '\nREACT_APP_CONTENTSTACK_API_HOST=' + customHost : ''
288-
}${!isUSRegion && !customHost ? '\nREACT_APP_CONTENTSTACK_REGION=' + region.name : ''
289-
}\nSKIP_PREFLIGHT_CHECK=true\nREACT_APP_CONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}`;
290-
result = await writeEnvFile(content, filePath);
291-
break;
292-
case 'nextjs':
293-
case 'nextjs-starter':
294-
fileName = `.env.${environmentVariables.environment}.local`;
295-
filePath = pathValidator(path.join(sanitizePath(clonedDirectory), sanitizePath(fileName)));
296-
content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken
297-
}\n${livePreviewEnabled
298-
? `\nCONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`
299-
}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\nCONTENTSTACK_APP_HOST=${appHost}\n`
300-
: '\n'
301-
}CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}\nCONTENTSTACK_API_HOST=${customHost ? customHost : managementAPIHost
302-
}${!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''
303-
}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}\nCONTENTSTACK_LIVE_EDIT_TAGS=false`;
304-
result = await writeEnvFile(content, filePath);
305-
break;
306277
case 'compass-app':
307278
fileName = '.env';
308279
filePath = pathValidator(path.join(sanitizePath(clonedDirectory), sanitizePath(fileName)));
@@ -318,75 +289,6 @@ const envFileHandler = async (
318289
}\nCONTENTSTACK_HOST=${cdnHost}`;
319290
result = await writeEnvFile(content, filePath);
320291
break;
321-
case 'gatsby':
322-
case 'gatsby-starter':
323-
fileName = `.env.${environmentVariables.environment}`;
324-
filePath = pathValidator(path.join(sanitizePath(clonedDirectory), sanitizePath(fileName)));
325-
content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken
326-
}\n${livePreviewEnabled
327-
? `\nCONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`
328-
}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\nCONTENTSTACK_APP_HOST=${appHost}\n`
329-
: '\n'
330-
}\nCONTENTSTACK_ENVIRONMENT=${environmentVariables.environment
331-
}\nCONTENTSTACK_API_HOST=${managementAPIHost}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}`;
332-
result = await writeEnvFile(content, filePath);
333-
break;
334-
case 'angular':
335-
content = `export const environment = { \n\tproduction:${environmentVariables.environment === 'production' ? true : false
336-
}, \n\tconfig : { \n\t\tapi_key: '${environmentVariables.api_key}', \n\t\tdelivery_token: '${environmentVariables.deliveryToken
337-
}',\n${livePreviewEnabled
338-
? `\n\tpreivew_token:'${environmentVariables.preview_token || `''`
339-
}'\n\tpreview_host:'${previewHost}'\n\tapp_host:'${appHost}'\n`
340-
: '\n'
341-
},\n\t\tenvironment: '${environmentVariables.environment}'${!isUSRegion && !customHost ? `,\n\t\tregion: '${region.name}'` : ''
342-
} \n\t } \n };`;
343-
fileName = `.env${environmentVariables.environment === 'production' ? '.prod' : ''}`;
344-
filePath = pathValidator(path.join(sanitizePath(clonedDirectory), 'src', 'environments', sanitizePath(fileName)));
345-
result = await writeEnvFile(content, filePath);
346-
break;
347-
case 'angular-starter':
348-
content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken
349-
}\n${livePreviewEnabled
350-
? `\nCONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`
351-
}\nCONTENTSTACK_PREVIEW_HOST=${previewHost}\nCONTENTSTACK_APP_HOST=${appHost}\n`
352-
: '\n'
353-
}CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}\nCONTENTSTACK_API_HOST=${customHost ? customHost : managementAPIHost
354-
}${!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''
355-
}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}\nCONTENTSTACK_LIVE_EDIT_TAGS=false`;
356-
fileName = `.env${environmentVariables.environment === 'production' ? '.prod' : ''}`;
357-
filePath = pathValidator(path.join(sanitizePath(clonedDirectory), sanitizePath(fileName)));
358-
result = await writeEnvFile(content, filePath);
359-
break;
360-
case 'nuxtjs':
361-
case 'nuxt-starter':
362-
case 'nuxt3-starter':
363-
case 'stencil-starter':
364-
fileName = production ? '.env.production' : '.env';
365-
filePath = pathValidator(path.join(sanitizePath(clonedDirectory), sanitizePath(fileName)));
366-
// 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.
367-
content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken
368-
}\n${livePreviewEnabled
369-
? `\nCONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`}\nCONTENTSTACK_PREVIEW_HOST=${customHost ?? previewHost
370-
}\nCONTENTSTACK_APP_HOST=${appHost}`
371-
: '\n'
372-
}\nCONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : ''
373-
}\nCONTENTSTACK_API_HOST=${customHost ? customHost : managementAPIHost
374-
}\nCONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}\n\nCONTENTSTACK_LIVE_EDIT_TAGS=false`;
375-
result = await writeEnvFile(content, filePath);
376-
break;
377-
case 'vue-starter':
378-
fileName = '.env';
379-
filePath = pathValidator(path.join(sanitizePath(clonedDirectory), sanitizePath(fileName)));
380-
content = `VUE_APP_CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nVUE_APP_CONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken
381-
}\n${livePreviewEnabled
382-
? `\nVUE_APP_CONTENTSTACK_PREVIEW_TOKEN=${environmentVariables.preview_token || `''`
383-
}\nVUE_APP_CONTENTSTACK_PREVIEW_HOST=${previewHost}\nVUE_APP_CONTENTSTACK_APP_HOST=${appHost}\n`
384-
: '\n'
385-
}\nVUE_APP_CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${customHost ? '\nVUE_APP_CONTENTSTACK_API_HOST=' + customHost : ''
386-
}${!isUSRegion && !customHost ? '\nVUE_APP_CONTENTSTACK_REGION=' + region.name : ''
387-
}\nVUE_APP_CONTENTSTACK_LIVE_PREVIEW=${livePreviewEnabled}`;
388-
result = await writeEnvFile(content, filePath);
389-
break;
390292
default:
391293
cliux.error(messageHandler.parse('CLI_BOOTSTRAP_INVALID_APP_NAME'));
392294
}

packages/contentstack-bootstrap/src/config.ts

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@ export interface AppConfig {
1515
}
1616

1717
const config: Configuration = {
18-
sampleApps: [
19-
{ displayName: 'React JS (Deprecated)', configKey: 'reactjs' },
20-
{ displayName: 'Next JS (Deprecated)', configKey: 'nextjs' },
21-
{ displayName: 'Gatsby (Deprecated)', configKey: 'gatsby' },
22-
{ displayName: 'Angular (Deprecated)', configKey: 'angular' },
23-
],
18+
sampleApps: [],
2419
starterApps: [
2520
{ displayName: 'Compass App', configKey: 'compass-app' },
2621
{ displayName: 'Kickstart Next.js', configKey: 'kickstart-next' },
@@ -30,15 +25,6 @@ const config: Configuration = {
3025
{ displayName: 'Kickstart Next.js Middleware', configKey: 'kickstart-next-middleware' },
3126
{ displayName: 'Kickstart NuxtJS', configKey: 'kickstart-nuxt' },
3227
{ displayName: 'Kickstart NuxtJS SSR', configKey: 'kickstart-nuxt-ssr' },
33-
34-
{ displayName: 'React JS (Deprecated)', configKey: 'reactjs-starter' },
35-
{ displayName: 'Next JS (Deprecated)', configKey: 'nextjs-starter' },
36-
{ displayName: 'Gatsby (Deprecated)', configKey: 'gatsby-starter' },
37-
{ displayName: 'Angular (Deprecated)', configKey: 'angular-starter' },
38-
{ displayName: 'Nuxt JS (Deprecated)', configKey: 'nuxt-starter' },
39-
{ displayName: 'Vue JS (Deprecated)', configKey: 'vue-starter' },
40-
{ displayName: 'Stencil (Deprecated)', configKey: 'stencil-starter' },
41-
{ displayName: 'Nuxt3 (Deprecated)', configKey: 'nuxt3-starter' },
4228
],
4329
appLevelConfig: {
4430
'kickstart-next': {
@@ -74,63 +60,11 @@ const config: Configuration = {
7460
source: 'contentstack/kickstart-nuxt-ssr',
7561
stack: 'contentstack/kickstart-stack-seed',
7662
},
77-
nextjs: {
78-
source: 'contentstack/contentstack-nextjs-react-universal-demo',
79-
stack: 'contentstack/stack-contentstack-nextjs-react-universal-demo',
80-
},
81-
reactjs: {
82-
source: 'contentstack/contentstack-reactjs-universal-sample-app',
83-
stack: 'contentstack/stack-contentstack-reactjs-universal-sample-app',
84-
},
85-
gatsby: {
86-
source: 'contentstack/gatsby-starter-contentstack',
87-
stack: 'contentstack/stack-gatsby-starter-contentstack',
88-
},
89-
angular: {
90-
source: 'contentstack/contentstack-angular-modularblock-example',
91-
stack: 'contentstack/stack-contentstack-angular-modularblock-example',
92-
},
9363
'compass-app': {
9464
source: 'contentstack/compass-starter-app',
9565
stack: 'contentstack/compass-starter-stack',
9666
master_locale: 'en',
9767
},
98-
'nuxtjs-disabled': {
99-
source: 'contentstack/contentstack-nuxtjs-vue-universal-demo',
100-
stack: 'shafeeqd959/stack-contentstack-nuxtjs-vue-universal-demo',
101-
},
102-
'nuxt-starter': {
103-
source: 'contentstack/contentstack-nuxtjs-starter-app',
104-
stack: 'contentstack/stack-starter-app',
105-
},
106-
'reactjs-starter': {
107-
source: 'contentstack/contentstack-react-starter-app',
108-
stack: 'contentstack/stack-starter-app',
109-
},
110-
'nextjs-starter': {
111-
source: 'contentstack/contentstack-nextjs-starter-app',
112-
stack: 'contentstack/stack-starter-app',
113-
},
114-
'gatsby-starter': {
115-
source: 'contentstack/contentstack-gatsby-starter-app',
116-
stack: 'contentstack/stack-starter-app',
117-
},
118-
'angular-starter': {
119-
source: 'contentstack/contentstack-angular-starter',
120-
stack: 'contentstack/stack-starter-app',
121-
},
122-
'vue-starter': {
123-
source: 'contentstack/contentstack-vuejs-starter-app',
124-
stack: 'contentstack/stack-starter-app',
125-
},
126-
'stencil-starter': {
127-
source: 'contentstack/contentstack-stencil-starter-app',
128-
stack: 'contentstack/stack-starter-app',
129-
},
130-
'nuxt3-starter': {
131-
source: 'contentstack/contentstack-nuxt3-starter-app',
132-
stack: 'contentstack/stack-starter-app',
133-
},
13468
},
13569
};
13670
export default config;

packages/contentstack-bootstrap/test/bootstrap.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ const mock = {
4747
preview_token: 'test-preview-token',
4848
},
4949
appConfig: {
50-
configKey: 'reactjs-starter',
51-
displayName: 'React.js Starter',
50+
configKey: 'kickstart-next',
51+
displayName: 'Kickstart Next.js',
5252
source: 'contentstack/stack-starter-app',
5353
stack: 'contentstack/stack-starter-app',
5454
master_locale: 'en-us',
@@ -159,10 +159,10 @@ describe('Bootstrapping an app', () => {
159159
});
160160
sandbox.stub(cliux, 'prompt').callsFake((question) => {
161161
const responses = {
162-
'app-name': 'reactjs-starter',
162+
'app-name': 'kickstart-next',
163163
org: 'org-uid',
164164
'stack-name': 'test-bootstrap-cmd',
165-
'app-type': 'reactjs-starter',
165+
'app-type': 'kickstart-next',
166166
yes: true,
167167
};
168168
return Promise.resolve(responses[question.name] || {});
@@ -654,7 +654,7 @@ describe('Bootstrapping an app', () => {
654654
// Track Bootstrap instantiation
655655
sandbox.stub(require('../lib/bootstrap/index'), 'default').callsFake(function (_options) {
656656
// Verify that appConfig was retrieved using app-name
657-
expect(config.getAppLevelConfigByName.calledWith('reactjs-starter')).to.be.true;
657+
expect(config.getAppLevelConfigByName.calledWith('kickstart-next')).to.be.true;
658658
return {
659659
run: sandbox.stub().resolves(),
660660
};
@@ -664,7 +664,7 @@ describe('Bootstrapping an app', () => {
664664
command.parse = sandbox.stub().resolves({
665665
flags: {
666666
alias: undefined,
667-
'app-name': 'reactjs-starter',
667+
'app-name': 'kickstart-next',
668668
'app-type': undefined,
669669
'project-dir': undefined,
670670
'stack-api-key': undefined,

0 commit comments

Comments
 (0)