@contentstack/cli-cm-bootstrap 1.0.4 → 1.0.7

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 CHANGED
@@ -13,7 +13,7 @@ $ npm install -g @contentstack/cli-cm-bootstrap
13
13
  $ csdx COMMAND
14
14
  running command...
15
15
  $ csdx (-v|--version|version)
16
- @contentstack/cli-cm-bootstrap/1.0.4 linux-x64 node-v12.22.7
16
+ @contentstack/cli-cm-bootstrap/1.0.7 linux-x64 node-v16.14.2
17
17
  $ csdx --help [COMMAND]
18
18
  USAGE
19
19
  $ csdx COMMAND
@@ -57,5 +57,5 @@ EXAMPLES
57
57
  $ csdx cm:bootstrap -t <github access token>
58
58
  ```
59
59
 
60
- _See code: [src/commands/cm/bootstrap.ts](https://github.com/contentstack/cli/blob/v1.0.4/src/commands/cm/bootstrap.ts)_
60
+ _See code: [src/commands/cm/bootstrap.ts](https://github.com/contentstack/cli/blob/v1.0.7/src/commands/cm/bootstrap.ts)_
61
61
  <!-- commandsstop -->
@@ -91,9 +91,10 @@ const envFileHandler = async (appConfigKey, environmentVariables, clonedDirector
91
91
  let fileName;
92
92
  let customHost;
93
93
  const regionName = region && region.name && region.name.toLowerCase();
94
+ const managementAPIHost = region.cma && region.cma.substring('8');
94
95
  const isUSRegion = (regionName === 'us' || regionName === 'na');
95
96
  if (regionName !== 'eu' && !isUSRegion) {
96
- customHost = region.cda && region.cda.substring('8');
97
+ customHost = region.cma && region.cma.substring('8');
97
98
  }
98
99
  const production = (environmentVariables.environment === 'production' ? true : false);
99
100
  switch (appConfigKey) {
@@ -101,21 +102,21 @@ const envFileHandler = async (appConfigKey, environmentVariables, clonedDirector
101
102
  case 'reactjs-starter':
102
103
  fileName = `.env.${environmentVariables.environment}.local`;
103
104
  filePath = path.join(clonedDirectory, fileName);
104
- content = `REACT_APP_CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nREACT_APP_CONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\nREACT_APP_CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${(customHost ? '\nREACT_APP_CONTENTSTACK_CUSTOM_HOST=' + customHost : '')}${(!isUSRegion && !customHost) ? '\nREACT_APP_CONTENTSTACK_REGION=' + region.name : ''}`;
105
+ content = `REACT_APP_CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nREACT_APP_CONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\nREACT_APP_CONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${(customHost ? '\nREACT_APP_CONTENTSTACK_API_HOST=' + customHost : '')}${(!isUSRegion && !customHost) ? '\nREACT_APP_CONTENTSTACK_REGION=' + region.name : ''}\nSKIP_PREFLIGHT_CHECK=true`;
105
106
  result = await writeEnvFile(content, filePath);
106
107
  break;
107
108
  case 'nextjs':
108
109
  case 'nextjs-starter':
109
110
  fileName = `.env.${environmentVariables.environment}.local`;
110
111
  filePath = path.join(clonedDirectory, fileName);
111
- content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\nCONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${(customHost ? '\nCONTENTSTACK_CUSTOM_HOST=' + customHost : '')}${(!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : '')}`;
112
+ content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\nCONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${(customHost ? '\nCONTENTSTACK_API_HOST=' + customHost : '')}${(!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : '')}`;
112
113
  result = await writeEnvFile(content, filePath);
113
114
  break;
114
115
  case 'gatsby':
115
116
  case 'gatsby-starter':
116
117
  fileName = `.env.${environmentVariables.environment}`;
117
118
  filePath = path.join(clonedDirectory, fileName);
118
- content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\nCONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}\nCONTENTSTACK_CDN=${region.cda}/v3`;
119
+ content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\nCONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}\nCONTENTSTACK_API_HOST=${managementAPIHost}`;
119
120
  result = await writeEnvFile(content, filePath);
120
121
  break;
121
122
  case 'angular':
@@ -125,7 +126,7 @@ const envFileHandler = async (appConfigKey, environmentVariables, clonedDirector
125
126
  result = await writeEnvFile(content, filePath);
126
127
  break;
127
128
  case 'angular-starter':
128
- content = `export const environment = { \n\tproduction: true \n}; \nexport const Config = { \n\tapi_key: '${environmentVariables.api_key}', \n\tdelivery_token: '${environmentVariables.deliveryToken}', \n\tenvironment: '${environmentVariables.environment}'${(!isUSRegion && !customHost ? `,\n\tregion: '${region.name}'` : '')} \n};`;
129
+ content = `export const environment = { \n\tproduction: true \n}; \nexport const Config = { \n\tapi_key: '${environmentVariables.api_key}', \n\tdelivery_token: '${environmentVariables.deliveryToken}', \n\tenvironment: '${environmentVariables.environment}'${(!isUSRegion && !customHost ? `,\n\tregion: '${region.name}'` : '')},\n\tapi_host: '${customHost ? customHost : ''}',\n\tapp_host: '',\n\tmanagement_token: '',\n\tlive_preview: ''\n};`;
129
130
  fileName = `environment${(environmentVariables.environment === 'production' ? '.prod.' : ".")}ts`;
130
131
  filePath = path.join(clonedDirectory, 'src', 'environments', fileName);
131
132
  result = await writeEnvFile(content, filePath);
@@ -134,7 +135,7 @@ const envFileHandler = async (appConfigKey, environmentVariables, clonedDirector
134
135
  case 'nuxt-starter':
135
136
  fileName = (production ? '.env.production' : '.env');
136
137
  filePath = path.join(clonedDirectory, fileName);
137
- content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\nCONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${(!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : '')}`;
138
+ content = `CONTENTSTACK_API_KEY=${environmentVariables.api_key}\nCONTENTSTACK_DELIVERY_TOKEN=${environmentVariables.deliveryToken}\nCONTENTSTACK_ENVIRONMENT=${environmentVariables.environment}${(customHost ? '\nCONTENTSTACK_API_HOST=' + customHost : '')}${(!isUSRegion && !customHost ? '\nCONTENTSTACK_REGION=' + region.name : '')}`;
138
139
  result = await writeEnvFile(content, filePath);
139
140
  break;
140
141
  default:
@@ -1 +1 @@
1
- {"version":"1.0.4","commands":{"cm:bootstrap":{"id":"cm:bootstrap","description":"Bootstrap contentstack apps","pluginName":"@contentstack/cli-cm-bootstrap","pluginType":"core","aliases":[],"examples":["$ csdx cm:bootstrap","$ csdx cm:bootstrap -d <path/to/setup/the/app>","$ csdx cm:bootstrap -t <github access token>"],"flags":{"appName":{"name":"appName","type":"option","char":"a","description":"App name, reactjs-starter, nextjs-starter, gatsby-starter, angular-starter, nuxt-starter","required":false},"directory":{"name":"directory","type":"option","char":"d","description":"Directory to setup the project. If directory name has a space then provide the path as a string or escap the space using back slash eg: \"../../test space\" or ../../test\\ space","required":false},"accessToken":{"name":"accessToken","type":"option","char":"t","description":"Access token for private github repo","required":false},"appType":{"name":"appType","type":"option","char":"s","description":"Sample or Starter app","hidden":true,"required":false}},"args":[]}}}
1
+ {"version":"1.0.7","commands":{"cm:bootstrap":{"id":"cm:bootstrap","description":"Bootstrap contentstack apps","pluginName":"@contentstack/cli-cm-bootstrap","pluginType":"core","aliases":[],"examples":["$ csdx cm:bootstrap","$ csdx cm:bootstrap -d <path/to/setup/the/app>","$ csdx cm:bootstrap -t <github access token>"],"flags":{"appName":{"name":"appName","type":"option","char":"a","description":"App name, reactjs-starter, nextjs-starter, gatsby-starter, angular-starter, nuxt-starter","required":false},"directory":{"name":"directory","type":"option","char":"d","description":"Directory to setup the project. If directory name has a space then provide the path as a string or escap the space using back slash eg: \"../../test space\" or ../../test\\ space","required":false},"accessToken":{"name":"accessToken","type":"option","char":"t","description":"Access token for private github repo","required":false},"appType":{"name":"appType","type":"option","char":"s","description":"Sample or Starter app","hidden":true,"required":false}},"args":[]}}}
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.0.4",
4
+ "version": "1.0.7",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "scripts": {
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@contentstack/cli-command": "^0.1.1-beta.6",
21
- "@contentstack/cli-cm-seed": "^1.0.9",
21
+ "@contentstack/cli-cm-seed": "^1.0.11",
22
22
  "@contentstack/management": "^1.3.0",
23
23
  "@oclif/command": "^1.8.0",
24
24
  "@oclif/config": "^1.17.0",