@contentful/create-contentful-app 1.3.1 → 1.3.5

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
@@ -17,7 +17,7 @@ To start developing your first app, run:
17
17
  npx create-contentful-app my-first-app
18
18
  ```
19
19
 
20
- ![Screenshot of `npx create-contentful-app my-app`](./docs/screenshot.png)
20
+ ![Screenshot of `npx create-contentful-app my-app`](https://raw.githubusercontent.com/contentful/create-contentful-app/master/packages/contentful--create-contentful-app/docs/screenshot.png)
21
21
 
22
22
  ## Bootstrap
23
23
 
package/lib/index.js CHANGED
@@ -94,7 +94,7 @@ function initProject(appName, options) {
94
94
  successMessage(fullAppFolder);
95
95
  }
96
96
  catch (err) {
97
- (0, logger_1.error)(`Failed to create ${appName}`, err instanceof Error ? err : String(err));
97
+ (0, logger_1.error)(`Failed to create ${appName}`, err);
98
98
  process.exit(1);
99
99
  }
100
100
  });
package/lib/logger.js CHANGED
@@ -10,15 +10,18 @@ function warn(message) {
10
10
  }
11
11
  exports.warn = warn;
12
12
  function error(message, error) {
13
- if (error instanceof Error) {
14
- console.log(`${chalk_1.default.red('Error:')} ${message}\n`);
13
+ console.log(`${chalk_1.default.red('Error:')} ${message}`);
14
+ if (error === undefined) {
15
+ return;
16
+ }
17
+ else if (error instanceof Error) {
18
+ console.log();
15
19
  console.log(error);
16
20
  }
17
21
  else {
18
- console.log(`${chalk_1.default.red('Error:')} ${message}
19
-
20
- ${error.startsWith('Error: ') ? error.substring(7) : error}
21
- `);
22
+ const strigifiedError = String(error);
23
+ console.log();
24
+ console.log(`${strigifiedError.startsWith('Error: ') ? strigifiedError.substring(7) : strigifiedError}`);
22
25
  }
23
26
  }
24
27
  exports.error = error;
package/lib/template.js CHANGED
@@ -22,7 +22,7 @@ const logger_1 = require("./logger");
22
22
  const utils_1 = require("./utils");
23
23
  const EXAMPLES_PATH = 'contentful/apps/examples/';
24
24
  function isContentfulTemplate(url) {
25
- return Object.values(types_1.ContentfulExample).some(t => url.includes(EXAMPLES_PATH + t));
25
+ return Object.values(types_1.ContentfulExample).some((t) => url.includes(EXAMPLES_PATH + t));
26
26
  }
27
27
  function makeContentfulExampleSource(options) {
28
28
  if (options.example) {
@@ -64,16 +64,12 @@ function validate(destination) {
64
64
  if (!(0, fs_1.existsSync)(packageJSONLocation)) {
65
65
  throw new Error(`Invalid template: missing "${packageJSONLocation}".`);
66
66
  }
67
- let packageJSON;
68
67
  try {
69
- packageJSON = JSON.parse((0, fs_1.readFileSync)(packageJSONLocation, 'utf-8'));
68
+ JSON.parse((0, fs_1.readFileSync)(packageJSONLocation, 'utf-8'));
70
69
  }
71
70
  catch (e) {
72
71
  throw new Error(`Invalid template: invalid "${packageJSONLocation}".`);
73
72
  }
74
- if (!Object.keys(packageJSON.dependencies).includes('@contentful/app-sdk')) {
75
- throw new Error(`Invalid template: missing "@contentful/app-sdk" in "${packageJSONLocation}".`);
76
- }
77
73
  }
78
74
  function cleanUp(destination) {
79
75
  (0, utils_1.rmIfExists)((0, path_1.resolve)(destination, 'package-lock.json'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/create-contentful-app",
3
- "version": "1.3.1",
3
+ "version": "1.3.5",
4
4
  "description": "A template for building Contentful Apps",
5
5
  "keywords": [
6
6
  "contentful",
@@ -35,7 +35,7 @@
35
35
  "build": "tsc"
36
36
  },
37
37
  "dependencies": {
38
- "@contentful/app-scripts": "^1.1.0",
38
+ "@contentful/app-scripts": "1.1.2",
39
39
  "chalk": "^4.1.0",
40
40
  "commander": "^9.0.0",
41
41
  "degit": "2.8.4",
@@ -64,5 +64,5 @@
64
64
  "@types/tildify": "^2.0.2",
65
65
  "@types/validate-npm-package-name": "^3.0.3"
66
66
  },
67
- "gitHead": "b4e1ba40ea11d0fbd7256edd19e937f2c4e60e48"
67
+ "gitHead": "4540712bf960bbb744c3c7ab1b0fb7a7f051a031"
68
68
  }