@contentful/create-contentful-app 1.10.0 → 1.11.0

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
@@ -6,8 +6,8 @@
6
6
 
7
7
  # Requirements
8
8
 
9
- - Node.js v14.15, v16.16 or v18.12
10
- - npm v6 or later
9
+ - Node.js v18.12 or later
10
+ - npm v9 or later
11
11
 
12
12
  # Usage
13
13
 
@@ -57,14 +57,13 @@ These flags are mutually exclusive. If no flag is provided, the TypeScript templ
57
57
 
58
58
  Some popular templates are:
59
59
 
60
- | Template | CLI Command |
61
- | ------------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------------- |
62
- | [typescript](https://github.com/contentful/apps/tree/master/examples/typescript) | `yarn create contentful-app -ts` |
63
- | [javascript](https://github.com/contentful/apps/tree/master/examples/javascript) | `yarn create contentful-app -js` |
64
- | [nextjs](https://github.com/contentful/apps/tree/master/examples/nextjs) | `yarn create contentful-app --example nextjs` |
65
- | [vite-react](https://github.com/contentful/apps/tree/master/examples/vite-react) | `yarn create contentful-app --example vite-react` |
66
- | [vue](https://github.com/contentful/apps/tree/master/examples/vue) | `yarn create contentful-app --example vue` |
67
-
60
+ | Template | CLI Command |
61
+ | -------------------------------------------------------------------------------- | :------------------------------------------------ |
62
+ | [typescript](https://github.com/contentful/apps/tree/master/examples/typescript) | `yarn create contentful-app -ts` |
63
+ | [javascript](https://github.com/contentful/apps/tree/master/examples/javascript) | `yarn create contentful-app -js` |
64
+ | [nextjs](https://github.com/contentful/apps/tree/master/examples/nextjs) | `yarn create contentful-app --example nextjs` |
65
+ | [vite-react](https://github.com/contentful/apps/tree/master/examples/vite-react) | `yarn create contentful-app --example vite-react` |
66
+ | [vue](https://github.com/contentful/apps/tree/master/examples/vue) | `yarn create contentful-app --example vue` |
68
67
 
69
68
  ### Help
70
69
 
@@ -98,6 +98,9 @@ function makeContentfulExampleSource(options) {
98
98
  if (options.typescript) {
99
99
  return selectTemplate(types_1.ContentfulExample.Typescript);
100
100
  }
101
+ if (options.deliveryFunction || options.action) {
102
+ return selectTemplate(types_1.ContentfulExample.Typescript);
103
+ }
101
104
  return yield promptExampleSelection();
102
105
  });
103
106
  }
@@ -25,12 +25,12 @@ const addBuildCommand = (0, package_1.getAddBuildCommandFn)({
25
25
  name: 'build:actions',
26
26
  command: 'node build-actions.js',
27
27
  });
28
- function cloneAppAction(destination, templateIsTypescript) {
28
+ function cloneAppAction(destination, templateIsJavascript) {
29
29
  return __awaiter(this, void 0, void 0, function* () {
30
30
  try {
31
31
  console.log((0, logger_1.highlight)('---- Cloning hosted app action.'));
32
32
  // Clone the app actions template to the created directory under the folder 'actions'
33
- const templateSource = (0, path_1.join)('contentful/apps/examples/hosted-app-action-templates', templateIsTypescript ? 'typescript' : 'javascript');
33
+ const templateSource = (0, path_1.join)('contentful/apps/examples/hosted-app-action-templates', templateIsJavascript ? 'javascript' : 'typescript');
34
34
  const appActionDirectoryPath = (0, path_1.resolve)(`${destination}/actions`);
35
35
  const d = yield (0, degit_1.default)(templateSource, { mode: 'tar', cache: false });
36
36
  yield d.clone(appActionDirectoryPath);
@@ -54,7 +54,7 @@ function cloneAppAction(destination, templateIsTypescript) {
54
54
  mergeFn: addBuildCommand,
55
55
  });
56
56
  yield Promise.all([writeAppManifest, copyBuildFile, writeBuildCommand]);
57
- yield d.remove(appActionDirectoryPath, destination, { action: 'remove', files: constants_1.IGNORED_CLONED_FILES });
57
+ yield d.remove(appActionDirectoryPath, destination, { action: 'remove', files: constants_1.IGNORED_CLONED_FILES.map(fileName => `${appActionDirectoryPath}/${fileName}`) });
58
58
  }
59
59
  catch (e) {
60
60
  console.log(e);
@@ -24,12 +24,12 @@ const addBuildCommand = (0, package_1.getAddBuildCommandFn)({
24
24
  name: 'build:delivery-functions',
25
25
  command: 'node build-delivery-functions.js',
26
26
  });
27
- function cloneDeliveryFunction(destination, templateIsTypescript) {
27
+ function cloneDeliveryFunction(destination, templateIsJavascript) {
28
28
  return __awaiter(this, void 0, void 0, function* () {
29
29
  try {
30
30
  console.log((0, logger_1.highlight)('---- Cloning hosted delivery function.'));
31
31
  // Clone the delivery function template to the created directory under the folder 'actions'
32
- const templateSource = (0, path_1.join)('contentful/apps/examples/hosted-delivery-function-templates', templateIsTypescript ? 'typescript' : 'javascript');
32
+ const templateSource = (0, path_1.join)('contentful/apps/examples/hosted-delivery-function-templates', templateIsJavascript ? 'javascript' : 'typescript');
33
33
  const deliveryFunctionDirectoryPath = (0, path_1.resolve)(`${destination}/delivery-functions`);
34
34
  const d = (0, degit_1.default)(templateSource, { mode: 'tar', cache: false });
35
35
  yield d.clone(deliveryFunctionDirectoryPath);
@@ -53,7 +53,7 @@ function cloneDeliveryFunction(destination, templateIsTypescript) {
53
53
  mergeFn: addBuildCommand,
54
54
  });
55
55
  yield Promise.all([writeAppManifest, copyBuildFile, writeBuildCommand]);
56
- yield d.remove(deliveryFunctionDirectoryPath, destination, { action: "remove", files: constants_1.IGNORED_CLONED_FILES });
56
+ yield d.remove(deliveryFunctionDirectoryPath, destination, { action: "remove", files: constants_1.IGNORED_CLONED_FILES.map(fileName => `${deliveryFunctionDirectoryPath}/${fileName}`) });
57
57
  }
58
58
  catch (e) {
59
59
  console.error(e);
package/lib/index.js CHANGED
@@ -100,7 +100,9 @@ function initProject(appName, options) {
100
100
  const isInteractive = !normalizedOptions.example &&
101
101
  !normalizedOptions.source &&
102
102
  !normalizedOptions.javascript &&
103
- !normalizedOptions.typescript;
103
+ !normalizedOptions.typescript &&
104
+ !normalizedOptions.deliveryFunction &&
105
+ !normalizedOptions.action;
104
106
  const templateSource = yield (0, getTemplateSource_1.getTemplateSource)(options);
105
107
  (0, analytics_1.track)({
106
108
  template: templateSource,
@@ -109,12 +111,12 @@ function initProject(appName, options) {
109
111
  });
110
112
  yield (0, template_1.cloneTemplateIn)(fullAppFolder, templateSource);
111
113
  if (!isInteractive && (0, utils_1.isContentfulTemplate)(templateSource) && normalizedOptions.action) {
112
- yield (0, includeAppAction_1.cloneAppAction)(fullAppFolder, !!normalizedOptions.typescript);
114
+ yield (0, includeAppAction_1.cloneAppAction)(fullAppFolder, !!normalizedOptions.javascript);
113
115
  }
114
116
  if (!isInteractive &&
115
117
  (0, utils_1.isContentfulTemplate)(templateSource) &&
116
118
  normalizedOptions.deliveryFunction) {
117
- yield (0, includeDeliveryFunction_1.cloneDeliveryFunction)(fullAppFolder, !!normalizedOptions.typescript);
119
+ yield (0, includeDeliveryFunction_1.cloneDeliveryFunction)(fullAppFolder, !!normalizedOptions.javascript);
118
120
  }
119
121
  updatePackageName(fullAppFolder);
120
122
  const useYarn = normalizedOptions.yarn || (0, utils_1.detectManager)() === 'yarn';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/create-contentful-app",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "A template for building Contentful Apps",
5
5
  "keywords": [
6
6
  "contentful",
@@ -39,12 +39,12 @@
39
39
  "@contentful/app-scripts": "1.13.0",
40
40
  "analytics-node": "^6.2.0",
41
41
  "chalk": "4.1.2",
42
- "commander": "11.0.0",
42
+ "commander": "11.1.0",
43
43
  "degit": "2.8.4",
44
44
  "inquirer": "8.2.6",
45
45
  "merge-options": "^3.0.4",
46
46
  "node-fetch": "2.6.7",
47
- "rimraf": "5.0.1",
47
+ "rimraf": "5.0.5",
48
48
  "tildify": "2.0.0",
49
49
  "validate-npm-package-name": "5.0.0"
50
50
  },
@@ -63,7 +63,7 @@
63
63
  "@types/analytics-node": "^3.1.9",
64
64
  "@types/chai-as-promised": "^7.1.5",
65
65
  "@types/chalk": "2.2.0",
66
- "@types/degit": "2.8.4",
66
+ "@types/degit": "2.8.5",
67
67
  "@types/inquirer": "8.2.1",
68
68
  "@types/mocha": "^10.0.1",
69
69
  "@types/node": "14.18.63",
@@ -72,14 +72,14 @@
72
72
  "@types/sinon": "^10.0.16",
73
73
  "@types/sinon-chai": "^3.2.9",
74
74
  "@types/tildify": "2.0.2",
75
- "@types/validate-npm-package-name": "4.0.0",
75
+ "@types/validate-npm-package-name": "4.0.1",
76
76
  "chai": "^4.3.7",
77
77
  "chai-as-promised": "^7.1.1",
78
- "contentful-management": "10.46.2",
78
+ "contentful-management": "11.2.0",
79
79
  "mocha": "^10.2.0",
80
- "sinon": "^16.0.0",
80
+ "sinon": "^17.0.0",
81
81
  "sinon-chai": "^3.7.0",
82
82
  "ts-node": "^10.9.1"
83
83
  },
84
- "gitHead": "4e9eda2a0228c02706445854f36e3136314292e8"
84
+ "gitHead": "92dba4b610b506f224e394b47f11883d2187fb27"
85
85
  }