@expo/eas-json 3.7.0 → 3.9.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.
@@ -6,11 +6,15 @@ export declare class EasJsonAccessor {
6
6
  private easJsonRawContents;
7
7
  private easJsonRawObject;
8
8
  private easJsonPatched;
9
- constructor(projectDir: string);
9
+ private constructor();
10
+ private constructor();
11
+ static fromProjectPath(projectDir: string): EasJsonAccessor;
12
+ static fromRawString(easJsonRawContents: string): EasJsonAccessor;
10
13
  static formatEasJsonPath(projectDir: string): string;
11
14
  readAsync(): Promise<EasJson>;
12
15
  writeAsync(): Promise<void>;
13
16
  patch(fn: (easJsonRawObject: any) => any): void;
14
17
  readRawJsonAsync(): Promise<any>;
18
+ private parseRawJson;
15
19
  private resetState;
16
20
  }
package/build/accessor.js CHANGED
@@ -28,10 +28,17 @@ const customErrorMessageHandlers = [
28
28
  },
29
29
  ];
30
30
  class EasJsonAccessor {
31
- constructor(projectDir) {
31
+ constructor({ projectDir, easJsonRawContents, }) {
32
32
  this.isJson5 = false;
33
33
  this.easJsonPatched = false;
34
- this.easJsonPath = EasJsonAccessor.formatEasJsonPath(projectDir);
34
+ this.easJsonPath = projectDir && EasJsonAccessor.formatEasJsonPath(projectDir);
35
+ this.easJsonRawContents = easJsonRawContents;
36
+ }
37
+ static fromProjectPath(projectDir) {
38
+ return new EasJsonAccessor({ projectDir });
39
+ }
40
+ static fromRawString(easJsonRawContents) {
41
+ return new EasJsonAccessor({ easJsonRawContents });
35
42
  }
36
43
  static formatEasJsonPath(projectDir) {
37
44
  return path_1.default.join(projectDir, 'eas.json');
@@ -58,6 +65,9 @@ class EasJsonAccessor {
58
65
  return value;
59
66
  }
60
67
  async writeAsync() {
68
+ if (!this.easJsonPath) {
69
+ throw new Error('Updates are not supported for EasJsonAccessor created from string.');
70
+ }
61
71
  if (!this.easJsonPatched) {
62
72
  return;
63
73
  }
@@ -65,6 +75,9 @@ class EasJsonAccessor {
65
75
  this.resetState();
66
76
  }
67
77
  patch(fn) {
78
+ if (!this.easJsonPath) {
79
+ throw new Error('Updates are not supported for EasJsonAccessor created from string.');
80
+ }
68
81
  (0, assert_1.default)(this.easJsonRawContents && this.easJsonRawObject, 'call readAsync/readRawJsonAsync first');
69
82
  this.easJsonRawObject = fn(this.easJsonRawObject);
70
83
  if (this.isJson5) {
@@ -76,10 +89,16 @@ class EasJsonAccessor {
76
89
  this.easJsonPatched = true;
77
90
  }
78
91
  async readRawJsonAsync() {
79
- if (!(await fs_extra_1.default.pathExists(this.easJsonPath))) {
80
- throw new errors_1.MissingEasJsonError(`${chalk_1.default.bold('eas.json')} could not be found at ${this.easJsonPath}. Learn more at https://expo.fyi/eas-json`);
92
+ if (this.easJsonPath) {
93
+ if (!(await fs_extra_1.default.pathExists(this.easJsonPath))) {
94
+ throw new errors_1.MissingEasJsonError(`${chalk_1.default.bold('eas.json')} could not be found at ${this.easJsonPath}. Learn more at https://expo.fyi/eas-json`);
95
+ }
96
+ this.easJsonRawContents = await fs_extra_1.default.readFile(this.easJsonPath, 'utf-8');
81
97
  }
82
- this.easJsonRawContents = await fs_extra_1.default.readFile(this.easJsonPath, 'utf-8');
98
+ return this.parseRawJson();
99
+ }
100
+ parseRawJson() {
101
+ (0, assert_1.default)(this.easJsonRawContents !== undefined, 'easJsonRawContents needs to be set before calling parseRawJson');
83
102
  if (this.easJsonRawContents.trim().length === 0) {
84
103
  throw new errors_1.InvalidEasJsonError(`${chalk_1.default.bold('eas.json')} is empty.`);
85
104
  }
@@ -14,6 +14,8 @@ const AllowedIosResourceClasses = [
14
14
  ...AllowedCommonResourceClasses,
15
15
  types_1.ResourceClass.M1_MEDIUM,
16
16
  types_1.ResourceClass.INTEL_MEDIUM,
17
+ types_1.ResourceClass.M_MEDIUM,
18
+ types_1.ResourceClass.M_LARGE,
17
19
  ];
18
20
  const CacheSchema = joi_1.default.object({
19
21
  disabled: joi_1.default.boolean(),
@@ -7,15 +7,21 @@ export declare enum ResourceClass {
7
7
  DEFAULT = "default",
8
8
  LARGE = "large",
9
9
  /**
10
- * @deprecated use M1_MEDIUM instead
11
- * @experimental
12
- * This resource class is not yet ready to be used in production. For testing purposes only. Might be deprecated / deleted at any time.
10
+ * @deprecated use M_MEDIUM instead
13
11
  */
14
12
  M1_EXPERIMENTAL = "m1-experimental",
13
+ /**
14
+ * @deprecated use M_MEDIUM instead
15
+ */
15
16
  M1_MEDIUM = "m1-medium",
17
+ /**
18
+ * @deprecated use M_LARGE instead
19
+ */
16
20
  M1_LARGE = "m1-large",
17
21
  INTEL_MEDIUM = "intel-medium",
18
- MEDIUM = "medium"
22
+ MEDIUM = "medium",
23
+ M_MEDIUM = "m-medium",
24
+ M_LARGE = "m-large"
19
25
  }
20
26
  export type DistributionType = 'store' | 'internal';
21
27
  export type IosEnterpriseProvisioning = 'adhoc' | 'universal';
@@ -12,13 +12,19 @@ var ResourceClass;
12
12
  ResourceClass["DEFAULT"] = "default";
13
13
  ResourceClass["LARGE"] = "large";
14
14
  /**
15
- * @deprecated use M1_MEDIUM instead
16
- * @experimental
17
- * This resource class is not yet ready to be used in production. For testing purposes only. Might be deprecated / deleted at any time.
15
+ * @deprecated use M_MEDIUM instead
18
16
  */
19
17
  ResourceClass["M1_EXPERIMENTAL"] = "m1-experimental";
18
+ /**
19
+ * @deprecated use M_MEDIUM instead
20
+ */
20
21
  ResourceClass["M1_MEDIUM"] = "m1-medium";
22
+ /**
23
+ * @deprecated use M_LARGE instead
24
+ */
21
25
  ResourceClass["M1_LARGE"] = "m1-large";
22
26
  ResourceClass["INTEL_MEDIUM"] = "intel-medium";
23
27
  ResourceClass["MEDIUM"] = "medium";
28
+ ResourceClass["M_MEDIUM"] = "m-medium";
29
+ ResourceClass["M_LARGE"] = "m-large";
24
30
  })(ResourceClass = exports.ResourceClass || (exports.ResourceClass = {}));
package/build/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { AndroidReleaseStatus, AndroidReleaseTrack, SubmitProfile } from './submit/types';
2
2
  export { getDefaultProfile as getDefaultSubmitProfile } from './submit/resolver';
3
3
  export { EasJson, ProfileType, AppVersionSource } from './types';
4
+ export { Platform } from '@expo/eas-build-job';
4
5
  export { AndroidVersionAutoIncrement, BuildProfile, CredentialsSource, DistributionType, IosEnterpriseProvisioning, IosVersionAutoIncrement, ResourceClass, } from './build/types';
5
6
  export { EasJsonAccessor } from './accessor';
6
7
  export { EasJsonUtils } from './utils';
package/build/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.errors = exports.EasJsonUtils = exports.EasJsonAccessor = exports.ResourceClass = exports.CredentialsSource = exports.AppVersionSource = exports.getDefaultSubmitProfile = exports.AndroidReleaseTrack = exports.AndroidReleaseStatus = void 0;
3
+ exports.errors = exports.EasJsonUtils = exports.EasJsonAccessor = exports.ResourceClass = exports.CredentialsSource = exports.Platform = exports.AppVersionSource = exports.getDefaultSubmitProfile = exports.AndroidReleaseTrack = exports.AndroidReleaseStatus = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  var types_1 = require("./submit/types");
6
6
  Object.defineProperty(exports, "AndroidReleaseStatus", { enumerable: true, get: function () { return types_1.AndroidReleaseStatus; } });
@@ -9,6 +9,8 @@ var resolver_1 = require("./submit/resolver");
9
9
  Object.defineProperty(exports, "getDefaultSubmitProfile", { enumerable: true, get: function () { return resolver_1.getDefaultProfile; } });
10
10
  var types_2 = require("./types");
11
11
  Object.defineProperty(exports, "AppVersionSource", { enumerable: true, get: function () { return types_2.AppVersionSource; } });
12
+ var eas_build_job_1 = require("@expo/eas-build-job");
13
+ Object.defineProperty(exports, "Platform", { enumerable: true, get: function () { return eas_build_job_1.Platform; } });
12
14
  var types_3 = require("./build/types");
13
15
  Object.defineProperty(exports, "CredentialsSource", { enumerable: true, get: function () { return types_3.CredentialsSource; } });
14
16
  Object.defineProperty(exports, "ResourceClass", { enumerable: true, get: function () { return types_3.ResourceClass; } });
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": "3.7.0",
4
+ "version": "3.9.0",
5
5
  "author": "Expo <support@expo.dev>",
6
6
  "bugs": "https://github.com/expo/eas-cli/issues",
7
7
  "dependencies": {
@@ -51,5 +51,5 @@
51
51
  "node": "18.6.0",
52
52
  "yarn": "1.22.19"
53
53
  },
54
- "gitHead": "7ed1efb7d60c74450811e3dd7641899613f0e2c5"
54
+ "gitHead": "213b5d240cd29930b6a2b181e0a9622c390b41d1"
55
55
  }