@expo/eas-json 2.7.1 → 3.0.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/build/accessor.js CHANGED
@@ -9,7 +9,24 @@ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
9
9
  const fleece = tslib_1.__importStar(require("golden-fleece"));
10
10
  const path_1 = tslib_1.__importDefault(require("path"));
11
11
  const errors_1 = require("./errors");
12
+ const log_1 = require("./log");
12
13
  const schema_1 = require("./schema");
14
+ const customErrorMessageHandlers = [
15
+ // Ask user to upgrade eas-cli version or check the docs when image is invalid.
16
+ (err) => {
17
+ var _a;
18
+ for (const detail of err.details) {
19
+ // image should be only placed under 'build.profilename.platform.image' key
20
+ // if it's not the case show standard Joi error
21
+ if (detail.path.length === 4 &&
22
+ detail.path[0] === 'build' &&
23
+ ['ios', 'android'].includes(detail.path[2].toString()) &&
24
+ detail.path[3] === 'image') {
25
+ throw new errors_1.InvalidEasJsonError(chalk_1.default.red(`Specified build image '${(_a = detail === null || detail === void 0 ? void 0 : detail.context) === null || _a === void 0 ? void 0 : _a.value}' is not recognized. Please update your EAS CLI and see ${(0, log_1.link)('https://docs.expo.dev/build-reference/infrastructure/')} for supported build images.`));
26
+ }
27
+ }
28
+ },
29
+ ];
13
30
  class EasJsonAccessor {
14
31
  constructor(projectDir) {
15
32
  this.isJson5 = false;
@@ -31,6 +48,9 @@ class EasJsonAccessor {
31
48
  noDefaults: true,
32
49
  });
33
50
  if (error) {
51
+ for (const handler of customErrorMessageHandlers) {
52
+ handler(error);
53
+ }
34
54
  const errorMessages = error.message.split('. ');
35
55
  throw new errors_1.InvalidEasJsonError(`${chalk_1.default.bold('eas.json')} is not valid.\n- ${errorMessages.join('\n- ')}`);
36
56
  }
package/build/log.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare function link(url: string, { text, dim }?: {
2
+ text?: string;
3
+ dim?: boolean;
4
+ }): string;
package/build/log.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.link = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const terminal_link_1 = tslib_1.__importDefault(require("terminal-link"));
7
+ // link function from packages/eas-cli/src/log.ts
8
+ function link(url, { text = url, dim = true } = {}) {
9
+ let output;
10
+ if (terminal_link_1.default.isSupported) {
11
+ output = (0, terminal_link_1.default)(text, url);
12
+ }
13
+ else {
14
+ output = `${text === url ? '' : text + ': '}${chalk_1.default.underline(url)}`;
15
+ }
16
+ return dim ? chalk_1.default.dim(output) : output;
17
+ }
18
+ exports.link = link;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@expo/eas-json",
3
3
  "description": "A library for interacting with eas.json",
4
- "version": "2.7.1",
4
+ "version": "3.0.0",
5
5
  "author": "Expo <support@expo.dev>",
6
6
  "bugs": "https://github.com/expo/eas-cli/issues",
7
7
  "dependencies": {
@@ -14,6 +14,7 @@
14
14
  "joi": "17.6.4",
15
15
  "log-symbols": "4.1.0",
16
16
  "semver": "7.3.8",
17
+ "terminal-link": "2.1.1",
17
18
  "tslib": "2.4.0"
18
19
  },
19
20
  "devDependencies": {
@@ -49,5 +50,5 @@
49
50
  "node": "18.6.0",
50
51
  "yarn": "1.22.19"
51
52
  },
52
- "gitHead": "01619d4182f3321ad9946fddd041702f9a301c2c"
53
+ "gitHead": "09a4b3d3870c941c72573a3502f4e155ca862e0a"
53
54
  }