@expo/eas-json 0.35.0 → 0.38.2
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/build/resolver.d.ts +8 -0
- package/build/build/resolver.js +67 -0
- package/build/build/schema.d.ts +2 -0
- package/build/{EasJsonSchema.js → build/schema.js} +18 -55
- package/build/{EasBuild.types.d.ts → build/types.d.ts} +6 -1
- package/build/{EasJson.types.js → build/types.js} +0 -0
- package/build/errors.d.ts +6 -0
- package/build/errors.js +10 -1
- package/build/index.d.ts +5 -4
- package/build/index.js +10 -8
- package/build/reader.d.ts +15 -0
- package/build/reader.js +75 -0
- package/build/schema.d.ts +2 -0
- package/build/schema.js +15 -0
- package/build/submit/resolver.d.ts +9 -0
- package/build/submit/resolver.js +72 -0
- package/build/submit/schema.d.ts +4 -0
- package/build/submit/schema.js +35 -0
- package/build/{EasSubmit.types.d.ts → submit/types.d.ts} +8 -1
- package/build/{EasSubmit.types.js → submit/types.js} +1 -0
- package/build/types.d.ts +20 -0
- package/build/{EasBuild.types.js → types.js} +0 -0
- package/package.json +2 -2
- package/src/__tests__/{EasJsonReader-build-test.ts → reader-build-test.ts} +60 -48
- package/src/__tests__/{EasJsonReader-submit-test.ts → reader-submit-test.ts} +49 -7
- package/src/build/resolver.ts +97 -0
- package/src/{EasJsonSchema.ts → build/schema.ts} +16 -60
- package/src/{EasBuild.types.ts → build/types.ts} +7 -5
- package/src/errors.ts +6 -0
- package/src/index.ts +6 -13
- package/src/reader.ts +87 -0
- package/src/schema.ts +13 -0
- package/src/submit/resolver.ts +114 -0
- package/src/submit/schema.ts +35 -0
- package/src/{EasSubmit.types.ts → submit/types.ts} +9 -7
- package/src/types.ts +21 -0
- package/build/EasJson.types.d.ts +0 -29
- package/build/EasJsonReader.d.ts +0 -39
- package/build/EasJsonReader.js +0 -204
- package/build/EasJsonSchema.d.ts +0 -6
- package/src/EasJson.types.ts +0 -31
- package/src/EasJsonReader.ts +0 -259
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Platform } from '@expo/eas-build-job';
|
|
2
|
+
import { EasJson } from '../types';
|
|
3
|
+
import { BuildProfile } from './types';
|
|
4
|
+
export declare function resolveBuildProfile<T extends Platform>({ easJson, platform, profileName, }: {
|
|
5
|
+
easJson: EasJson;
|
|
6
|
+
platform: T;
|
|
7
|
+
profileName: string;
|
|
8
|
+
}): BuildProfile<T>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveBuildProfile = void 0;
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
|
+
const schema_1 = require("./schema");
|
|
6
|
+
function resolveBuildProfile({ easJson, platform, profileName, }) {
|
|
7
|
+
var _a;
|
|
8
|
+
const easJsonProfile = resolveProfile({
|
|
9
|
+
easJson,
|
|
10
|
+
profileName,
|
|
11
|
+
});
|
|
12
|
+
const { android, ios, ...base } = easJsonProfile;
|
|
13
|
+
const withoutDefaults = mergeProfiles(base, (_a = easJsonProfile[platform]) !== null && _a !== void 0 ? _a : {});
|
|
14
|
+
return mergeProfiles(getDefaultProfile(platform), withoutDefaults);
|
|
15
|
+
}
|
|
16
|
+
exports.resolveBuildProfile = resolveBuildProfile;
|
|
17
|
+
function resolveProfile({ easJson, profileName, depth = 0, }) {
|
|
18
|
+
var _a;
|
|
19
|
+
if (depth >= 2) {
|
|
20
|
+
throw new Error('Too long chain of profile extensions, make sure "extends" keys do not make a cycle');
|
|
21
|
+
}
|
|
22
|
+
const profile = (_a = easJson.build) === null || _a === void 0 ? void 0 : _a[profileName];
|
|
23
|
+
if (!profile) {
|
|
24
|
+
if (depth === 0) {
|
|
25
|
+
throw new errors_1.MissingProfileError(`Missing build profile in eas.json: ${profileName}`);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
throw new errors_1.MissingParentProfileError(`Extending non-existent build profile in eas.json: ${profileName}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const { extends: baseProfileName, ...rest } = profile;
|
|
32
|
+
if (baseProfileName) {
|
|
33
|
+
const baseProfile = resolveProfile({
|
|
34
|
+
easJson,
|
|
35
|
+
profileName: baseProfileName,
|
|
36
|
+
depth: depth + 1,
|
|
37
|
+
});
|
|
38
|
+
return mergeProfiles(baseProfile, rest);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return rest;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function mergeProfiles(base, update) {
|
|
45
|
+
const result = {
|
|
46
|
+
...base,
|
|
47
|
+
...update,
|
|
48
|
+
};
|
|
49
|
+
if (base.env && update.env) {
|
|
50
|
+
result.env = {
|
|
51
|
+
...base.env,
|
|
52
|
+
...update.env,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (base.android && update.android) {
|
|
56
|
+
result.android = mergeProfiles(base.android, update.android);
|
|
57
|
+
}
|
|
58
|
+
if (base.ios && update.ios) {
|
|
59
|
+
result.ios = mergeProfiles(base.ios, update.ios);
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
function getDefaultProfile(platform) {
|
|
64
|
+
const defaultProfile = schema_1.BuildProfileSchema.validate({}, { allowUnknown: false, abortEarly: false, convert: true }).value;
|
|
65
|
+
const { android, ios, ...base } = defaultProfile;
|
|
66
|
+
return mergeProfiles(base, defaultProfile[platform]);
|
|
67
|
+
}
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BuildProfileSchema = 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"));
|
|
7
|
-
const EasSubmit_types_1 = require("./EasSubmit.types");
|
|
8
|
-
const semverSchemaCheck = (value) => {
|
|
9
|
-
if (/^[0-9]+\.[0-9]+\.[0-9]+$/.test(value)) {
|
|
10
|
-
return value;
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
throw new Error(`${value} is not a valid version`);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
7
|
const CacheSchema = joi_1.default.object({
|
|
17
8
|
disabled: joi_1.default.boolean(),
|
|
18
9
|
key: joi_1.default.string().max(128),
|
|
@@ -20,11 +11,11 @@ const CacheSchema = joi_1.default.object({
|
|
|
20
11
|
customPaths: joi_1.default.array().items(joi_1.default.string()),
|
|
21
12
|
});
|
|
22
13
|
const CommonBuildProfileSchema = joi_1.default.object({
|
|
23
|
-
credentialsSource: joi_1.default.string().valid('local', 'remote'),
|
|
24
|
-
distribution: joi_1.default.string().valid('store', 'internal'),
|
|
14
|
+
credentialsSource: joi_1.default.string().valid('local', 'remote').default('remote'),
|
|
15
|
+
distribution: joi_1.default.string().valid('store', 'internal').default('store'),
|
|
25
16
|
cache: CacheSchema,
|
|
26
|
-
releaseChannel: joi_1.default.string(),
|
|
27
|
-
channel: joi_1.default.string(),
|
|
17
|
+
releaseChannel: joi_1.default.string().regex(/^[a-z\d][a-z\d._-]*$/),
|
|
18
|
+
channel: joi_1.default.string().regex(/^[a-z\d][a-z\d._-]*$/),
|
|
28
19
|
developmentClient: joi_1.default.boolean(),
|
|
29
20
|
node: joi_1.default.string().empty(null).custom(semverSchemaCheck),
|
|
30
21
|
yarn: joi_1.default.string().empty(null).custom(semverSchemaCheck),
|
|
@@ -32,6 +23,8 @@ const CommonBuildProfileSchema = joi_1.default.object({
|
|
|
32
23
|
env: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.string().empty(null)),
|
|
33
24
|
});
|
|
34
25
|
const AndroidBuildProfileSchema = CommonBuildProfileSchema.concat(joi_1.default.object({
|
|
26
|
+
credentialsSource: joi_1.default.string().valid('local', 'remote'),
|
|
27
|
+
distribution: joi_1.default.string().valid('store', 'internal'),
|
|
35
28
|
withoutCredentials: joi_1.default.boolean(),
|
|
36
29
|
image: joi_1.default.string().valid(...eas_build_job_1.Android.builderBaseImages),
|
|
37
30
|
ndk: joi_1.default.string().empty(null).custom(semverSchemaCheck),
|
|
@@ -41,6 +34,8 @@ const AndroidBuildProfileSchema = CommonBuildProfileSchema.concat(joi_1.default.
|
|
|
41
34
|
buildType: joi_1.default.string().valid('apk', 'app-bundle'),
|
|
42
35
|
}));
|
|
43
36
|
const IosBuildProfileSchema = CommonBuildProfileSchema.concat(joi_1.default.object({
|
|
37
|
+
credentialsSource: joi_1.default.string().valid('local', 'remote'),
|
|
38
|
+
distribution: joi_1.default.string().valid('store', 'internal'),
|
|
44
39
|
enterpriseProvisioning: joi_1.default.string().valid('adhoc', 'universal'),
|
|
45
40
|
autoIncrement: joi_1.default.alternatives().try(joi_1.default.boolean(), joi_1.default.string().valid('version', 'buildNumber')),
|
|
46
41
|
simulator: joi_1.default.boolean(),
|
|
@@ -52,48 +47,16 @@ const IosBuildProfileSchema = CommonBuildProfileSchema.concat(joi_1.default.obje
|
|
|
52
47
|
scheme: joi_1.default.string(),
|
|
53
48
|
buildConfiguration: joi_1.default.string(),
|
|
54
49
|
}));
|
|
55
|
-
|
|
50
|
+
exports.BuildProfileSchema = CommonBuildProfileSchema.concat(joi_1.default.object({
|
|
56
51
|
extends: joi_1.default.string(),
|
|
57
52
|
android: AndroidBuildProfileSchema,
|
|
58
53
|
ios: IosBuildProfileSchema,
|
|
59
54
|
}));
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
changesNotSentForReview: joi_1.default.boolean().default(false),
|
|
69
|
-
});
|
|
70
|
-
exports.IosSubmitProfileSchema = joi_1.default.object({
|
|
71
|
-
ascApiKeyPath: joi_1.default.string(),
|
|
72
|
-
ascApiKeyId: joi_1.default.string(),
|
|
73
|
-
ascApiKeyIssuerId: joi_1.default.string(),
|
|
74
|
-
appleId: joi_1.default.string(),
|
|
75
|
-
ascAppId: joi_1.default.string(),
|
|
76
|
-
appleTeamId: joi_1.default.string(),
|
|
77
|
-
sku: joi_1.default.string(),
|
|
78
|
-
language: joi_1.default.string().default('en-US'),
|
|
79
|
-
companyName: joi_1.default.string(),
|
|
80
|
-
appName: joi_1.default.string(),
|
|
81
|
-
});
|
|
82
|
-
const EasJsonSubmitConfigurationSchema = joi_1.default.object({
|
|
83
|
-
android: exports.AndroidSubmitProfileSchema,
|
|
84
|
-
ios: exports.IosSubmitProfileSchema,
|
|
85
|
-
});
|
|
86
|
-
exports.CliConfigSchema = joi_1.default.object({
|
|
87
|
-
version: joi_1.default.string(),
|
|
88
|
-
requireCommit: joi_1.default.boolean(),
|
|
89
|
-
});
|
|
90
|
-
exports.MinimalEasJsonSchema = joi_1.default.object({
|
|
91
|
-
cli: joi_1.default.object(),
|
|
92
|
-
build: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.object()),
|
|
93
|
-
submit: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.object()),
|
|
94
|
-
});
|
|
95
|
-
exports.EasJsonSchema = joi_1.default.object({
|
|
96
|
-
cli: exports.CliConfigSchema,
|
|
97
|
-
build: joi_1.default.object().pattern(joi_1.default.string(), EasJsonBuildProfileSchema),
|
|
98
|
-
submit: joi_1.default.object().pattern(joi_1.default.string(), EasJsonSubmitConfigurationSchema),
|
|
99
|
-
});
|
|
55
|
+
function semverSchemaCheck(value) {
|
|
56
|
+
if (/^[0-9]+\.[0-9]+\.[0-9]+$/.test(value)) {
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
throw new Error(`${value} is not a valid version`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -41,4 +41,9 @@ export interface IosBuildProfile extends CommonBuildProfile {
|
|
|
41
41
|
scheme?: string;
|
|
42
42
|
buildConfiguration?: string;
|
|
43
43
|
}
|
|
44
|
-
export declare type BuildProfile<TPlatform extends Platform = Platform> = TPlatform extends Platform.ANDROID ? AndroidBuildProfile :
|
|
44
|
+
export declare type BuildProfile<TPlatform extends Platform = Platform> = TPlatform extends Platform.ANDROID ? AndroidBuildProfile : IosBuildProfile;
|
|
45
|
+
export interface EasJsonBuildProfile extends Partial<CommonBuildProfile> {
|
|
46
|
+
extends?: string;
|
|
47
|
+
[Platform.ANDROID]?: Partial<AndroidBuildProfile>;
|
|
48
|
+
[Platform.IOS]?: Partial<IosBuildProfile>;
|
|
49
|
+
}
|
|
File without changes
|
package/build/errors.d.ts
CHANGED
package/build/errors.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvalidEasJsonError = void 0;
|
|
3
|
+
exports.MissingParentProfileError = exports.MissingProfileError = exports.MissingEasJsonError = exports.InvalidEasJsonError = void 0;
|
|
4
4
|
class InvalidEasJsonError extends Error {
|
|
5
5
|
}
|
|
6
6
|
exports.InvalidEasJsonError = InvalidEasJsonError;
|
|
7
|
+
class MissingEasJsonError extends Error {
|
|
8
|
+
}
|
|
9
|
+
exports.MissingEasJsonError = MissingEasJsonError;
|
|
10
|
+
class MissingProfileError extends Error {
|
|
11
|
+
}
|
|
12
|
+
exports.MissingProfileError = MissingProfileError;
|
|
13
|
+
class MissingParentProfileError extends Error {
|
|
14
|
+
}
|
|
15
|
+
exports.MissingParentProfileError = MissingParentProfileError;
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export { AndroidReleaseStatus, AndroidReleaseTrack, SubmitProfile } from './submit/types';
|
|
2
|
+
export { getDefaultProfile as getDefaultSubmitProfile } from './submit/resolver';
|
|
3
|
+
export { EasJson, ProfileType } from './types';
|
|
4
|
+
export { AndroidVersionAutoIncrement, BuildProfile, CredentialsSource, DistributionType, IosEnterpriseProvisioning, IosVersionAutoIncrement, } from './build/types';
|
|
5
|
+
export { EasJsonReader } from './reader';
|
|
5
6
|
export * as errors from './errors';
|
package/build/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.errors = exports.EasJsonReader = exports.CredentialsSource = exports.AndroidReleaseTrack = exports.AndroidReleaseStatus = void 0;
|
|
3
|
+
exports.errors = exports.EasJsonReader = exports.CredentialsSource = exports.getDefaultSubmitProfile = exports.AndroidReleaseTrack = exports.AndroidReleaseStatus = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
var
|
|
6
|
-
Object.defineProperty(exports, "AndroidReleaseStatus", { enumerable: true, get: function () { return
|
|
7
|
-
Object.defineProperty(exports, "AndroidReleaseTrack", { enumerable: true, get: function () { return
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "
|
|
10
|
-
var
|
|
11
|
-
Object.defineProperty(exports, "
|
|
5
|
+
var types_1 = require("./submit/types");
|
|
6
|
+
Object.defineProperty(exports, "AndroidReleaseStatus", { enumerable: true, get: function () { return types_1.AndroidReleaseStatus; } });
|
|
7
|
+
Object.defineProperty(exports, "AndroidReleaseTrack", { enumerable: true, get: function () { return types_1.AndroidReleaseTrack; } });
|
|
8
|
+
var resolver_1 = require("./submit/resolver");
|
|
9
|
+
Object.defineProperty(exports, "getDefaultSubmitProfile", { enumerable: true, get: function () { return resolver_1.getDefaultProfile; } });
|
|
10
|
+
var types_2 = require("./build/types");
|
|
11
|
+
Object.defineProperty(exports, "CredentialsSource", { enumerable: true, get: function () { return types_2.CredentialsSource; } });
|
|
12
|
+
var reader_1 = require("./reader");
|
|
13
|
+
Object.defineProperty(exports, "EasJsonReader", { enumerable: true, get: function () { return reader_1.EasJsonReader; } });
|
|
12
14
|
exports.errors = (0, tslib_1.__importStar)(require("./errors"));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Platform } from '@expo/eas-build-job';
|
|
2
|
+
import { BuildProfile } from './build/types';
|
|
3
|
+
import { SubmitProfile } from './submit/types';
|
|
4
|
+
import { EasJson } from './types';
|
|
5
|
+
export declare class EasJsonReader {
|
|
6
|
+
private projectDir;
|
|
7
|
+
private easJson;
|
|
8
|
+
constructor(projectDir: string);
|
|
9
|
+
static formatEasJsonPath(projectDir: string): string;
|
|
10
|
+
readAsync(): Promise<EasJson>;
|
|
11
|
+
getBuildProfileNamesAsync(): Promise<string[]>;
|
|
12
|
+
getBuildProfileAsync<T extends Platform>(platform: T, profileName: string): Promise<BuildProfile<T>>;
|
|
13
|
+
getCliConfigAsync(): Promise<EasJson['cli'] | null>;
|
|
14
|
+
getSubmitProfileAsync<T extends Platform>(platform: T, profileName: string): Promise<SubmitProfile<T>>;
|
|
15
|
+
}
|
package/build/reader.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EasJsonReader = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const json_file_1 = (0, tslib_1.__importDefault)(require("@expo/json-file"));
|
|
6
|
+
const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
|
|
7
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
8
|
+
const resolver_1 = require("./build/resolver");
|
|
9
|
+
const errors_1 = require("./errors");
|
|
10
|
+
const schema_1 = require("./schema");
|
|
11
|
+
const resolver_2 = require("./submit/resolver");
|
|
12
|
+
class EasJsonReader {
|
|
13
|
+
constructor(projectDir) {
|
|
14
|
+
this.projectDir = projectDir;
|
|
15
|
+
}
|
|
16
|
+
static formatEasJsonPath(projectDir) {
|
|
17
|
+
return path_1.default.join(projectDir, 'eas.json');
|
|
18
|
+
}
|
|
19
|
+
async readAsync() {
|
|
20
|
+
if (this.easJson) {
|
|
21
|
+
return this.easJson;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const easJsonPath = EasJsonReader.formatEasJsonPath(this.projectDir);
|
|
25
|
+
if (!(await fs_extra_1.default.pathExists(easJsonPath))) {
|
|
26
|
+
throw new errors_1.MissingEasJsonError(`eas.json could not be found at ${easJsonPath}. Learn more at https://expo.fyi/eas-json`);
|
|
27
|
+
}
|
|
28
|
+
const contents = json_file_1.default.read(easJsonPath);
|
|
29
|
+
const { value, error } = schema_1.EasJsonSchema.validate(contents, {
|
|
30
|
+
allowUnknown: false,
|
|
31
|
+
abortEarly: false,
|
|
32
|
+
convert: true,
|
|
33
|
+
noDefaults: true,
|
|
34
|
+
});
|
|
35
|
+
if (error) {
|
|
36
|
+
throw new errors_1.InvalidEasJsonError(`eas.json is not valid [${error.toString()}]`);
|
|
37
|
+
}
|
|
38
|
+
this.easJson = value;
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
if (err.code === 'EJSONPARSE') {
|
|
43
|
+
err.message = `Found invalid JSON in eas.json. ${err.message}`;
|
|
44
|
+
}
|
|
45
|
+
throw err;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async getBuildProfileNamesAsync() {
|
|
49
|
+
var _a;
|
|
50
|
+
const easJson = await this.readAsync();
|
|
51
|
+
return Object.keys((_a = easJson === null || easJson === void 0 ? void 0 : easJson.build) !== null && _a !== void 0 ? _a : {});
|
|
52
|
+
}
|
|
53
|
+
async getBuildProfileAsync(platform, profileName) {
|
|
54
|
+
const easJson = await this.readAsync();
|
|
55
|
+
return (0, resolver_1.resolveBuildProfile)({ easJson, platform, profileName });
|
|
56
|
+
}
|
|
57
|
+
async getCliConfigAsync() {
|
|
58
|
+
var _a;
|
|
59
|
+
try {
|
|
60
|
+
const easJson = await this.readAsync();
|
|
61
|
+
return (_a = easJson.cli) !== null && _a !== void 0 ? _a : null;
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
if (err instanceof errors_1.MissingEasJsonError) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async getSubmitProfileAsync(platform, profileName) {
|
|
71
|
+
const easJson = await this.readAsync();
|
|
72
|
+
return (0, resolver_2.resolveSubmitProfile)({ easJson, platform, profileName });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.EasJsonReader = EasJsonReader;
|
package/build/schema.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EasJsonSchema = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const joi_1 = (0, tslib_1.__importDefault)(require("joi"));
|
|
6
|
+
const schema_1 = require("./build/schema");
|
|
7
|
+
const schema_2 = require("./submit/schema");
|
|
8
|
+
exports.EasJsonSchema = joi_1.default.object({
|
|
9
|
+
cli: joi_1.default.object({
|
|
10
|
+
version: joi_1.default.string(),
|
|
11
|
+
requireCommit: joi_1.default.boolean(),
|
|
12
|
+
}),
|
|
13
|
+
build: joi_1.default.object().pattern(joi_1.default.string(), schema_1.BuildProfileSchema),
|
|
14
|
+
submit: joi_1.default.object().pattern(joi_1.default.string(), schema_2.SubmitProfileSchema),
|
|
15
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Platform } from '@expo/eas-build-job';
|
|
2
|
+
import { EasJson } from '../types';
|
|
3
|
+
import { SubmitProfile } from './types';
|
|
4
|
+
export declare function resolveSubmitProfile<T extends Platform>({ easJson, platform, profileName, }: {
|
|
5
|
+
easJson: EasJson;
|
|
6
|
+
platform: T;
|
|
7
|
+
profileName: string;
|
|
8
|
+
}): SubmitProfile<T>;
|
|
9
|
+
export declare function getDefaultProfile<T extends Platform>(platform: T): SubmitProfile<T>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultProfile = exports.resolveSubmitProfile = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
6
|
+
const env_string_1 = (0, tslib_1.__importDefault)(require("env-string"));
|
|
7
|
+
const errors_1 = require("../errors");
|
|
8
|
+
const schema_1 = require("./schema");
|
|
9
|
+
const types_1 = require("./types");
|
|
10
|
+
function resolveSubmitProfile({ easJson, platform, profileName, }) {
|
|
11
|
+
const submitProfile = resolveProfile({
|
|
12
|
+
easJson,
|
|
13
|
+
platform,
|
|
14
|
+
profileName,
|
|
15
|
+
});
|
|
16
|
+
const unevaluatedProfile = mergeProfiles(getDefaultProfile(platform), submitProfile);
|
|
17
|
+
return evaluateFields(platform, unevaluatedProfile);
|
|
18
|
+
}
|
|
19
|
+
exports.resolveSubmitProfile = resolveSubmitProfile;
|
|
20
|
+
function resolveProfile({ easJson, profileName, depth = 0, platform, }) {
|
|
21
|
+
var _a;
|
|
22
|
+
if (depth >= 2) {
|
|
23
|
+
throw new Error('Too long chain of profile extensions, make sure "extends" keys do not make a cycle');
|
|
24
|
+
}
|
|
25
|
+
const profile = (_a = easJson.submit) === null || _a === void 0 ? void 0 : _a[profileName];
|
|
26
|
+
if (!profile) {
|
|
27
|
+
if (depth === 0) {
|
|
28
|
+
throw new errors_1.MissingProfileError(`There is no submit profile named ${profileName} in eas.json`);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
throw new errors_1.MissingParentProfileError(`Extending non-existent submit profile in eas.json: ${profileName}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const { extends: baseProfileName, ...rest } = profile;
|
|
35
|
+
const platformProfile = rest[platform];
|
|
36
|
+
if (baseProfileName) {
|
|
37
|
+
const baseProfile = resolveProfile({
|
|
38
|
+
easJson,
|
|
39
|
+
platform,
|
|
40
|
+
profileName: baseProfileName,
|
|
41
|
+
depth: depth + 1,
|
|
42
|
+
});
|
|
43
|
+
return mergeProfiles(baseProfile, platformProfile);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return platformProfile;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function mergeProfiles(base, update) {
|
|
50
|
+
if (!update) {
|
|
51
|
+
return base;
|
|
52
|
+
}
|
|
53
|
+
return { ...base, ...update };
|
|
54
|
+
}
|
|
55
|
+
function getDefaultProfile(platform) {
|
|
56
|
+
const Schema = platform === eas_build_job_1.Platform.ANDROID ? schema_1.AndroidSubmitProfileSchema : schema_1.IosSubmitProfileSchema;
|
|
57
|
+
return Schema.validate({}, { allowUnknown: false, abortEarly: false, convert: true }).value;
|
|
58
|
+
}
|
|
59
|
+
exports.getDefaultProfile = getDefaultProfile;
|
|
60
|
+
function evaluateFields(platform, profile) {
|
|
61
|
+
const fields = platform === eas_build_job_1.Platform.ANDROID
|
|
62
|
+
? types_1.AndroidSubmitProfileFieldsToEvaluate
|
|
63
|
+
: types_1.IosSubmitProfileFieldsToEvaluate;
|
|
64
|
+
const evaluatedProfile = { ...profile };
|
|
65
|
+
for (const field of fields) {
|
|
66
|
+
if (field in evaluatedProfile) {
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
evaluatedProfile[field] = (0, env_string_1.default)(evaluatedProfile[field], process.env);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return evaluatedProfile;
|
|
72
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubmitProfileSchema = exports.IosSubmitProfileSchema = exports.AndroidSubmitProfileSchema = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const joi_1 = (0, tslib_1.__importDefault)(require("joi"));
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
exports.AndroidSubmitProfileSchema = joi_1.default.object({
|
|
8
|
+
serviceAccountKeyPath: joi_1.default.string(),
|
|
9
|
+
track: joi_1.default.string()
|
|
10
|
+
.valid(...Object.values(types_1.AndroidReleaseTrack))
|
|
11
|
+
.default(types_1.AndroidReleaseTrack.internal),
|
|
12
|
+
releaseStatus: joi_1.default.string()
|
|
13
|
+
.valid(...Object.values(types_1.AndroidReleaseStatus))
|
|
14
|
+
.default(types_1.AndroidReleaseStatus.completed),
|
|
15
|
+
changesNotSentForReview: joi_1.default.boolean().default(false),
|
|
16
|
+
applicationId: joi_1.default.string(),
|
|
17
|
+
});
|
|
18
|
+
exports.IosSubmitProfileSchema = joi_1.default.object({
|
|
19
|
+
ascApiKeyPath: joi_1.default.string(),
|
|
20
|
+
ascApiKeyId: joi_1.default.string(),
|
|
21
|
+
ascApiKeyIssuerId: joi_1.default.string(),
|
|
22
|
+
appleId: joi_1.default.string(),
|
|
23
|
+
ascAppId: joi_1.default.string(),
|
|
24
|
+
appleTeamId: joi_1.default.string(),
|
|
25
|
+
sku: joi_1.default.string(),
|
|
26
|
+
language: joi_1.default.string().default('en-US'),
|
|
27
|
+
companyName: joi_1.default.string(),
|
|
28
|
+
appName: joi_1.default.string(),
|
|
29
|
+
bundleIdentifier: joi_1.default.string(),
|
|
30
|
+
});
|
|
31
|
+
exports.SubmitProfileSchema = joi_1.default.object({
|
|
32
|
+
extends: joi_1.default.string(),
|
|
33
|
+
android: exports.AndroidSubmitProfileSchema,
|
|
34
|
+
ios: exports.IosSubmitProfileSchema,
|
|
35
|
+
});
|
|
@@ -16,6 +16,7 @@ export interface AndroidSubmitProfile {
|
|
|
16
16
|
track: AndroidReleaseTrack;
|
|
17
17
|
releaseStatus: AndroidReleaseStatus;
|
|
18
18
|
changesNotSentForReview: boolean;
|
|
19
|
+
applicationId?: string;
|
|
19
20
|
}
|
|
20
21
|
export declare const AndroidSubmitProfileFieldsToEvaluate: (keyof AndroidSubmitProfile)[];
|
|
21
22
|
export interface IosSubmitProfile {
|
|
@@ -29,6 +30,12 @@ export interface IosSubmitProfile {
|
|
|
29
30
|
language: string;
|
|
30
31
|
companyName?: string;
|
|
31
32
|
appName?: string;
|
|
33
|
+
bundleIdentifier?: string;
|
|
32
34
|
}
|
|
33
35
|
export declare const IosSubmitProfileFieldsToEvaluate: (keyof IosSubmitProfile)[];
|
|
34
|
-
export declare type SubmitProfile<TPlatform extends Platform = Platform> = TPlatform extends Platform.ANDROID ? AndroidSubmitProfile :
|
|
36
|
+
export declare type SubmitProfile<TPlatform extends Platform = Platform> = TPlatform extends Platform.ANDROID ? AndroidSubmitProfile : IosSubmitProfile;
|
|
37
|
+
export interface EasJsonSubmitProfile {
|
|
38
|
+
extends?: string;
|
|
39
|
+
[Platform.ANDROID]?: AndroidSubmitProfile;
|
|
40
|
+
[Platform.IOS]?: IosSubmitProfile;
|
|
41
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IosSubmitProfileFieldsToEvaluate = exports.AndroidSubmitProfileFieldsToEvaluate = exports.AndroidReleaseTrack = exports.AndroidReleaseStatus = void 0;
|
|
4
|
+
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
4
5
|
var AndroidReleaseStatus;
|
|
5
6
|
(function (AndroidReleaseStatus) {
|
|
6
7
|
AndroidReleaseStatus["completed"] = "completed";
|
package/build/types.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EasJsonBuildProfile } from './build/types';
|
|
2
|
+
import { EasJsonSubmitProfile } from './submit/types';
|
|
3
|
+
export declare type ProfileType = 'build' | 'submit';
|
|
4
|
+
export declare type EasJsonProfile<T extends ProfileType> = T extends 'build' ? EasJsonBuildProfile : EasJsonSubmitProfile;
|
|
5
|
+
export declare enum CredentialsSource {
|
|
6
|
+
LOCAL = "local",
|
|
7
|
+
REMOTE = "remote"
|
|
8
|
+
}
|
|
9
|
+
export interface EasJson {
|
|
10
|
+
cli?: {
|
|
11
|
+
version?: string;
|
|
12
|
+
requireCommit?: boolean;
|
|
13
|
+
};
|
|
14
|
+
build?: {
|
|
15
|
+
[profileName: string]: EasJsonBuildProfile;
|
|
16
|
+
};
|
|
17
|
+
submit?: {
|
|
18
|
+
[profileName: string]: EasJsonSubmitProfile;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
File without changes
|
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": "0.
|
|
4
|
+
"version": "0.38.2",
|
|
5
5
|
"author": "Expo <support@expo.dev>",
|
|
6
6
|
"bugs": "https://github.com/expo/eas-cli/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "11c194a16831d06a26545a1b4a96121532568270"
|
|
41
41
|
}
|