@expo/eas-json 0.33.0 → 0.34.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/EasJson.types.d.ts +5 -0
- package/build/EasJsonReader.d.ts +10 -1
- package/build/EasJsonReader.js +29 -2
- package/build/EasJsonSchema.d.ts +1 -0
- package/build/EasJsonSchema.js +7 -1
- package/build/errors.d.ts +2 -0
- package/build/errors.js +6 -0
- package/build/index.d.ts +1 -1
- package/build/index.js +3 -5
- package/package.json +5 -3
- package/src/EasJson.types.ts +6 -0
- package/src/EasJsonReader.ts +42 -3
- package/src/EasJsonSchema.ts +7 -0
- package/src/errors.ts +1 -0
- package/src/index.ts +1 -1
- package/build/DeprecatedConfig.types.d.ts +0 -45
- package/build/DeprecatedConfig.types.js +0 -8
- package/build/DeprecatedEasJsonReader.d.ts +0 -33
- package/build/DeprecatedEasJsonReader.js +0 -145
- package/build/DeprecatedEasJsonSchema.d.ts +0 -3
- package/build/DeprecatedEasJsonSchema.js +0 -84
- package/build/migrate.d.ts +0 -6
- package/build/migrate.js +0 -161
- package/src/DeprecatedConfig.types.ts +0 -58
- package/src/DeprecatedEasJsonReader.ts +0 -190
- package/src/DeprecatedEasJsonSchema.ts +0 -95
- package/src/__tests__/migrate-test.ts +0 -297
- package/src/migrate.ts +0 -182
package/build/EasJson.types.d.ts
CHANGED
|
@@ -14,7 +14,12 @@ export interface EasSubmitConfiguration {
|
|
|
14
14
|
[Platform.ANDROID]?: AndroidSubmitProfile;
|
|
15
15
|
[Platform.IOS]?: IosSubmitProfile;
|
|
16
16
|
}
|
|
17
|
+
export interface CliConfig {
|
|
18
|
+
version?: string;
|
|
19
|
+
requireCommit?: boolean;
|
|
20
|
+
}
|
|
17
21
|
export interface EasJson {
|
|
22
|
+
cli?: CliConfig;
|
|
18
23
|
build: {
|
|
19
24
|
[profile: string]: RawBuildProfile;
|
|
20
25
|
};
|
package/build/EasJsonReader.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Platform } from '@expo/eas-build-job';
|
|
2
2
|
import { BuildProfile } from './EasBuild.types';
|
|
3
|
-
import { EasJson, RawBuildProfile } from './EasJson.types';
|
|
3
|
+
import { CliConfig, EasJson, RawBuildProfile } from './EasJson.types';
|
|
4
4
|
import { SubmitProfile } from './EasSubmit.types';
|
|
5
5
|
interface EasJsonPreValidation {
|
|
6
|
+
cli?: object;
|
|
6
7
|
build: {
|
|
7
8
|
[profile: string]: object;
|
|
8
9
|
};
|
|
@@ -10,11 +11,19 @@ interface EasJsonPreValidation {
|
|
|
10
11
|
[profile: string]: object;
|
|
11
12
|
};
|
|
12
13
|
}
|
|
14
|
+
declare type LoggerFn = (...args: any[]) => void;
|
|
15
|
+
interface Logger {
|
|
16
|
+
log: LoggerFn;
|
|
17
|
+
warn: LoggerFn;
|
|
18
|
+
}
|
|
13
19
|
export declare class EasJsonReader {
|
|
14
20
|
private projectDir;
|
|
21
|
+
private static log?;
|
|
15
22
|
static formatEasJsonPath(projectDir: string): string;
|
|
23
|
+
static setLog(log: Logger): void;
|
|
16
24
|
constructor(projectDir: string);
|
|
17
25
|
getBuildProfileNamesAsync(): Promise<string[]>;
|
|
26
|
+
getCliConfigAsync(): Promise<CliConfig | null>;
|
|
18
27
|
getSubmitProfileNamesAsync({ throwIfEasJsonDoesNotExist }?: {
|
|
19
28
|
throwIfEasJsonDoesNotExist?: boolean | undefined;
|
|
20
29
|
}): Promise<string[]>;
|
package/build/EasJsonReader.js
CHANGED
|
@@ -9,6 +9,7 @@ const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
|
9
9
|
const EasJson_types_1 = require("./EasJson.types");
|
|
10
10
|
const EasJsonSchema_1 = require("./EasJsonSchema");
|
|
11
11
|
const EasSubmit_types_1 = require("./EasSubmit.types");
|
|
12
|
+
const errors_1 = require("./errors");
|
|
12
13
|
const defaults = {
|
|
13
14
|
distribution: 'store',
|
|
14
15
|
credentialsSource: EasJson_types_1.CredentialsSource.REMOTE,
|
|
@@ -20,11 +21,37 @@ class EasJsonReader {
|
|
|
20
21
|
static formatEasJsonPath(projectDir) {
|
|
21
22
|
return path_1.default.join(projectDir, 'eas.json');
|
|
22
23
|
}
|
|
24
|
+
static setLog(log) {
|
|
25
|
+
this.log = log;
|
|
26
|
+
}
|
|
23
27
|
async getBuildProfileNamesAsync() {
|
|
24
28
|
var _a;
|
|
25
29
|
const easJson = await this.readRawAsync();
|
|
26
30
|
return Object.keys((_a = easJson === null || easJson === void 0 ? void 0 : easJson.build) !== null && _a !== void 0 ? _a : {});
|
|
27
31
|
}
|
|
32
|
+
async getCliConfigAsync() {
|
|
33
|
+
try {
|
|
34
|
+
const easJson = await this.readRawAsync();
|
|
35
|
+
if (!easJson.cli) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const { value, error } = EasJsonSchema_1.CliConfigSchema.validate(easJson.cli, {
|
|
39
|
+
allowUnknown: false,
|
|
40
|
+
convert: true,
|
|
41
|
+
abortEarly: false,
|
|
42
|
+
});
|
|
43
|
+
if (error) {
|
|
44
|
+
throw new Error(`"cli" field in eas.json is not valid [${error.toString()}]`);
|
|
45
|
+
}
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
if (err.code === 'ENOENT') {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
28
55
|
async getSubmitProfileNamesAsync({ throwIfEasJsonDoesNotExist = true } = {}) {
|
|
29
56
|
var _a;
|
|
30
57
|
try {
|
|
@@ -94,7 +121,7 @@ class EasJsonReader {
|
|
|
94
121
|
abortEarly: false,
|
|
95
122
|
});
|
|
96
123
|
if (error) {
|
|
97
|
-
throw new
|
|
124
|
+
throw new errors_1.InvalidEasJsonError(`eas.json is not valid [${error.toString()}]`);
|
|
98
125
|
}
|
|
99
126
|
return value;
|
|
100
127
|
}
|
|
@@ -104,7 +131,7 @@ class EasJsonReader {
|
|
|
104
131
|
const rawEasJson = json_file_1.default.read(easJsonPath);
|
|
105
132
|
const { value, error } = EasJsonSchema_1.MinimalEasJsonSchema.validate(rawEasJson, { abortEarly: false });
|
|
106
133
|
if (error) {
|
|
107
|
-
throw new
|
|
134
|
+
throw new errors_1.InvalidEasJsonError(`eas.json is not valid [${error.toString()}]`);
|
|
108
135
|
}
|
|
109
136
|
return value;
|
|
110
137
|
}
|
package/build/EasJsonSchema.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Joi from 'joi';
|
|
2
2
|
export declare const AndroidSubmitProfileSchema: Joi.ObjectSchema<any>;
|
|
3
3
|
export declare const IosSubmitProfileSchema: Joi.ObjectSchema<any>;
|
|
4
|
+
export declare const CliConfigSchema: Joi.ObjectSchema<any>;
|
|
4
5
|
export declare const MinimalEasJsonSchema: Joi.ObjectSchema<any>;
|
|
5
6
|
export declare const EasJsonSchema: Joi.ObjectSchema<any>;
|
package/build/EasJsonSchema.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EasJsonSchema = exports.MinimalEasJsonSchema = exports.IosSubmitProfileSchema = exports.AndroidSubmitProfileSchema = void 0;
|
|
3
|
+
exports.EasJsonSchema = exports.MinimalEasJsonSchema = exports.CliConfigSchema = exports.IosSubmitProfileSchema = exports.AndroidSubmitProfileSchema = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
6
6
|
const joi_1 = (0, tslib_1.__importDefault)(require("joi"));
|
|
@@ -83,11 +83,17 @@ const EasJsonSubmitConfigurationSchema = joi_1.default.object({
|
|
|
83
83
|
android: exports.AndroidSubmitProfileSchema,
|
|
84
84
|
ios: exports.IosSubmitProfileSchema,
|
|
85
85
|
});
|
|
86
|
+
exports.CliConfigSchema = joi_1.default.object({
|
|
87
|
+
version: joi_1.default.string(),
|
|
88
|
+
requireCommit: joi_1.default.boolean(),
|
|
89
|
+
});
|
|
86
90
|
exports.MinimalEasJsonSchema = joi_1.default.object({
|
|
91
|
+
cli: joi_1.default.object(),
|
|
87
92
|
build: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.object()),
|
|
88
93
|
submit: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.object()),
|
|
89
94
|
});
|
|
90
95
|
exports.EasJsonSchema = joi_1.default.object({
|
|
96
|
+
cli: exports.CliConfigSchema,
|
|
91
97
|
build: joi_1.default.object().pattern(joi_1.default.string(), EasJsonBuildProfileSchema),
|
|
92
98
|
submit: joi_1.default.object().pattern(joi_1.default.string(), EasJsonSubmitConfigurationSchema),
|
|
93
99
|
});
|
package/build/errors.js
ADDED
package/build/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { AndroidSubmitProfile, AndroidReleaseStatus, AndroidReleaseTrack, IosSub
|
|
|
2
2
|
export { EasJson } from './EasJson.types';
|
|
3
3
|
export { AndroidBuildProfile, BuildProfile, CredentialsSource, DistributionType, IosBuildProfile, IosEnterpriseProvisioning, IosVersionAutoIncrement, AndroidVersionAutoIncrement, } from './EasBuild.types';
|
|
4
4
|
export { EasJsonReader } from './EasJsonReader';
|
|
5
|
-
export
|
|
5
|
+
export * as errors from './errors';
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.errors = exports.EasJsonReader = exports.CredentialsSource = exports.AndroidReleaseTrack = exports.AndroidReleaseStatus = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
var EasSubmit_types_1 = require("./EasSubmit.types");
|
|
5
6
|
Object.defineProperty(exports, "AndroidReleaseStatus", { enumerable: true, get: function () { return EasSubmit_types_1.AndroidReleaseStatus; } });
|
|
6
7
|
Object.defineProperty(exports, "AndroidReleaseTrack", { enumerable: true, get: function () { return EasSubmit_types_1.AndroidReleaseTrack; } });
|
|
@@ -8,7 +9,4 @@ var EasBuild_types_1 = require("./EasBuild.types");
|
|
|
8
9
|
Object.defineProperty(exports, "CredentialsSource", { enumerable: true, get: function () { return EasBuild_types_1.CredentialsSource; } });
|
|
9
10
|
var EasJsonReader_1 = require("./EasJsonReader");
|
|
10
11
|
Object.defineProperty(exports, "EasJsonReader", { enumerable: true, get: function () { return EasJsonReader_1.EasJsonReader; } });
|
|
11
|
-
|
|
12
|
-
Object.defineProperty(exports, "hasMismatchedExtendsAsync", { enumerable: true, get: function () { return migrate_1.hasMismatchedExtendsAsync; } });
|
|
13
|
-
Object.defineProperty(exports, "isUsingDeprecatedFormatAsync", { enumerable: true, get: function () { return migrate_1.isUsingDeprecatedFormatAsync; } });
|
|
14
|
-
Object.defineProperty(exports, "migrateAsync", { enumerable: true, get: function () { return migrate_1.migrateAsync; } });
|
|
12
|
+
exports.errors = (0, tslib_1.__importStar)(require("./errors"));
|
package/package.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/eas-json",
|
|
3
3
|
"description": "A library for interacting with the eas.json",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.34.0",
|
|
5
5
|
"author": "Expo <support@expo.dev>",
|
|
6
6
|
"bugs": "https://github.com/expo/eas-cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@expo/eas-build-job": "0.2.
|
|
8
|
+
"@expo/eas-build-job": "0.2.57",
|
|
9
9
|
"@expo/json-file": "8.2.33",
|
|
10
|
+
"chalk": "4.1.2",
|
|
10
11
|
"env-string": "1.0.1",
|
|
11
12
|
"fs-extra": "10.0.0",
|
|
12
13
|
"joi": "17.4.2",
|
|
14
|
+
"log-symbols": "4.1.0",
|
|
13
15
|
"tslib": "2.3.1"
|
|
14
16
|
},
|
|
15
17
|
"devDependencies": {
|
|
@@ -33,5 +35,5 @@
|
|
|
33
35
|
"publishConfig": {
|
|
34
36
|
"access": "public"
|
|
35
37
|
},
|
|
36
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "36118b700f4cadc184bddd733b568fe7abde69fe"
|
|
37
39
|
}
|
package/src/EasJson.types.ts
CHANGED
|
@@ -19,7 +19,13 @@ export interface EasSubmitConfiguration {
|
|
|
19
19
|
[Platform.IOS]?: IosSubmitProfile;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export interface CliConfig {
|
|
23
|
+
version?: string;
|
|
24
|
+
requireCommit?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
export interface EasJson {
|
|
28
|
+
cli?: CliConfig;
|
|
23
29
|
build: { [profile: string]: RawBuildProfile };
|
|
24
30
|
submit?: { [profile: string]: EasSubmitConfiguration };
|
|
25
31
|
}
|
package/src/EasJsonReader.ts
CHANGED
|
@@ -4,9 +4,10 @@ import envString from 'env-string';
|
|
|
4
4
|
import path from 'path';
|
|
5
5
|
|
|
6
6
|
import { BuildProfile } from './EasBuild.types';
|
|
7
|
-
import { CredentialsSource, EasJson, RawBuildProfile } from './EasJson.types';
|
|
7
|
+
import { CliConfig, CredentialsSource, EasJson, RawBuildProfile } from './EasJson.types';
|
|
8
8
|
import {
|
|
9
9
|
AndroidSubmitProfileSchema,
|
|
10
|
+
CliConfigSchema,
|
|
10
11
|
EasJsonSchema,
|
|
11
12
|
IosSubmitProfileSchema,
|
|
12
13
|
MinimalEasJsonSchema,
|
|
@@ -16,8 +17,10 @@ import {
|
|
|
16
17
|
IosSubmitProfileFieldsToEvaluate,
|
|
17
18
|
SubmitProfile,
|
|
18
19
|
} from './EasSubmit.types';
|
|
20
|
+
import { InvalidEasJsonError } from './errors';
|
|
19
21
|
|
|
20
22
|
interface EasJsonPreValidation {
|
|
23
|
+
cli?: object;
|
|
21
24
|
build: { [profile: string]: object };
|
|
22
25
|
submit?: { [profile: string]: object };
|
|
23
26
|
}
|
|
@@ -27,11 +30,24 @@ const defaults = {
|
|
|
27
30
|
credentialsSource: CredentialsSource.REMOTE,
|
|
28
31
|
} as const;
|
|
29
32
|
|
|
33
|
+
type LoggerFn = (...args: any[]) => void;
|
|
34
|
+
|
|
35
|
+
interface Logger {
|
|
36
|
+
log: LoggerFn;
|
|
37
|
+
warn: LoggerFn;
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
export class EasJsonReader {
|
|
41
|
+
private static log?: Logger;
|
|
42
|
+
|
|
31
43
|
public static formatEasJsonPath(projectDir: string): string {
|
|
32
44
|
return path.join(projectDir, 'eas.json');
|
|
33
45
|
}
|
|
34
46
|
|
|
47
|
+
public static setLog(log: Logger): void {
|
|
48
|
+
this.log = log;
|
|
49
|
+
}
|
|
50
|
+
|
|
35
51
|
constructor(private projectDir: string) {}
|
|
36
52
|
|
|
37
53
|
public async getBuildProfileNamesAsync(): Promise<string[]> {
|
|
@@ -39,6 +55,29 @@ export class EasJsonReader {
|
|
|
39
55
|
return Object.keys(easJson?.build ?? {});
|
|
40
56
|
}
|
|
41
57
|
|
|
58
|
+
public async getCliConfigAsync(): Promise<CliConfig | null> {
|
|
59
|
+
try {
|
|
60
|
+
const easJson = await this.readRawAsync();
|
|
61
|
+
if (!easJson.cli) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const { value, error } = CliConfigSchema.validate(easJson.cli, {
|
|
65
|
+
allowUnknown: false,
|
|
66
|
+
convert: true,
|
|
67
|
+
abortEarly: false,
|
|
68
|
+
});
|
|
69
|
+
if (error) {
|
|
70
|
+
throw new Error(`"cli" field in eas.json is not valid [${error.toString()}]`);
|
|
71
|
+
}
|
|
72
|
+
return value as CliConfig;
|
|
73
|
+
} catch (err: any) {
|
|
74
|
+
if (err.code === 'ENOENT') {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
throw err;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
42
81
|
public async getSubmitProfileNamesAsync({ throwIfEasJsonDoesNotExist = true } = {}): Promise<
|
|
43
82
|
string[]
|
|
44
83
|
> {
|
|
@@ -121,7 +160,7 @@ export class EasJsonReader {
|
|
|
121
160
|
});
|
|
122
161
|
|
|
123
162
|
if (error) {
|
|
124
|
-
throw new
|
|
163
|
+
throw new InvalidEasJsonError(`eas.json is not valid [${error.toString()}]`);
|
|
125
164
|
}
|
|
126
165
|
return value as EasJson;
|
|
127
166
|
}
|
|
@@ -132,7 +171,7 @@ export class EasJsonReader {
|
|
|
132
171
|
const rawEasJson = JsonFile.read(easJsonPath);
|
|
133
172
|
const { value, error } = MinimalEasJsonSchema.validate(rawEasJson, { abortEarly: false });
|
|
134
173
|
if (error) {
|
|
135
|
-
throw new
|
|
174
|
+
throw new InvalidEasJsonError(`eas.json is not valid [${error.toString()}]`);
|
|
136
175
|
}
|
|
137
176
|
return value;
|
|
138
177
|
} catch (err: any) {
|
package/src/EasJsonSchema.ts
CHANGED
|
@@ -107,12 +107,19 @@ const EasJsonSubmitConfigurationSchema = Joi.object({
|
|
|
107
107
|
ios: IosSubmitProfileSchema,
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
+
export const CliConfigSchema = Joi.object({
|
|
111
|
+
version: Joi.string(),
|
|
112
|
+
requireCommit: Joi.boolean(),
|
|
113
|
+
});
|
|
114
|
+
|
|
110
115
|
export const MinimalEasJsonSchema = Joi.object({
|
|
116
|
+
cli: Joi.object(),
|
|
111
117
|
build: Joi.object().pattern(Joi.string(), Joi.object()),
|
|
112
118
|
submit: Joi.object().pattern(Joi.string(), Joi.object()),
|
|
113
119
|
});
|
|
114
120
|
|
|
115
121
|
export const EasJsonSchema = Joi.object({
|
|
122
|
+
cli: CliConfigSchema,
|
|
116
123
|
build: Joi.object().pattern(Joi.string(), EasJsonBuildProfileSchema),
|
|
117
124
|
submit: Joi.object().pattern(Joi.string(), EasJsonSubmitConfigurationSchema),
|
|
118
125
|
});
|
package/src/errors.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export class InvalidEasJsonError extends Error {}
|
package/src/index.ts
CHANGED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Android, Cache, Ios } from '@expo/eas-build-job';
|
|
2
|
-
export declare enum CredentialsSource {
|
|
3
|
-
LOCAL = "local",
|
|
4
|
-
REMOTE = "remote"
|
|
5
|
-
}
|
|
6
|
-
export declare type AndroidDistributionType = 'store' | 'internal';
|
|
7
|
-
export declare type IosDistributionType = 'store' | 'internal' | 'simulator';
|
|
8
|
-
export declare type DistributionType = AndroidDistributionType | IosDistributionType;
|
|
9
|
-
export declare type IosEnterpriseProvisioning = 'adhoc' | 'universal';
|
|
10
|
-
export declare type VersionAutoIncrement = boolean | 'version' | 'buildNumber';
|
|
11
|
-
interface IosBuilderEnvironment extends Omit<Ios.BuilderEnvironment, 'image'> {
|
|
12
|
-
image?: Ios.BuilderEnvironment['image'];
|
|
13
|
-
}
|
|
14
|
-
export interface AndroidBuildProfile extends Android.BuilderEnvironment {
|
|
15
|
-
credentialsSource: CredentialsSource;
|
|
16
|
-
releaseChannel?: string;
|
|
17
|
-
channel?: string;
|
|
18
|
-
distribution: AndroidDistributionType;
|
|
19
|
-
cache: Cache;
|
|
20
|
-
withoutCredentials?: boolean;
|
|
21
|
-
buildType?: Android.BuildType;
|
|
22
|
-
gradleCommand?: string;
|
|
23
|
-
artifactPath?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface IosBuildProfile extends IosBuilderEnvironment {
|
|
26
|
-
credentialsSource: CredentialsSource;
|
|
27
|
-
releaseChannel?: string;
|
|
28
|
-
channel?: string;
|
|
29
|
-
distribution: IosDistributionType;
|
|
30
|
-
enterpriseProvisioning?: IosEnterpriseProvisioning;
|
|
31
|
-
autoIncrement: VersionAutoIncrement;
|
|
32
|
-
cache: Cache;
|
|
33
|
-
artifactPath?: string;
|
|
34
|
-
scheme?: string;
|
|
35
|
-
schemeBuildConfiguration?: string;
|
|
36
|
-
buildType?: Ios.BuildType;
|
|
37
|
-
}
|
|
38
|
-
export declare type BuildProfile = AndroidBuildProfile | IosBuildProfile;
|
|
39
|
-
export interface EasConfig {
|
|
40
|
-
builds: {
|
|
41
|
-
android?: AndroidBuildProfile;
|
|
42
|
-
ios?: IosBuildProfile;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CredentialsSource = void 0;
|
|
4
|
-
var CredentialsSource;
|
|
5
|
-
(function (CredentialsSource) {
|
|
6
|
-
CredentialsSource["LOCAL"] = "local";
|
|
7
|
-
CredentialsSource["REMOTE"] = "remote";
|
|
8
|
-
})(CredentialsSource = exports.CredentialsSource || (exports.CredentialsSource = {}));
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Workflow } from '@expo/eas-build-job';
|
|
2
|
-
import { EasConfig } from './DeprecatedConfig.types';
|
|
3
|
-
export interface EasJson {
|
|
4
|
-
builds: {
|
|
5
|
-
android?: {
|
|
6
|
-
[key: string]: BuildProfilePreValidation;
|
|
7
|
-
};
|
|
8
|
-
ios?: {
|
|
9
|
-
[key: string]: BuildProfilePreValidation;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
interface BuildProfilePreValidation {
|
|
14
|
-
workflow?: Workflow;
|
|
15
|
-
extends?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare class EasJsonReader {
|
|
18
|
-
private projectDir;
|
|
19
|
-
private platform;
|
|
20
|
-
constructor(projectDir: string, platform: 'android' | 'ios' | 'all');
|
|
21
|
-
/**
|
|
22
|
-
* Return build profile names for a particular platform.
|
|
23
|
-
* If platform is 'all', return common build profiles for all platforms
|
|
24
|
-
*/
|
|
25
|
-
getBuildProfileNamesAsync(): Promise<string[]>;
|
|
26
|
-
readAsync(buildProfileName: string): Promise<EasConfig>;
|
|
27
|
-
validateAsync(): Promise<void>;
|
|
28
|
-
readRawAsync(): Promise<EasJson>;
|
|
29
|
-
private validateBuildProfile;
|
|
30
|
-
private resolveBuildProfile;
|
|
31
|
-
}
|
|
32
|
-
export declare function deepMerge(base: Record<string, any>, update: Record<string, any>): Record<string, any>;
|
|
33
|
-
export {};
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deepMerge = exports.EasJsonReader = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
6
|
-
const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
|
|
7
|
-
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
8
|
-
const DeprecatedEasJsonSchema_1 = require("./DeprecatedEasJsonSchema");
|
|
9
|
-
function intersect(setA, setB) {
|
|
10
|
-
return new Set([...setA].filter(i => setB.has(i)));
|
|
11
|
-
}
|
|
12
|
-
class EasJsonReader {
|
|
13
|
-
constructor(projectDir, platform) {
|
|
14
|
-
this.projectDir = projectDir;
|
|
15
|
-
this.platform = platform;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Return build profile names for a particular platform.
|
|
19
|
-
* If platform is 'all', return common build profiles for all platforms
|
|
20
|
-
*/
|
|
21
|
-
async getBuildProfileNamesAsync() {
|
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
23
|
-
const easJson = await this.readRawAsync();
|
|
24
|
-
if (this.platform === 'android') {
|
|
25
|
-
return Object.keys((_b = (_a = easJson === null || easJson === void 0 ? void 0 : easJson.builds) === null || _a === void 0 ? void 0 : _a.android) !== null && _b !== void 0 ? _b : {});
|
|
26
|
-
}
|
|
27
|
-
else if (this.platform === 'ios') {
|
|
28
|
-
return Object.keys((_d = (_c = easJson === null || easJson === void 0 ? void 0 : easJson.builds) === null || _c === void 0 ? void 0 : _c.ios) !== null && _d !== void 0 ? _d : {});
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
const intersectingProfileNames = intersect(new Set(Object.keys((_f = (_e = easJson === null || easJson === void 0 ? void 0 : easJson.builds) === null || _e === void 0 ? void 0 : _e.ios) !== null && _f !== void 0 ? _f : {})), new Set(Object.keys((_h = (_g = easJson === null || easJson === void 0 ? void 0 : easJson.builds) === null || _g === void 0 ? void 0 : _g.android) !== null && _h !== void 0 ? _h : {})));
|
|
32
|
-
return Array.from(intersectingProfileNames);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
async readAsync(buildProfileName) {
|
|
36
|
-
var _a, _b;
|
|
37
|
-
const easJson = await this.readRawAsync();
|
|
38
|
-
let androidConfig;
|
|
39
|
-
if (['android', 'all'].includes(this.platform)) {
|
|
40
|
-
androidConfig = this.validateBuildProfile(eas_build_job_1.Platform.ANDROID, buildProfileName, ((_a = easJson.builds) === null || _a === void 0 ? void 0 : _a.android) || {});
|
|
41
|
-
}
|
|
42
|
-
let iosConfig;
|
|
43
|
-
if (['ios', 'all'].includes(this.platform)) {
|
|
44
|
-
iosConfig = this.validateBuildProfile(eas_build_job_1.Platform.IOS, buildProfileName, ((_b = easJson.builds) === null || _b === void 0 ? void 0 : _b.ios) || {});
|
|
45
|
-
}
|
|
46
|
-
return {
|
|
47
|
-
builds: {
|
|
48
|
-
...(androidConfig ? { android: androidConfig } : {}),
|
|
49
|
-
...(iosConfig ? { ios: iosConfig } : {}),
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
async validateAsync() {
|
|
54
|
-
var _a, _b, _c, _d;
|
|
55
|
-
const easJson = await this.readRawAsync();
|
|
56
|
-
const androidProfiles = (_b = (_a = easJson.builds) === null || _a === void 0 ? void 0 : _a.android) !== null && _b !== void 0 ? _b : {};
|
|
57
|
-
for (const name of Object.keys(androidProfiles)) {
|
|
58
|
-
try {
|
|
59
|
-
this.validateBuildProfile(eas_build_job_1.Platform.ANDROID, name, androidProfiles);
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
err.message = `Failed to validate Android build profile "${name}"\n${err.message}`;
|
|
63
|
-
throw err;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const iosProfiles = (_d = (_c = easJson.builds) === null || _c === void 0 ? void 0 : _c.ios) !== null && _d !== void 0 ? _d : {};
|
|
67
|
-
for (const name of Object.keys(iosProfiles)) {
|
|
68
|
-
try {
|
|
69
|
-
this.validateBuildProfile(eas_build_job_1.Platform.IOS, name, iosProfiles);
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
err.message = `Failed to validate iOS build profile "${name}"\n${err.message}`;
|
|
73
|
-
throw err;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
async readRawAsync() {
|
|
78
|
-
const rawFile = await fs_extra_1.default.readFile(path_1.default.join(this.projectDir, 'eas.json'), 'utf8');
|
|
79
|
-
const json = JSON.parse(rawFile);
|
|
80
|
-
const { value, error } = DeprecatedEasJsonSchema_1.EasJsonSchema.validate(json, {
|
|
81
|
-
abortEarly: false,
|
|
82
|
-
});
|
|
83
|
-
if (error) {
|
|
84
|
-
throw new Error(`eas.json is not valid [${error.toString()}]`);
|
|
85
|
-
}
|
|
86
|
-
return value;
|
|
87
|
-
}
|
|
88
|
-
validateBuildProfile(platform, buildProfileName, buildProfiles) {
|
|
89
|
-
const buildProfile = this.resolveBuildProfile(platform, buildProfileName, buildProfiles);
|
|
90
|
-
const schema = DeprecatedEasJsonSchema_1.schemaBuildProfileMap[platform];
|
|
91
|
-
const { value, error } = schema.validate(buildProfile, {
|
|
92
|
-
stripUnknown: true,
|
|
93
|
-
convert: true,
|
|
94
|
-
abortEarly: false,
|
|
95
|
-
});
|
|
96
|
-
if (error) {
|
|
97
|
-
throw new Error(`Object "${platform}.${buildProfileName}" in eas.json is not valid [${error.toString()}]`);
|
|
98
|
-
}
|
|
99
|
-
return value;
|
|
100
|
-
}
|
|
101
|
-
resolveBuildProfile(platform, buildProfileName, buildProfiles, depth = 0) {
|
|
102
|
-
if (depth >= 2) {
|
|
103
|
-
throw new Error('Too long chain of build profile extensions, make sure "extends" keys do not make a cycle');
|
|
104
|
-
}
|
|
105
|
-
const buildProfile = buildProfiles[buildProfileName];
|
|
106
|
-
if (!buildProfile) {
|
|
107
|
-
throw new Error(`There is no profile named ${buildProfileName} for platform ${platform}`);
|
|
108
|
-
}
|
|
109
|
-
const { extends: baseProfileName, ...buildProfileRest } = buildProfile;
|
|
110
|
-
if (baseProfileName) {
|
|
111
|
-
return deepMerge(this.resolveBuildProfile(platform, baseProfileName, buildProfiles, depth + 1), buildProfileRest);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
return buildProfileRest;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
exports.EasJsonReader = EasJsonReader;
|
|
119
|
-
function isObject(value) {
|
|
120
|
-
return typeof value === 'object' && value !== null;
|
|
121
|
-
}
|
|
122
|
-
function deepMerge(base, update) {
|
|
123
|
-
const result = {};
|
|
124
|
-
Object.keys(base).forEach(key => {
|
|
125
|
-
const oldValue = base[key];
|
|
126
|
-
const newValue = update[key];
|
|
127
|
-
if (isObject(newValue) && isObject(oldValue)) {
|
|
128
|
-
result[key] = deepMerge(oldValue, newValue);
|
|
129
|
-
}
|
|
130
|
-
else if (newValue !== undefined) {
|
|
131
|
-
result[key] = isObject(newValue) ? deepMerge({}, newValue) : newValue;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
result[key] = isObject(oldValue) ? deepMerge({}, oldValue) : oldValue;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
Object.keys(update).forEach(key => {
|
|
138
|
-
const newValue = update[key];
|
|
139
|
-
if (result[key] === undefined) {
|
|
140
|
-
result[key] = isObject(newValue) ? deepMerge({}, newValue) : newValue;
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
return result;
|
|
144
|
-
}
|
|
145
|
-
exports.deepMerge = deepMerge;
|