@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.
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EasJsonSchema = exports.schemaBuildProfileMap = void 0;
4
- const tslib_1 = require("tslib");
5
- const eas_build_job_1 = require("@expo/eas-build-job");
6
- const joi_1 = (0, tslib_1.__importDefault)(require("joi"));
7
- const semverSchemaCheck = (value, helpers) => {
8
- if (/^[0-9]+\.[0-9]+\.[0-9]+$/.test(value)) {
9
- return value;
10
- }
11
- else {
12
- throw new Error(`${value} is not a valid version`);
13
- }
14
- };
15
- const AndroidBuilderEnvironmentSchema = joi_1.default.object({
16
- image: joi_1.default.string()
17
- .valid(...eas_build_job_1.Android.builderBaseImages)
18
- .default('default'),
19
- node: joi_1.default.string().empty(null).custom(semverSchemaCheck),
20
- yarn: joi_1.default.string().empty(null).custom(semverSchemaCheck),
21
- ndk: joi_1.default.string().empty(null).custom(semverSchemaCheck),
22
- expoCli: joi_1.default.string().empty(null).custom(semverSchemaCheck),
23
- env: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.string().empty(null)).default({}),
24
- });
25
- const IosBuilderEnvironmentSchema = joi_1.default.object({
26
- image: joi_1.default.string().valid(...eas_build_job_1.Ios.builderBaseImages),
27
- node: joi_1.default.string().empty(null).custom(semverSchemaCheck),
28
- yarn: joi_1.default.string().empty(null).custom(semverSchemaCheck),
29
- bundler: joi_1.default.string().empty(null).custom(semverSchemaCheck),
30
- fastlane: joi_1.default.string().empty(null).custom(semverSchemaCheck),
31
- cocoapods: joi_1.default.string().empty(null).custom(semverSchemaCheck),
32
- expoCli: joi_1.default.string().empty(null).custom(semverSchemaCheck),
33
- env: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.string().empty(null)).default({}),
34
- });
35
- const CacheSchema = joi_1.default.object({
36
- disabled: joi_1.default.boolean().default(false),
37
- key: joi_1.default.string().max(128),
38
- cacheDefaultPaths: joi_1.default.boolean().default(true),
39
- customPaths: joi_1.default.array().items(joi_1.default.string()).default([]),
40
- });
41
- const AndroidSchema = joi_1.default.object({
42
- workflow: joi_1.default.string(),
43
- credentialsSource: joi_1.default.string().valid('local', 'remote').default('remote'),
44
- releaseChannel: joi_1.default.string(),
45
- channel: joi_1.default.string(),
46
- distribution: joi_1.default.string().valid('store', 'internal').default('store'),
47
- cache: CacheSchema.default(),
48
- withoutCredentials: joi_1.default.boolean().default(false),
49
- artifactPath: joi_1.default.string(),
50
- gradleCommand: joi_1.default.string(),
51
- buildType: joi_1.default.alternatives().conditional('distribution', {
52
- is: 'internal',
53
- then: joi_1.default.string().valid('apk', 'development-client'),
54
- otherwise: joi_1.default.string().valid('apk', 'app-bundle', 'development-client'),
55
- }),
56
- }).concat(AndroidBuilderEnvironmentSchema);
57
- const IosSchema = joi_1.default.object({
58
- workflow: joi_1.default.string(),
59
- credentialsSource: joi_1.default.string().valid('local', 'remote').default('remote'),
60
- releaseChannel: joi_1.default.string(),
61
- channel: joi_1.default.string(),
62
- distribution: joi_1.default.string().valid('store', 'internal', 'simulator').default('store'),
63
- enterpriseProvisioning: joi_1.default.string().valid('adhoc', 'universal'),
64
- autoIncrement: joi_1.default.alternatives()
65
- .try(joi_1.default.boolean(), joi_1.default.string().valid('version', 'buildNumber'))
66
- .default(false),
67
- cache: CacheSchema.default(),
68
- artifactPath: joi_1.default.string(),
69
- scheme: joi_1.default.string(),
70
- schemeBuildConfiguration: joi_1.default.string(),
71
- buildType: joi_1.default.string().valid('release', 'development-client'),
72
- }).concat(IosBuilderEnvironmentSchema);
73
- exports.schemaBuildProfileMap = {
74
- android: AndroidSchema,
75
- ios: IosSchema,
76
- };
77
- exports.EasJsonSchema = joi_1.default.object({
78
- builds: joi_1.default.object({
79
- android: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.object({}).unknown(true) // profile is validated further only if build is for that platform
80
- ),
81
- ios: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.object({}).unknown(true) // profile is validated further only if build is for that platform
82
- ),
83
- }),
84
- });
@@ -1,6 +0,0 @@
1
- import { EasJson as DeprecatedEasJson } from './DeprecatedEasJsonReader';
2
- import { RawBuildProfile } from './EasJson.types';
3
- export declare function isUsingDeprecatedFormatAsync(projectDir: string): Promise<boolean>;
4
- export declare function hasMismatchedExtendsAsync(projectDir: string): Promise<boolean>;
5
- export declare function migrateAsync(projectDir: string): Promise<void>;
6
- export declare function migrateProfile(rawEasJson: DeprecatedEasJson, profileName: string): RawBuildProfile;
package/build/migrate.js DELETED
@@ -1,161 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.migrateProfile = exports.migrateAsync = exports.hasMismatchedExtendsAsync = exports.isUsingDeprecatedFormatAsync = void 0;
4
- const tslib_1 = require("tslib");
5
- const eas_build_job_1 = require("@expo/eas-build-job");
6
- const json_file_1 = (0, tslib_1.__importDefault)(require("@expo/json-file"));
7
- const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
8
- const path_1 = (0, tslib_1.__importDefault)(require("path"));
9
- const DeprecatedEasJsonReader_1 = require("./DeprecatedEasJsonReader");
10
- async function isUsingDeprecatedFormatAsync(projectDir) {
11
- const easJsonPath = path_1.default.join(projectDir, 'eas.json');
12
- if (!(await fs_extra_1.default.pathExists(easJsonPath))) {
13
- return false;
14
- }
15
- const json = await readEasJsonAsync(projectDir);
16
- return !!(json === null || json === void 0 ? void 0 : json.builds);
17
- }
18
- exports.isUsingDeprecatedFormatAsync = isUsingDeprecatedFormatAsync;
19
- async function hasMismatchedExtendsAsync(projectDir) {
20
- var _a, _b;
21
- const rawEasJson = (await readEasJsonAsync(projectDir));
22
- const profiles = new Set();
23
- Object.keys((_a = rawEasJson.builds.android) !== null && _a !== void 0 ? _a : {}).forEach(profile => profiles.add(profile));
24
- Object.keys((_b = rawEasJson.builds.ios) !== null && _b !== void 0 ? _b : {}).forEach(profile => profiles.add(profile));
25
- let hasMismatchedExtendsKeys = false;
26
- profiles.forEach(profileName => {
27
- var _a, _b, _c, _d, _e, _f;
28
- if (((_c = (_b = (_a = rawEasJson === null || rawEasJson === void 0 ? void 0 : rawEasJson.builds) === null || _a === void 0 ? void 0 : _a.ios) === null || _b === void 0 ? void 0 : _b[profileName]) === null || _c === void 0 ? void 0 : _c.extends) !==
29
- ((_f = (_e = (_d = rawEasJson === null || rawEasJson === void 0 ? void 0 : rawEasJson.builds) === null || _d === void 0 ? void 0 : _d.android) === null || _e === void 0 ? void 0 : _e[profileName]) === null || _f === void 0 ? void 0 : _f.extends)) {
30
- hasMismatchedExtendsKeys = true;
31
- }
32
- });
33
- return hasMismatchedExtendsKeys;
34
- }
35
- exports.hasMismatchedExtendsAsync = hasMismatchedExtendsAsync;
36
- async function migrateAsync(projectDir) {
37
- var _a, _b;
38
- const reader = new DeprecatedEasJsonReader_1.EasJsonReader(projectDir, 'all');
39
- try {
40
- await reader.validateAsync();
41
- }
42
- catch (err) {
43
- throw new Error(`Valid eas.json is required to migrate to the new format\n${err.message}`);
44
- }
45
- const rawEasJson = (await readEasJsonAsync(projectDir));
46
- const profiles = new Set();
47
- Object.keys((_a = rawEasJson.builds.android) !== null && _a !== void 0 ? _a : {}).forEach(profile => profiles.add(profile));
48
- Object.keys((_b = rawEasJson.builds.ios) !== null && _b !== void 0 ? _b : {}).forEach(profile => profiles.add(profile));
49
- const result = {
50
- build: {},
51
- };
52
- profiles.forEach(profileName => {
53
- result.build[profileName] = migrateProfile(rawEasJson, profileName);
54
- });
55
- await fs_extra_1.default.writeFile(path_1.default.join(projectDir, 'eas.json'), `${JSON.stringify(result, null, 2)}\n`);
56
- }
57
- exports.migrateAsync = migrateAsync;
58
- async function readEasJsonAsync(projectDir) {
59
- try {
60
- const easJsonPath = path_1.default.join(projectDir, 'eas.json');
61
- return json_file_1.default.read(easJsonPath);
62
- }
63
- catch (err) {
64
- if (err.code === 'EJSONPARSE') {
65
- err.message = `Found invalid JSON in eas.json. ${err.message}`;
66
- }
67
- throw err;
68
- }
69
- }
70
- function migrateProfile(rawEasJson, profileName) {
71
- var _a, _b, _c, _d, _e, _f, _g, _h;
72
- const androidProfile = ((_c = (_b = (_a = rawEasJson === null || rawEasJson === void 0 ? void 0 : rawEasJson.builds) === null || _a === void 0 ? void 0 : _a.android) === null || _b === void 0 ? void 0 : _b[profileName]) !== null && _c !== void 0 ? _c : {});
73
- const iosProfile = ((_f = (_e = (_d = rawEasJson === null || rawEasJson === void 0 ? void 0 : rawEasJson.builds) === null || _d === void 0 ? void 0 : _d.ios) === null || _e === void 0 ? void 0 : _e[profileName]) !== null && _f !== void 0 ? _f : {});
74
- let profile = {
75
- android: {},
76
- ios: {},
77
- };
78
- const ctx = { androidProfile, iosProfile };
79
- const androidCtx = { androidProfile };
80
- const iosCtx = { iosProfile };
81
- // simple common values
82
- profile = migrateProperty('credentialsSource', profile, ctx);
83
- profile = migrateProperty('releaseChannel', profile, ctx);
84
- profile = migrateProperty('channel', profile, ctx);
85
- profile = migrateProperty('node', profile, ctx);
86
- profile = migrateProperty('yarn', profile, ctx);
87
- profile = migrateProperty('expoCli', profile, ctx);
88
- if (androidProfile.extends && androidProfile.extends === iosProfile.extends) {
89
- profile = migrateProperty('extends', profile, ctx);
90
- }
91
- // android
92
- profile = migrateProperty('image', profile, androidCtx);
93
- profile = migrateProperty('ndk', profile, androidCtx);
94
- profile = migrateProperty('gradleCommand', profile, androidCtx);
95
- profile = migrateProperty('artifactPath', profile, androidCtx);
96
- profile = migrateProperty('env', profile, androidCtx);
97
- profile = migrateProperty('cache', profile, androidCtx);
98
- profile = migrateProperty('withoutCredentials', profile, androidCtx);
99
- // ios
100
- profile = migrateProperty('enterpriseProvisioning', profile, iosCtx);
101
- profile = migrateProperty('autoIncrement', profile, iosCtx);
102
- profile = migrateProperty('image', profile, iosCtx);
103
- profile = migrateProperty('bundler', profile, iosCtx);
104
- profile = migrateProperty('fastlane', profile, iosCtx);
105
- profile = migrateProperty('cocoapods', profile, iosCtx);
106
- profile = migrateProperty('artifactPath', profile, iosCtx);
107
- profile = migrateProperty('scheme', profile, iosCtx);
108
- profile = migrateProperty('env', profile, iosCtx);
109
- profile = migrateProperty('cache', profile, iosCtx);
110
- profile = migrateProperty('developmentClient', profile, {
111
- androidProfile: {
112
- ...androidProfile,
113
- developmentClient: androidProfile.buildType === eas_build_job_1.Android.BuildType.DEVELOPMENT_CLIENT || undefined,
114
- },
115
- iosProfile: {
116
- ...iosProfile,
117
- developmentClient: iosProfile.buildType === eas_build_job_1.Ios.BuildType.DEVELOPMENT_CLIENT || undefined,
118
- },
119
- });
120
- if (androidProfile.buildType &&
121
- androidProfile.buildType !== eas_build_job_1.Android.BuildType.DEVELOPMENT_CLIENT) {
122
- profile.android.buildType = androidProfile.buildType;
123
- }
124
- if (iosProfile.distribution === 'simulator') {
125
- profile.ios.simulator = true;
126
- delete iosProfile.distribution;
127
- }
128
- profile = migrateProperty('distribution', profile, ctx);
129
- if (iosProfile.schemeBuildConfiguration) {
130
- profile.ios.buildConfiguration = iosProfile.schemeBuildConfiguration;
131
- }
132
- if (Object.keys((_g = profile.android) !== null && _g !== void 0 ? _g : {}).length === 0) {
133
- delete profile.android;
134
- }
135
- if (Object.keys((_h = profile.ios) !== null && _h !== void 0 ? _h : {}).length === 0) {
136
- delete profile.ios;
137
- }
138
- return profile;
139
- }
140
- exports.migrateProfile = migrateProfile;
141
- function migrateProperty(key, profile, ctx) {
142
- var _a, _b;
143
- const androidProperty = (_a = ctx.androidProfile) === null || _a === void 0 ? void 0 : _a[key];
144
- const iosProperty = (_b = ctx.iosProfile) === null || _b === void 0 ? void 0 : _b[key];
145
- if (androidProperty && iosProperty && androidProperty === iosProperty) {
146
- return { ...profile, [key]: androidProperty };
147
- }
148
- else {
149
- return {
150
- ...profile,
151
- android: {
152
- ...profile.android,
153
- ...(androidProperty ? { [key]: androidProperty } : {}),
154
- },
155
- ios: {
156
- ...profile.ios,
157
- ...(iosProperty ? { [key]: iosProperty } : {}),
158
- },
159
- };
160
- }
161
- }
@@ -1,58 +0,0 @@
1
- import { Android, Cache, Ios } from '@expo/eas-build-job';
2
-
3
- export enum CredentialsSource {
4
- LOCAL = 'local',
5
- REMOTE = 'remote',
6
- }
7
-
8
- export type AndroidDistributionType = 'store' | 'internal';
9
- export type IosDistributionType = 'store' | 'internal' | 'simulator';
10
- export type DistributionType = AndroidDistributionType | IosDistributionType;
11
-
12
- export type IosEnterpriseProvisioning = 'adhoc' | 'universal';
13
-
14
- export type VersionAutoIncrement = boolean | 'version' | 'buildNumber';
15
-
16
- interface IosBuilderEnvironment extends Omit<Ios.BuilderEnvironment, 'image'> {
17
- image?: Ios.BuilderEnvironment['image'];
18
- }
19
-
20
- export interface AndroidBuildProfile extends Android.BuilderEnvironment {
21
- credentialsSource: CredentialsSource;
22
- releaseChannel?: string;
23
- channel?: string;
24
- distribution: AndroidDistributionType;
25
- cache: Cache;
26
- withoutCredentials?: boolean;
27
-
28
- buildType?: Android.BuildType;
29
-
30
- gradleCommand?: string;
31
- artifactPath?: string;
32
- }
33
-
34
- export interface IosBuildProfile extends IosBuilderEnvironment {
35
- credentialsSource: CredentialsSource;
36
- releaseChannel?: string;
37
- channel?: string;
38
- distribution: IosDistributionType;
39
- enterpriseProvisioning?: IosEnterpriseProvisioning;
40
- autoIncrement: VersionAutoIncrement;
41
- cache: Cache;
42
-
43
- artifactPath?: string;
44
- scheme?: string;
45
- schemeBuildConfiguration?: string;
46
-
47
- buildType?: Ios.BuildType;
48
- }
49
-
50
- export type BuildProfile = AndroidBuildProfile | IosBuildProfile;
51
-
52
- // EasConfig represents eas.json with one specific profile
53
- export interface EasConfig {
54
- builds: {
55
- android?: AndroidBuildProfile;
56
- ios?: IosBuildProfile;
57
- };
58
- }
@@ -1,190 +0,0 @@
1
- import { Platform, Workflow } from '@expo/eas-build-job';
2
- import fs from 'fs-extra';
3
- import path from 'path';
4
-
5
- import {
6
- AndroidBuildProfile,
7
- BuildProfile,
8
- EasConfig,
9
- IosBuildProfile,
10
- } from './DeprecatedConfig.types';
11
- import { EasJsonSchema, schemaBuildProfileMap } from './DeprecatedEasJsonSchema';
12
-
13
- export interface EasJson {
14
- builds: {
15
- android?: { [key: string]: BuildProfilePreValidation };
16
- ios?: { [key: string]: BuildProfilePreValidation };
17
- };
18
- }
19
-
20
- interface BuildProfilePreValidation {
21
- workflow?: Workflow;
22
- extends?: string;
23
- }
24
-
25
- function intersect<T>(setA: Set<T>, setB: Set<T>): Set<T> {
26
- return new Set([...setA].filter(i => setB.has(i)));
27
- }
28
-
29
- export class EasJsonReader {
30
- constructor(private projectDir: string, private platform: 'android' | 'ios' | 'all') {}
31
-
32
- /**
33
- * Return build profile names for a particular platform.
34
- * If platform is 'all', return common build profiles for all platforms
35
- */
36
- public async getBuildProfileNamesAsync(): Promise<string[]> {
37
- const easJson = await this.readRawAsync();
38
- if (this.platform === 'android') {
39
- return Object.keys(easJson?.builds?.android ?? {});
40
- } else if (this.platform === 'ios') {
41
- return Object.keys(easJson?.builds?.ios ?? {});
42
- } else {
43
- const intersectingProfileNames = intersect(
44
- new Set(Object.keys(easJson?.builds?.ios ?? {})),
45
- new Set(Object.keys(easJson?.builds?.android ?? {}))
46
- );
47
- return Array.from(intersectingProfileNames);
48
- }
49
- }
50
-
51
- public async readAsync(buildProfileName: string): Promise<EasConfig> {
52
- const easJson = await this.readRawAsync();
53
-
54
- let androidConfig;
55
- if (['android', 'all'].includes(this.platform)) {
56
- androidConfig = this.validateBuildProfile<AndroidBuildProfile>(
57
- Platform.ANDROID,
58
- buildProfileName,
59
- easJson.builds?.android || {}
60
- );
61
- }
62
- let iosConfig;
63
- if (['ios', 'all'].includes(this.platform)) {
64
- iosConfig = this.validateBuildProfile<IosBuildProfile>(
65
- Platform.IOS,
66
- buildProfileName,
67
- easJson.builds?.ios || {}
68
- );
69
- }
70
- return {
71
- builds: {
72
- ...(androidConfig ? { android: androidConfig } : {}),
73
- ...(iosConfig ? { ios: iosConfig } : {}),
74
- },
75
- };
76
- }
77
-
78
- public async validateAsync(): Promise<void> {
79
- const easJson = await this.readRawAsync();
80
-
81
- const androidProfiles = easJson.builds?.android ?? {};
82
- for (const name of Object.keys(androidProfiles)) {
83
- try {
84
- this.validateBuildProfile(Platform.ANDROID, name, androidProfiles);
85
- } catch (err: any) {
86
- err.message = `Failed to validate Android build profile "${name}"\n${err.message}`;
87
- throw err;
88
- }
89
- }
90
- const iosProfiles = easJson.builds?.ios ?? {};
91
- for (const name of Object.keys(iosProfiles)) {
92
- try {
93
- this.validateBuildProfile(Platform.IOS, name, iosProfiles);
94
- } catch (err: any) {
95
- err.message = `Failed to validate iOS build profile "${name}"\n${err.message}`;
96
- throw err;
97
- }
98
- }
99
- }
100
-
101
- public async readRawAsync(): Promise<EasJson> {
102
- const rawFile = await fs.readFile(path.join(this.projectDir, 'eas.json'), 'utf8');
103
- const json = JSON.parse(rawFile);
104
-
105
- const { value, error } = EasJsonSchema.validate(json, {
106
- abortEarly: false,
107
- });
108
-
109
- if (error) {
110
- throw new Error(`eas.json is not valid [${error.toString()}]`);
111
- }
112
- return value;
113
- }
114
-
115
- private validateBuildProfile<T extends BuildProfile>(
116
- platform: Platform,
117
- buildProfileName: string,
118
- buildProfiles: Record<string, BuildProfilePreValidation>
119
- ): T {
120
- const buildProfile = this.resolveBuildProfile(platform, buildProfileName, buildProfiles);
121
- const schema = schemaBuildProfileMap[platform];
122
- const { value, error } = schema.validate(buildProfile, {
123
- stripUnknown: true,
124
- convert: true,
125
- abortEarly: false,
126
- });
127
-
128
- if (error) {
129
- throw new Error(
130
- `Object "${platform}.${buildProfileName}" in eas.json is not valid [${error.toString()}]`
131
- );
132
- }
133
- return value;
134
- }
135
-
136
- private resolveBuildProfile(
137
- platform: Platform,
138
- buildProfileName: string,
139
- buildProfiles: Record<string, BuildProfilePreValidation>,
140
- depth: number = 0
141
- ): Record<string, any> {
142
- if (depth >= 2) {
143
- throw new Error(
144
- 'Too long chain of build profile extensions, make sure "extends" keys do not make a cycle'
145
- );
146
- }
147
- const buildProfile = buildProfiles[buildProfileName];
148
- if (!buildProfile) {
149
- throw new Error(`There is no profile named ${buildProfileName} for platform ${platform}`);
150
- }
151
- const { extends: baseProfileName, ...buildProfileRest } = buildProfile;
152
- if (baseProfileName) {
153
- return deepMerge(
154
- this.resolveBuildProfile(platform, baseProfileName, buildProfiles, depth + 1),
155
- buildProfileRest
156
- );
157
- } else {
158
- return buildProfileRest;
159
- }
160
- }
161
- }
162
-
163
- function isObject(value: any): boolean {
164
- return typeof value === 'object' && value !== null;
165
- }
166
-
167
- export function deepMerge(
168
- base: Record<string, any>,
169
- update: Record<string, any>
170
- ): Record<string, any> {
171
- const result: Record<string, any> = {};
172
- Object.keys(base).forEach(key => {
173
- const oldValue = base[key];
174
- const newValue = update[key];
175
- if (isObject(newValue) && isObject(oldValue)) {
176
- result[key] = deepMerge(oldValue, newValue);
177
- } else if (newValue !== undefined) {
178
- result[key] = isObject(newValue) ? deepMerge({}, newValue) : newValue;
179
- } else {
180
- result[key] = isObject(oldValue) ? deepMerge({}, oldValue) : oldValue;
181
- }
182
- });
183
- Object.keys(update).forEach(key => {
184
- const newValue = update[key];
185
- if (result[key] === undefined) {
186
- result[key] = isObject(newValue) ? deepMerge({}, newValue) : newValue;
187
- }
188
- });
189
- return result;
190
- }
@@ -1,95 +0,0 @@
1
- import { Android, Ios } from '@expo/eas-build-job';
2
- import Joi, { CustomHelpers } from 'joi';
3
-
4
- const semverSchemaCheck = (value: any, helpers: CustomHelpers): any => {
5
- if (/^[0-9]+\.[0-9]+\.[0-9]+$/.test(value)) {
6
- return value;
7
- } else {
8
- throw new Error(`${value} is not a valid version`);
9
- }
10
- };
11
-
12
- const AndroidBuilderEnvironmentSchema = Joi.object({
13
- image: Joi.string()
14
- .valid(...Android.builderBaseImages)
15
- .default('default'),
16
- node: Joi.string().empty(null).custom(semverSchemaCheck),
17
- yarn: Joi.string().empty(null).custom(semverSchemaCheck),
18
- ndk: Joi.string().empty(null).custom(semverSchemaCheck),
19
- expoCli: Joi.string().empty(null).custom(semverSchemaCheck),
20
- env: Joi.object().pattern(Joi.string(), Joi.string().empty(null)).default({}),
21
- });
22
-
23
- const IosBuilderEnvironmentSchema = Joi.object({
24
- image: Joi.string().valid(...Ios.builderBaseImages),
25
- node: Joi.string().empty(null).custom(semverSchemaCheck),
26
- yarn: Joi.string().empty(null).custom(semverSchemaCheck),
27
- bundler: Joi.string().empty(null).custom(semverSchemaCheck),
28
- fastlane: Joi.string().empty(null).custom(semverSchemaCheck),
29
- cocoapods: Joi.string().empty(null).custom(semverSchemaCheck),
30
- expoCli: Joi.string().empty(null).custom(semverSchemaCheck),
31
- env: Joi.object().pattern(Joi.string(), Joi.string().empty(null)).default({}),
32
- });
33
-
34
- const CacheSchema = Joi.object({
35
- disabled: Joi.boolean().default(false),
36
- key: Joi.string().max(128),
37
- cacheDefaultPaths: Joi.boolean().default(true),
38
- customPaths: Joi.array().items(Joi.string()).default([]),
39
- });
40
-
41
- const AndroidSchema = Joi.object({
42
- workflow: Joi.string(),
43
- credentialsSource: Joi.string().valid('local', 'remote').default('remote'),
44
- releaseChannel: Joi.string(),
45
- channel: Joi.string(),
46
- distribution: Joi.string().valid('store', 'internal').default('store'),
47
- cache: CacheSchema.default(),
48
- withoutCredentials: Joi.boolean().default(false),
49
-
50
- artifactPath: Joi.string(),
51
- gradleCommand: Joi.string(),
52
-
53
- buildType: Joi.alternatives().conditional('distribution', {
54
- is: 'internal',
55
- then: Joi.string().valid('apk', 'development-client'),
56
- otherwise: Joi.string().valid('apk', 'app-bundle', 'development-client'),
57
- }),
58
- }).concat(AndroidBuilderEnvironmentSchema);
59
-
60
- const IosSchema = Joi.object({
61
- workflow: Joi.string(),
62
- credentialsSource: Joi.string().valid('local', 'remote').default('remote'),
63
- releaseChannel: Joi.string(),
64
- channel: Joi.string(),
65
- distribution: Joi.string().valid('store', 'internal', 'simulator').default('store'),
66
- enterpriseProvisioning: Joi.string().valid('adhoc', 'universal'),
67
- autoIncrement: Joi.alternatives()
68
- .try(Joi.boolean(), Joi.string().valid('version', 'buildNumber'))
69
- .default(false),
70
- cache: CacheSchema.default(),
71
-
72
- artifactPath: Joi.string(),
73
- scheme: Joi.string(),
74
- schemeBuildConfiguration: Joi.string(),
75
-
76
- buildType: Joi.string().valid('release', 'development-client'),
77
- }).concat(IosBuilderEnvironmentSchema);
78
-
79
- export const schemaBuildProfileMap: Record<string, Joi.Schema> = {
80
- android: AndroidSchema,
81
- ios: IosSchema,
82
- };
83
-
84
- export const EasJsonSchema = Joi.object({
85
- builds: Joi.object({
86
- android: Joi.object().pattern(
87
- Joi.string(),
88
- Joi.object({}).unknown(true) // profile is validated further only if build is for that platform
89
- ),
90
- ios: Joi.object().pattern(
91
- Joi.string(),
92
- Joi.object({}).unknown(true) // profile is validated further only if build is for that platform
93
- ),
94
- }),
95
- });