@expo/eas-json 0.30.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 +11 -2
- package/build/EasJsonReader.js +36 -5
- package/build/EasJsonSchema.d.ts +1 -0
- package/build/EasJsonSchema.js +10 -1
- package/build/EasSubmit.types.d.ts +3 -0
- package/build/EasSubmit.types.js +5 -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 +51 -6
- package/src/EasJsonSchema.ts +10 -0
- package/src/EasSubmit.types.ts +8 -1
- package/src/__tests__/EasJsonReader-build-test.ts +15 -15
- package/src/__tests__/EasJsonReader-submit-test.ts +54 -9
- 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,16 +11,24 @@ 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[]>;
|
|
21
30
|
readBuildProfileAsync<T extends Platform>(platform: T, profileName: string): Promise<BuildProfile<T>>;
|
|
22
|
-
readSubmitProfileAsync<T extends Platform>(platform: T,
|
|
31
|
+
readSubmitProfileAsync<T extends Platform>(platform: T, profileNameArg?: string): Promise<SubmitProfile<T>>;
|
|
23
32
|
readAndValidateAsync(): Promise<EasJson>;
|
|
24
33
|
readRawAsync(): Promise<EasJsonPreValidation>;
|
|
25
34
|
private resolveBuildProfile;
|
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 {
|
|
@@ -56,14 +83,18 @@ class EasJsonReader {
|
|
|
56
83
|
throw new Error(`Unknown platform ${platform}`);
|
|
57
84
|
}
|
|
58
85
|
}
|
|
59
|
-
async readSubmitProfileAsync(platform,
|
|
86
|
+
async readSubmitProfileAsync(platform, profileNameArg) {
|
|
60
87
|
var _a;
|
|
88
|
+
let profileName = profileNameArg;
|
|
61
89
|
if (!profileName) {
|
|
62
90
|
const profileNames = await this.getSubmitProfileNamesAsync({
|
|
63
91
|
throwIfEasJsonDoesNotExist: false,
|
|
64
92
|
});
|
|
65
|
-
if (profileNames.includes('
|
|
66
|
-
|
|
93
|
+
if (profileNames.includes('production')) {
|
|
94
|
+
profileName = 'production';
|
|
95
|
+
}
|
|
96
|
+
else if (profileNames.includes('release')) {
|
|
97
|
+
profileName = 'release';
|
|
67
98
|
}
|
|
68
99
|
else {
|
|
69
100
|
return getDefaultSubmitProfile(platform);
|
|
@@ -90,7 +121,7 @@ class EasJsonReader {
|
|
|
90
121
|
abortEarly: false,
|
|
91
122
|
});
|
|
92
123
|
if (error) {
|
|
93
|
-
throw new
|
|
124
|
+
throw new errors_1.InvalidEasJsonError(`eas.json is not valid [${error.toString()}]`);
|
|
94
125
|
}
|
|
95
126
|
return value;
|
|
96
127
|
}
|
|
@@ -100,7 +131,7 @@ class EasJsonReader {
|
|
|
100
131
|
const rawEasJson = json_file_1.default.read(easJsonPath);
|
|
101
132
|
const { value, error } = EasJsonSchema_1.MinimalEasJsonSchema.validate(rawEasJson, { abortEarly: false });
|
|
102
133
|
if (error) {
|
|
103
|
-
throw new
|
|
134
|
+
throw new errors_1.InvalidEasJsonError(`eas.json is not valid [${error.toString()}]`);
|
|
104
135
|
}
|
|
105
136
|
return value;
|
|
106
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"));
|
|
@@ -68,6 +68,9 @@ exports.AndroidSubmitProfileSchema = joi_1.default.object({
|
|
|
68
68
|
changesNotSentForReview: joi_1.default.boolean().default(false),
|
|
69
69
|
});
|
|
70
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(),
|
|
71
74
|
appleId: joi_1.default.string(),
|
|
72
75
|
ascAppId: joi_1.default.string(),
|
|
73
76
|
appleTeamId: joi_1.default.string(),
|
|
@@ -80,11 +83,17 @@ const EasJsonSubmitConfigurationSchema = joi_1.default.object({
|
|
|
80
83
|
android: exports.AndroidSubmitProfileSchema,
|
|
81
84
|
ios: exports.IosSubmitProfileSchema,
|
|
82
85
|
});
|
|
86
|
+
exports.CliConfigSchema = joi_1.default.object({
|
|
87
|
+
version: joi_1.default.string(),
|
|
88
|
+
requireCommit: joi_1.default.boolean(),
|
|
89
|
+
});
|
|
83
90
|
exports.MinimalEasJsonSchema = joi_1.default.object({
|
|
91
|
+
cli: joi_1.default.object(),
|
|
84
92
|
build: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.object()),
|
|
85
93
|
submit: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.object()),
|
|
86
94
|
});
|
|
87
95
|
exports.EasJsonSchema = joi_1.default.object({
|
|
96
|
+
cli: exports.CliConfigSchema,
|
|
88
97
|
build: joi_1.default.object().pattern(joi_1.default.string(), EasJsonBuildProfileSchema),
|
|
89
98
|
submit: joi_1.default.object().pattern(joi_1.default.string(), EasJsonSubmitConfigurationSchema),
|
|
90
99
|
});
|
|
@@ -19,6 +19,9 @@ export interface AndroidSubmitProfile {
|
|
|
19
19
|
}
|
|
20
20
|
export declare const AndroidSubmitProfileFieldsToEvaluate: (keyof AndroidSubmitProfile)[];
|
|
21
21
|
export interface IosSubmitProfile {
|
|
22
|
+
ascApiKeyPath?: string;
|
|
23
|
+
ascApiKeyIssuerId?: string;
|
|
24
|
+
ascApiKeyId?: string;
|
|
22
25
|
appleId?: string;
|
|
23
26
|
ascAppId?: string;
|
|
24
27
|
appleTeamId?: string;
|
package/build/EasSubmit.types.js
CHANGED
|
@@ -18,4 +18,8 @@ var AndroidReleaseTrack;
|
|
|
18
18
|
exports.AndroidSubmitProfileFieldsToEvaluate = [
|
|
19
19
|
'serviceAccountKeyPath',
|
|
20
20
|
];
|
|
21
|
-
exports.IosSubmitProfileFieldsToEvaluate = [
|
|
21
|
+
exports.IosSubmitProfileFieldsToEvaluate = [
|
|
22
|
+
'ascApiKeyPath',
|
|
23
|
+
'ascApiKeyIssuerId',
|
|
24
|
+
'ascApiKeyId',
|
|
25
|
+
];
|
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
|
> {
|
|
@@ -81,18 +120,24 @@ export class EasJsonReader {
|
|
|
81
120
|
|
|
82
121
|
public async readSubmitProfileAsync<T extends Platform>(
|
|
83
122
|
platform: T,
|
|
84
|
-
|
|
123
|
+
profileNameArg?: string
|
|
85
124
|
): Promise<SubmitProfile<T>> {
|
|
125
|
+
let profileName = profileNameArg;
|
|
126
|
+
|
|
86
127
|
if (!profileName) {
|
|
87
128
|
const profileNames = await this.getSubmitProfileNamesAsync({
|
|
88
129
|
throwIfEasJsonDoesNotExist: false,
|
|
89
130
|
});
|
|
90
|
-
|
|
91
|
-
|
|
131
|
+
|
|
132
|
+
if (profileNames.includes('production')) {
|
|
133
|
+
profileName = 'production';
|
|
134
|
+
} else if (profileNames.includes('release')) {
|
|
135
|
+
profileName = 'release';
|
|
92
136
|
} else {
|
|
93
137
|
return getDefaultSubmitProfile(platform);
|
|
94
138
|
}
|
|
95
139
|
}
|
|
140
|
+
|
|
96
141
|
const easJson = await this.readAndValidateAsync();
|
|
97
142
|
const profile = easJson?.submit?.[profileName];
|
|
98
143
|
if (!profile) {
|
|
@@ -115,7 +160,7 @@ export class EasJsonReader {
|
|
|
115
160
|
});
|
|
116
161
|
|
|
117
162
|
if (error) {
|
|
118
|
-
throw new
|
|
163
|
+
throw new InvalidEasJsonError(`eas.json is not valid [${error.toString()}]`);
|
|
119
164
|
}
|
|
120
165
|
return value as EasJson;
|
|
121
166
|
}
|
|
@@ -126,7 +171,7 @@ export class EasJsonReader {
|
|
|
126
171
|
const rawEasJson = JsonFile.read(easJsonPath);
|
|
127
172
|
const { value, error } = MinimalEasJsonSchema.validate(rawEasJson, { abortEarly: false });
|
|
128
173
|
if (error) {
|
|
129
|
-
throw new
|
|
174
|
+
throw new InvalidEasJsonError(`eas.json is not valid [${error.toString()}]`);
|
|
130
175
|
}
|
|
131
176
|
return value;
|
|
132
177
|
} catch (err: any) {
|
package/src/EasJsonSchema.ts
CHANGED
|
@@ -90,6 +90,9 @@ export const AndroidSubmitProfileSchema = Joi.object({
|
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
export const IosSubmitProfileSchema = Joi.object({
|
|
93
|
+
ascApiKeyPath: Joi.string(),
|
|
94
|
+
ascApiKeyId: Joi.string(),
|
|
95
|
+
ascApiKeyIssuerId: Joi.string(),
|
|
93
96
|
appleId: Joi.string(),
|
|
94
97
|
ascAppId: Joi.string(),
|
|
95
98
|
appleTeamId: Joi.string(),
|
|
@@ -104,12 +107,19 @@ const EasJsonSubmitConfigurationSchema = Joi.object({
|
|
|
104
107
|
ios: IosSubmitProfileSchema,
|
|
105
108
|
});
|
|
106
109
|
|
|
110
|
+
export const CliConfigSchema = Joi.object({
|
|
111
|
+
version: Joi.string(),
|
|
112
|
+
requireCommit: Joi.boolean(),
|
|
113
|
+
});
|
|
114
|
+
|
|
107
115
|
export const MinimalEasJsonSchema = Joi.object({
|
|
116
|
+
cli: Joi.object(),
|
|
108
117
|
build: Joi.object().pattern(Joi.string(), Joi.object()),
|
|
109
118
|
submit: Joi.object().pattern(Joi.string(), Joi.object()),
|
|
110
119
|
});
|
|
111
120
|
|
|
112
121
|
export const EasJsonSchema = Joi.object({
|
|
122
|
+
cli: CliConfigSchema,
|
|
113
123
|
build: Joi.object().pattern(Joi.string(), EasJsonBuildProfileSchema),
|
|
114
124
|
submit: Joi.object().pattern(Joi.string(), EasJsonSubmitConfigurationSchema),
|
|
115
125
|
});
|
package/src/EasSubmit.types.ts
CHANGED
|
@@ -26,6 +26,9 @@ export const AndroidSubmitProfileFieldsToEvaluate: (keyof AndroidSubmitProfile)[
|
|
|
26
26
|
];
|
|
27
27
|
|
|
28
28
|
export interface IosSubmitProfile {
|
|
29
|
+
ascApiKeyPath?: string;
|
|
30
|
+
ascApiKeyIssuerId?: string;
|
|
31
|
+
ascApiKeyId?: string;
|
|
29
32
|
appleId?: string;
|
|
30
33
|
ascAppId?: string;
|
|
31
34
|
appleTeamId?: string;
|
|
@@ -35,7 +38,11 @@ export interface IosSubmitProfile {
|
|
|
35
38
|
appName?: string;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
export const IosSubmitProfileFieldsToEvaluate: (keyof IosSubmitProfile)[] = [
|
|
41
|
+
export const IosSubmitProfileFieldsToEvaluate: (keyof IosSubmitProfile)[] = [
|
|
42
|
+
'ascApiKeyPath',
|
|
43
|
+
'ascApiKeyIssuerId',
|
|
44
|
+
'ascApiKeyId',
|
|
45
|
+
];
|
|
39
46
|
|
|
40
47
|
export type SubmitProfile<TPlatform extends Platform = Platform> =
|
|
41
48
|
TPlatform extends Platform.ANDROID
|
|
@@ -14,13 +14,13 @@ beforeEach(async () => {
|
|
|
14
14
|
test('minimal valid eas.json for both platforms', async () => {
|
|
15
15
|
await fs.writeJson('/project/eas.json', {
|
|
16
16
|
build: {
|
|
17
|
-
|
|
17
|
+
production: {},
|
|
18
18
|
},
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
const reader = new EasJsonReader('/project');
|
|
22
|
-
const iosProfile = await reader.readBuildProfileAsync(Platform.IOS, '
|
|
23
|
-
const androidProfile = await reader.readBuildProfileAsync(Platform.ANDROID, '
|
|
22
|
+
const iosProfile = await reader.readBuildProfileAsync(Platform.IOS, 'production');
|
|
23
|
+
const androidProfile = await reader.readBuildProfileAsync(Platform.ANDROID, 'production');
|
|
24
24
|
|
|
25
25
|
expect({
|
|
26
26
|
distribution: 'store',
|
|
@@ -36,7 +36,7 @@ test('minimal valid eas.json for both platforms', async () => {
|
|
|
36
36
|
test('valid eas.json for development client builds', async () => {
|
|
37
37
|
await fs.writeJson('/project/eas.json', {
|
|
38
38
|
build: {
|
|
39
|
-
|
|
39
|
+
production: {},
|
|
40
40
|
debug: {
|
|
41
41
|
developmentClient: true,
|
|
42
42
|
android: {
|
|
@@ -219,7 +219,7 @@ test('valid profile extending other profile with platform specific caching', asy
|
|
|
219
219
|
test('valid eas.json with missing profile', async () => {
|
|
220
220
|
await fs.writeJson('/project/eas.json', {
|
|
221
221
|
build: {
|
|
222
|
-
|
|
222
|
+
production: {},
|
|
223
223
|
},
|
|
224
224
|
});
|
|
225
225
|
|
|
@@ -231,14 +231,14 @@ test('valid eas.json with missing profile', async () => {
|
|
|
231
231
|
test('invalid eas.json when using wrong buildType', async () => {
|
|
232
232
|
await fs.writeJson('/project/eas.json', {
|
|
233
233
|
build: {
|
|
234
|
-
|
|
234
|
+
production: { android: { buildType: 'archive' } },
|
|
235
235
|
},
|
|
236
236
|
});
|
|
237
237
|
|
|
238
238
|
const reader = new EasJsonReader('/project');
|
|
239
|
-
const promise = reader.readBuildProfileAsync(Platform.ANDROID, '
|
|
239
|
+
const promise = reader.readBuildProfileAsync(Platform.ANDROID, 'production');
|
|
240
240
|
await expect(promise).rejects.toThrowError(
|
|
241
|
-
'eas.json is not valid [ValidationError: "build.
|
|
241
|
+
'eas.json is not valid [ValidationError: "build.production.android.buildType" must be one of [apk, app-bundle]]'
|
|
242
242
|
);
|
|
243
243
|
});
|
|
244
244
|
|
|
@@ -246,33 +246,33 @@ test('empty json', async () => {
|
|
|
246
246
|
await fs.writeJson('/project/eas.json', {});
|
|
247
247
|
|
|
248
248
|
const reader = new EasJsonReader('/project');
|
|
249
|
-
const promise = reader.readBuildProfileAsync(Platform.ANDROID, '
|
|
250
|
-
await expect(promise).rejects.toThrowError('There is no profile named
|
|
249
|
+
const promise = reader.readBuildProfileAsync(Platform.ANDROID, 'production');
|
|
250
|
+
await expect(promise).rejects.toThrowError('There is no profile named production in eas.json');
|
|
251
251
|
});
|
|
252
252
|
|
|
253
253
|
test('invalid semver value', async () => {
|
|
254
254
|
await fs.writeJson('/project/eas.json', {
|
|
255
255
|
build: {
|
|
256
|
-
|
|
256
|
+
production: { node: '12.0.0-alpha' },
|
|
257
257
|
},
|
|
258
258
|
});
|
|
259
259
|
|
|
260
260
|
const reader = new EasJsonReader('/project');
|
|
261
|
-
const promise = reader.readBuildProfileAsync(Platform.ANDROID, '
|
|
261
|
+
const promise = reader.readBuildProfileAsync(Platform.ANDROID, 'production');
|
|
262
262
|
await expect(promise).rejects.toThrowError(
|
|
263
|
-
'eas.json is not valid [ValidationError: "build.
|
|
263
|
+
'eas.json is not valid [ValidationError: "build.production.node" failed custom validation because 12.0.0-alpha is not a valid version]'
|
|
264
264
|
);
|
|
265
265
|
});
|
|
266
266
|
|
|
267
267
|
test('get profile names', async () => {
|
|
268
268
|
await fs.writeJson('/project/eas.json', {
|
|
269
269
|
build: {
|
|
270
|
-
|
|
270
|
+
production: { node: '12.0.0-alpha' },
|
|
271
271
|
blah: { node: '12.0.0-alpha' },
|
|
272
272
|
},
|
|
273
273
|
});
|
|
274
274
|
|
|
275
275
|
const reader = new EasJsonReader('/project');
|
|
276
276
|
const allProfileNames = await reader.getBuildProfileNamesAsync();
|
|
277
|
-
expect(allProfileNames.sort()).toEqual(['blah', '
|
|
277
|
+
expect(allProfileNames.sort()).toEqual(['blah', 'production'].sort());
|
|
278
278
|
});
|