@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/src/migrate.ts
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { Android, Ios } from '@expo/eas-build-job';
|
|
2
|
-
import JsonFile, { JSONObject } from '@expo/json-file';
|
|
3
|
-
import fs from 'fs-extra';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
|
|
6
|
-
import { AndroidBuildProfile, IosBuildProfile } from './DeprecatedConfig.types';
|
|
7
|
-
import { EasJson as DeprecatedEasJson, EasJsonReader } from './DeprecatedEasJsonReader';
|
|
8
|
-
import { EasJson, RawBuildProfile } from './EasJson.types';
|
|
9
|
-
|
|
10
|
-
export async function isUsingDeprecatedFormatAsync(projectDir: string): Promise<boolean> {
|
|
11
|
-
const easJsonPath = path.join(projectDir, 'eas.json');
|
|
12
|
-
if (!(await fs.pathExists(easJsonPath))) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
const json = await readEasJsonAsync(projectDir);
|
|
16
|
-
return !!json?.builds;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function hasMismatchedExtendsAsync(projectDir: string): Promise<boolean> {
|
|
20
|
-
const rawEasJson = (await readEasJsonAsync(projectDir)) as unknown as DeprecatedEasJson;
|
|
21
|
-
const profiles = new Set<string>();
|
|
22
|
-
Object.keys(rawEasJson.builds.android ?? {}).forEach(profile => profiles.add(profile));
|
|
23
|
-
Object.keys(rawEasJson.builds.ios ?? {}).forEach(profile => profiles.add(profile));
|
|
24
|
-
|
|
25
|
-
let hasMismatchedExtendsKeys = false;
|
|
26
|
-
profiles.forEach(profileName => {
|
|
27
|
-
if (
|
|
28
|
-
rawEasJson?.builds?.ios?.[profileName]?.extends !==
|
|
29
|
-
rawEasJson?.builds?.android?.[profileName]?.extends
|
|
30
|
-
) {
|
|
31
|
-
hasMismatchedExtendsKeys = true;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
return hasMismatchedExtendsKeys;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export async function migrateAsync(projectDir: string): Promise<void> {
|
|
38
|
-
const reader = new EasJsonReader(projectDir, 'all');
|
|
39
|
-
try {
|
|
40
|
-
await reader.validateAsync();
|
|
41
|
-
} catch (err: any) {
|
|
42
|
-
throw new Error(`Valid eas.json is required to migrate to the new format\n${err.message}`);
|
|
43
|
-
}
|
|
44
|
-
const rawEasJson = (await readEasJsonAsync(projectDir)) as unknown as DeprecatedEasJson;
|
|
45
|
-
const profiles = new Set<string>();
|
|
46
|
-
Object.keys(rawEasJson.builds.android ?? {}).forEach(profile => profiles.add(profile));
|
|
47
|
-
Object.keys(rawEasJson.builds.ios ?? {}).forEach(profile => profiles.add(profile));
|
|
48
|
-
|
|
49
|
-
const result: EasJson = {
|
|
50
|
-
build: {},
|
|
51
|
-
};
|
|
52
|
-
profiles.forEach(profileName => {
|
|
53
|
-
result.build[profileName] = migrateProfile(rawEasJson, profileName);
|
|
54
|
-
});
|
|
55
|
-
await fs.writeFile(path.join(projectDir, 'eas.json'), `${JSON.stringify(result, null, 2)}\n`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async function readEasJsonAsync(projectDir: string): Promise<JSONObject> {
|
|
59
|
-
try {
|
|
60
|
-
const easJsonPath = path.join(projectDir, 'eas.json');
|
|
61
|
-
return JsonFile.read(easJsonPath);
|
|
62
|
-
} catch (err: any) {
|
|
63
|
-
if (err.code === 'EJSONPARSE') {
|
|
64
|
-
err.message = `Found invalid JSON in eas.json. ${err.message}`;
|
|
65
|
-
}
|
|
66
|
-
throw err;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
interface MigrateContext {
|
|
71
|
-
androidProfile?: Partial<AndroidBuildProfile>;
|
|
72
|
-
iosProfile?: Partial<IosBuildProfile>;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function migrateProfile(
|
|
76
|
-
rawEasJson: DeprecatedEasJson,
|
|
77
|
-
profileName: string
|
|
78
|
-
): RawBuildProfile {
|
|
79
|
-
const androidProfile = (rawEasJson?.builds?.android?.[profileName] ??
|
|
80
|
-
{}) as AndroidBuildProfile & { extends?: string };
|
|
81
|
-
const iosProfile = (rawEasJson?.builds?.ios?.[profileName] ?? {}) as IosBuildProfile & {
|
|
82
|
-
extends?: string;
|
|
83
|
-
};
|
|
84
|
-
let profile: RawBuildProfile = {
|
|
85
|
-
android: {},
|
|
86
|
-
ios: {},
|
|
87
|
-
};
|
|
88
|
-
const ctx = { androidProfile, iosProfile };
|
|
89
|
-
const androidCtx = { androidProfile };
|
|
90
|
-
const iosCtx = { iosProfile };
|
|
91
|
-
|
|
92
|
-
// simple common values
|
|
93
|
-
profile = migrateProperty('credentialsSource', profile, ctx);
|
|
94
|
-
profile = migrateProperty('releaseChannel', profile, ctx);
|
|
95
|
-
profile = migrateProperty('channel', profile, ctx);
|
|
96
|
-
profile = migrateProperty('node', profile, ctx);
|
|
97
|
-
profile = migrateProperty('yarn', profile, ctx);
|
|
98
|
-
profile = migrateProperty('expoCli', profile, ctx);
|
|
99
|
-
if (androidProfile.extends && androidProfile.extends === iosProfile.extends) {
|
|
100
|
-
profile = migrateProperty('extends', profile, ctx);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// android
|
|
104
|
-
profile = migrateProperty('image', profile, androidCtx);
|
|
105
|
-
profile = migrateProperty('ndk', profile, androidCtx);
|
|
106
|
-
profile = migrateProperty('gradleCommand', profile, androidCtx);
|
|
107
|
-
profile = migrateProperty('artifactPath', profile, androidCtx);
|
|
108
|
-
profile = migrateProperty('env', profile, androidCtx);
|
|
109
|
-
profile = migrateProperty('cache', profile, androidCtx);
|
|
110
|
-
profile = migrateProperty('withoutCredentials', profile, androidCtx);
|
|
111
|
-
|
|
112
|
-
// ios
|
|
113
|
-
profile = migrateProperty('enterpriseProvisioning', profile, iosCtx);
|
|
114
|
-
profile = migrateProperty('autoIncrement', profile, iosCtx);
|
|
115
|
-
profile = migrateProperty('image', profile, iosCtx);
|
|
116
|
-
profile = migrateProperty('bundler', profile, iosCtx);
|
|
117
|
-
profile = migrateProperty('fastlane', profile, iosCtx);
|
|
118
|
-
profile = migrateProperty('cocoapods', profile, iosCtx);
|
|
119
|
-
profile = migrateProperty('artifactPath', profile, iosCtx);
|
|
120
|
-
profile = migrateProperty('scheme', profile, iosCtx);
|
|
121
|
-
profile = migrateProperty('env', profile, iosCtx);
|
|
122
|
-
profile = migrateProperty('cache', profile, iosCtx);
|
|
123
|
-
|
|
124
|
-
profile = migrateProperty('developmentClient', profile, {
|
|
125
|
-
androidProfile: {
|
|
126
|
-
...androidProfile,
|
|
127
|
-
developmentClient:
|
|
128
|
-
androidProfile.buildType === Android.BuildType.DEVELOPMENT_CLIENT || undefined,
|
|
129
|
-
} as any,
|
|
130
|
-
iosProfile: {
|
|
131
|
-
...iosProfile,
|
|
132
|
-
developmentClient: iosProfile.buildType === Ios.BuildType.DEVELOPMENT_CLIENT || undefined,
|
|
133
|
-
} as any,
|
|
134
|
-
});
|
|
135
|
-
if (
|
|
136
|
-
androidProfile.buildType &&
|
|
137
|
-
androidProfile.buildType !== Android.BuildType.DEVELOPMENT_CLIENT
|
|
138
|
-
) {
|
|
139
|
-
profile.android!.buildType = androidProfile.buildType;
|
|
140
|
-
}
|
|
141
|
-
if (iosProfile.distribution === 'simulator') {
|
|
142
|
-
profile.ios!.simulator = true;
|
|
143
|
-
delete (iosProfile as any).distribution;
|
|
144
|
-
}
|
|
145
|
-
profile = migrateProperty('distribution', profile, ctx);
|
|
146
|
-
|
|
147
|
-
if (iosProfile.schemeBuildConfiguration) {
|
|
148
|
-
profile.ios!.buildConfiguration = iosProfile.schemeBuildConfiguration;
|
|
149
|
-
}
|
|
150
|
-
if (Object.keys(profile.android ?? {}).length === 0) {
|
|
151
|
-
delete profile.android;
|
|
152
|
-
}
|
|
153
|
-
if (Object.keys(profile.ios ?? {}).length === 0) {
|
|
154
|
-
delete profile.ios;
|
|
155
|
-
}
|
|
156
|
-
return profile;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function migrateProperty(
|
|
160
|
-
key: string,
|
|
161
|
-
profile: RawBuildProfile,
|
|
162
|
-
ctx: MigrateContext
|
|
163
|
-
): RawBuildProfile {
|
|
164
|
-
const androidProperty = (ctx.androidProfile as any)?.[key];
|
|
165
|
-
const iosProperty = (ctx.iosProfile as any)?.[key];
|
|
166
|
-
|
|
167
|
-
if (androidProperty && iosProperty && androidProperty === iosProperty) {
|
|
168
|
-
return { ...profile, [key]: androidProperty };
|
|
169
|
-
} else {
|
|
170
|
-
return {
|
|
171
|
-
...profile,
|
|
172
|
-
android: {
|
|
173
|
-
...profile.android,
|
|
174
|
-
...(androidProperty ? { [key]: androidProperty } : {}),
|
|
175
|
-
},
|
|
176
|
-
ios: {
|
|
177
|
-
...profile.ios,
|
|
178
|
-
...(iosProperty ? { [key]: iosProperty } : {}),
|
|
179
|
-
},
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
}
|