eas-cli 16.20.4 → 16.22.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/README.md +87 -87
- package/build/commandUtils/workflow/buildProfileUtils.d.ts +36 -0
- package/build/commandUtils/workflow/buildProfileUtils.js +210 -0
- package/build/commandUtils/workflow/creation.d.ts +20 -0
- package/build/commandUtils/workflow/creation.js +462 -0
- package/build/commandUtils/workflow/validation.d.ts +4 -0
- package/build/commandUtils/workflow/validation.js +8 -4
- package/build/commands/deploy/index.js +8 -1
- package/build/commands/workflow/create.d.ts +4 -3
- package/build/commands/workflow/create.js +130 -56
- package/build/graphql/generated.d.ts +30 -0
- package/build/graphql/types/Workflow.js +11 -0
- package/build/worker/assets.d.ts +5 -0
- package/build/worker/assets.js +24 -1
- package/oclif.manifest.json +8 -5
- package/package.json +2 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ExpoConfig } from '@expo/config';
|
|
2
|
+
import { BuildProfile, Platform } from '@expo/eas-json';
|
|
3
|
+
import { AndroidBuildProfile, IosBuildProfile } from '@expo/eas-json/build/build/types';
|
|
4
|
+
export declare function buildProfileNamesFromProjectAsync(projectDir: string): Promise<Set<string>>;
|
|
5
|
+
export declare function getBuildProfileAsync(projectDir: string, platform: Platform, profileName: string): Promise<BuildProfile<Platform>>;
|
|
6
|
+
export declare function buildProfilesFromProjectAsync(projectDir: string): Promise<Map<string, {
|
|
7
|
+
android: AndroidBuildProfile;
|
|
8
|
+
ios: IosBuildProfile;
|
|
9
|
+
}>>;
|
|
10
|
+
export declare function isBuildProfileForDevelopment(buildProfile: BuildProfile<Platform>, platform: Platform): boolean;
|
|
11
|
+
export declare function isIosBuildProfileForSimulator(buildProfile: BuildProfile<Platform.IOS>): boolean;
|
|
12
|
+
export declare function addAndroidDevelopmentBuildProfileToEasJsonAsync(projectDir: string, buildProfileName: string): Promise<void>;
|
|
13
|
+
export declare function addIosDevelopmentBuildProfileToEasJsonAsync(projectDir: string, buildProfileName: string, simulator: boolean): Promise<void>;
|
|
14
|
+
export declare function addProductionBuildProfileToEasJsonIfNeededAsync(projectDir: string): Promise<boolean>;
|
|
15
|
+
export declare function hasBuildConfigureBeenRunAsync({ projectDir, expoConfig, }: {
|
|
16
|
+
projectDir: string;
|
|
17
|
+
expoConfig: ExpoConfig;
|
|
18
|
+
}): Promise<boolean>;
|
|
19
|
+
export declare function hasUpdateConfigureBeenRunAsync({ projectDir, expoConfig, }: {
|
|
20
|
+
projectDir: string;
|
|
21
|
+
expoConfig: ExpoConfig;
|
|
22
|
+
}): Promise<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* Runs update:configure if needed. Returns a boolean (proceed with workflow creation, or not)
|
|
25
|
+
*/
|
|
26
|
+
export declare function runUpdateConfigureIfNeededAsync({ projectDir, expoConfig, }: {
|
|
27
|
+
projectDir: string;
|
|
28
|
+
expoConfig: ExpoConfig;
|
|
29
|
+
}): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Runs build:configure if needed. Returns a boolean (proceed with workflow creation, or not)
|
|
32
|
+
*/
|
|
33
|
+
export declare function runBuildConfigureIfNeededAsync({ projectDir, expoConfig, }: {
|
|
34
|
+
projectDir: string;
|
|
35
|
+
expoConfig: ExpoConfig;
|
|
36
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runBuildConfigureIfNeededAsync = exports.runUpdateConfigureIfNeededAsync = exports.hasUpdateConfigureBeenRunAsync = exports.hasBuildConfigureBeenRunAsync = exports.addProductionBuildProfileToEasJsonIfNeededAsync = exports.addIosDevelopmentBuildProfileToEasJsonAsync = exports.addAndroidDevelopmentBuildProfileToEasJsonAsync = exports.isIosBuildProfileForSimulator = exports.isBuildProfileForDevelopment = exports.buildProfilesFromProjectAsync = exports.getBuildProfileAsync = exports.buildProfileNamesFromProjectAsync = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const eas_json_1 = require("@expo/eas-json");
|
|
6
|
+
const configure_1 = tslib_1.__importDefault(require("../../commands/build/configure"));
|
|
7
|
+
const configure_2 = tslib_1.__importDefault(require("../../commands/update/configure"));
|
|
8
|
+
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
9
|
+
const prompts_1 = require("../../prompts");
|
|
10
|
+
async function buildProfileNamesFromProjectAsync(projectDir) {
|
|
11
|
+
const easJsonAccessor = eas_json_1.EasJsonAccessor.fromProjectPath(projectDir);
|
|
12
|
+
const buildProfileNames = new Set(easJsonAccessor && (await eas_json_1.EasJsonUtils.getBuildProfileNamesAsync(easJsonAccessor)));
|
|
13
|
+
return buildProfileNames;
|
|
14
|
+
}
|
|
15
|
+
exports.buildProfileNamesFromProjectAsync = buildProfileNamesFromProjectAsync;
|
|
16
|
+
async function getBuildProfileAsync(projectDir, platform, profileName) {
|
|
17
|
+
const easJsonAccessor = eas_json_1.EasJsonAccessor.fromProjectPath(projectDir);
|
|
18
|
+
const buildProfile = await eas_json_1.EasJsonUtils.getBuildProfileAsync(easJsonAccessor, platform, profileName);
|
|
19
|
+
return buildProfile;
|
|
20
|
+
}
|
|
21
|
+
exports.getBuildProfileAsync = getBuildProfileAsync;
|
|
22
|
+
async function buildProfilesFromProjectAsync(projectDir) {
|
|
23
|
+
const buildProfileNames = await buildProfileNamesFromProjectAsync(projectDir);
|
|
24
|
+
const buildProfiles = new Map();
|
|
25
|
+
for (const profileName of buildProfileNames) {
|
|
26
|
+
const iosBuildProfile = (await getBuildProfileAsync(projectDir, eas_json_1.Platform.IOS, profileName));
|
|
27
|
+
const androidBuildProfile = (await getBuildProfileAsync(projectDir, eas_json_1.Platform.ANDROID, profileName));
|
|
28
|
+
buildProfiles.set(profileName, { android: androidBuildProfile, ios: iosBuildProfile });
|
|
29
|
+
}
|
|
30
|
+
return buildProfiles;
|
|
31
|
+
}
|
|
32
|
+
exports.buildProfilesFromProjectAsync = buildProfilesFromProjectAsync;
|
|
33
|
+
function isBuildProfileForDevelopment(buildProfile, platform) {
|
|
34
|
+
if (buildProfile.developmentClient) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
if (platform === eas_json_1.Platform.ANDROID) {
|
|
38
|
+
return buildProfile.gradleCommand === ':app:assembleDebug';
|
|
39
|
+
}
|
|
40
|
+
if (platform === eas_json_1.Platform.IOS) {
|
|
41
|
+
return buildProfile.buildConfiguration === 'Debug';
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
exports.isBuildProfileForDevelopment = isBuildProfileForDevelopment;
|
|
46
|
+
function isIosBuildProfileForSimulator(buildProfile) {
|
|
47
|
+
return buildProfile.simulator ?? false;
|
|
48
|
+
}
|
|
49
|
+
exports.isIosBuildProfileForSimulator = isIosBuildProfileForSimulator;
|
|
50
|
+
async function addAndroidDevelopmentBuildProfileToEasJsonAsync(projectDir, buildProfileName) {
|
|
51
|
+
const easJsonAccessor = eas_json_1.EasJsonAccessor.fromProjectPath(projectDir);
|
|
52
|
+
await easJsonAccessor.readRawJsonAsync();
|
|
53
|
+
easJsonAccessor.patch(easJsonRawObject => {
|
|
54
|
+
easJsonRawObject.build = {
|
|
55
|
+
...easJsonRawObject.build,
|
|
56
|
+
[buildProfileName]: {
|
|
57
|
+
developmentClient: true,
|
|
58
|
+
distribution: 'internal',
|
|
59
|
+
android: {
|
|
60
|
+
gradleCommand: ':app:assembleDebug',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
return easJsonRawObject;
|
|
65
|
+
});
|
|
66
|
+
await easJsonAccessor.writeAsync();
|
|
67
|
+
}
|
|
68
|
+
exports.addAndroidDevelopmentBuildProfileToEasJsonAsync = addAndroidDevelopmentBuildProfileToEasJsonAsync;
|
|
69
|
+
async function addIosDevelopmentBuildProfileToEasJsonAsync(projectDir, buildProfileName, simulator) {
|
|
70
|
+
const easJsonAccessor = eas_json_1.EasJsonAccessor.fromProjectPath(projectDir);
|
|
71
|
+
await easJsonAccessor.readRawJsonAsync();
|
|
72
|
+
easJsonAccessor.patch(easJsonRawObject => {
|
|
73
|
+
easJsonRawObject.build = {
|
|
74
|
+
...easJsonRawObject.build,
|
|
75
|
+
[buildProfileName]: {
|
|
76
|
+
developmentClient: true,
|
|
77
|
+
distribution: 'internal',
|
|
78
|
+
ios: {
|
|
79
|
+
buildConfiguration: 'Debug',
|
|
80
|
+
simulator,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
return easJsonRawObject;
|
|
85
|
+
});
|
|
86
|
+
await easJsonAccessor.writeAsync();
|
|
87
|
+
}
|
|
88
|
+
exports.addIosDevelopmentBuildProfileToEasJsonAsync = addIosDevelopmentBuildProfileToEasJsonAsync;
|
|
89
|
+
async function addProductionBuildProfileToEasJsonIfNeededAsync(projectDir) {
|
|
90
|
+
const easJsonAccessor = eas_json_1.EasJsonAccessor.fromProjectPath(projectDir);
|
|
91
|
+
await easJsonAccessor.readRawJsonAsync();
|
|
92
|
+
let profileAdded = false;
|
|
93
|
+
easJsonAccessor.patch(easJsonRawObject => {
|
|
94
|
+
if (!easJsonRawObject.build?.production) {
|
|
95
|
+
profileAdded = true;
|
|
96
|
+
easJsonRawObject.build = {
|
|
97
|
+
...(easJsonRawObject.build ?? {}),
|
|
98
|
+
production: {},
|
|
99
|
+
};
|
|
100
|
+
// Also add the profile to submit
|
|
101
|
+
easJsonRawObject.submit = {
|
|
102
|
+
...(easJsonRawObject.submit ?? {}),
|
|
103
|
+
production: {},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return easJsonRawObject;
|
|
107
|
+
});
|
|
108
|
+
if (profileAdded) {
|
|
109
|
+
log_1.default.log('Added missing production build profile to eas.json');
|
|
110
|
+
}
|
|
111
|
+
await easJsonAccessor.writeAsync();
|
|
112
|
+
return profileAdded;
|
|
113
|
+
}
|
|
114
|
+
exports.addProductionBuildProfileToEasJsonIfNeededAsync = addProductionBuildProfileToEasJsonIfNeededAsync;
|
|
115
|
+
async function hasBuildConfigureBeenRunAsync({ projectDir, expoConfig, }) {
|
|
116
|
+
// Is there a project ID in the Expo config?
|
|
117
|
+
if (!expoConfig.extra?.eas?.projectId) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
// Is there an eas.json?
|
|
121
|
+
const easJsonAccessor = eas_json_1.EasJsonAccessor.fromProjectPath(projectDir);
|
|
122
|
+
try {
|
|
123
|
+
await easJsonAccessor.readAsync();
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
exports.hasBuildConfigureBeenRunAsync = hasBuildConfigureBeenRunAsync;
|
|
131
|
+
async function hasUpdateConfigureBeenRunAsync({ projectDir, expoConfig, }) {
|
|
132
|
+
// Does the Expo config have an updates URL?
|
|
133
|
+
if (!expoConfig.updates?.url) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
// Does at least one build profile have a channel?
|
|
137
|
+
const easJsonAccessor = eas_json_1.EasJsonAccessor.fromProjectPath(projectDir);
|
|
138
|
+
try {
|
|
139
|
+
const easJson = await easJsonAccessor.readAsync();
|
|
140
|
+
return Object.values(easJson.build ?? {}).some(buildProfile => !!buildProfile.channel);
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.hasUpdateConfigureBeenRunAsync = hasUpdateConfigureBeenRunAsync;
|
|
147
|
+
/**
|
|
148
|
+
* Runs update:configure if needed. Returns a boolean (proceed with workflow creation, or not)
|
|
149
|
+
*/
|
|
150
|
+
async function runUpdateConfigureIfNeededAsync({ projectDir, expoConfig, }) {
|
|
151
|
+
if (await hasUpdateConfigureBeenRunAsync({
|
|
152
|
+
projectDir,
|
|
153
|
+
expoConfig,
|
|
154
|
+
})) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
const nextStep = (await (0, prompts_1.promptAsync)({
|
|
158
|
+
type: 'select',
|
|
159
|
+
name: 'nextStep',
|
|
160
|
+
message: 'You have chosen to create a workflow that requires EAS Update configuration. What would you like to do?',
|
|
161
|
+
choices: [
|
|
162
|
+
{ title: 'Configure EAS Update and then proceed', value: 'configure' },
|
|
163
|
+
{ title: 'EAS Update is already configured, proceed', value: 'proceed' },
|
|
164
|
+
{ title: 'Choose a different workflow template', value: 'repeat' },
|
|
165
|
+
],
|
|
166
|
+
})).nextStep;
|
|
167
|
+
switch (nextStep) {
|
|
168
|
+
case 'configure':
|
|
169
|
+
log_1.default.newLine();
|
|
170
|
+
await configure_2.default.run([]);
|
|
171
|
+
return true;
|
|
172
|
+
case 'proceed':
|
|
173
|
+
return true;
|
|
174
|
+
default:
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
exports.runUpdateConfigureIfNeededAsync = runUpdateConfigureIfNeededAsync;
|
|
179
|
+
/**
|
|
180
|
+
* Runs build:configure if needed. Returns a boolean (proceed with workflow creation, or not)
|
|
181
|
+
*/
|
|
182
|
+
async function runBuildConfigureIfNeededAsync({ projectDir, expoConfig, }) {
|
|
183
|
+
if (await hasBuildConfigureBeenRunAsync({
|
|
184
|
+
projectDir,
|
|
185
|
+
expoConfig,
|
|
186
|
+
})) {
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
const nextStep = (await (0, prompts_1.promptAsync)({
|
|
190
|
+
type: 'select',
|
|
191
|
+
name: 'nextStep',
|
|
192
|
+
message: 'You have chosen to create a workflow that requires EAS Build configuration. What would you like to do?',
|
|
193
|
+
choices: [
|
|
194
|
+
{ title: 'Configure EAS Build and then proceed', value: 'configure' },
|
|
195
|
+
{ title: 'EAS Build is already configured, proceed', value: 'proceed' },
|
|
196
|
+
{ title: 'Choose a different workflow template', value: 'repeat' },
|
|
197
|
+
],
|
|
198
|
+
})).nextStep;
|
|
199
|
+
switch (nextStep) {
|
|
200
|
+
case 'configure':
|
|
201
|
+
log_1.default.newLine();
|
|
202
|
+
await configure_1.default.run(['-p', 'all']);
|
|
203
|
+
return true;
|
|
204
|
+
case 'proceed':
|
|
205
|
+
return true;
|
|
206
|
+
default:
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
exports.runBuildConfigureIfNeededAsync = runBuildConfigureIfNeededAsync;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ExpoConfig } from '@expo/config';
|
|
2
|
+
export declare enum WorkflowStarterName {
|
|
3
|
+
BUILD = "build",
|
|
4
|
+
UPDATE = "update",
|
|
5
|
+
CUSTOM = "custom",
|
|
6
|
+
DEPLOY = "deploy"
|
|
7
|
+
}
|
|
8
|
+
export type WorkflowStarter = {
|
|
9
|
+
name: WorkflowStarterName;
|
|
10
|
+
displayName: string;
|
|
11
|
+
defaultFileName: string;
|
|
12
|
+
template: any;
|
|
13
|
+
header: string;
|
|
14
|
+
nextSteps?: string[];
|
|
15
|
+
};
|
|
16
|
+
export declare function howToRunWorkflow(workflowFileName: string, workflowStarter: WorkflowStarter): string;
|
|
17
|
+
export declare const workflowStarters: WorkflowStarter[];
|
|
18
|
+
export declare function addBuildJobsToDevelopmentBuildTemplateAsync(projectDir: string, workflowStarter: WorkflowStarter): Promise<WorkflowStarter>;
|
|
19
|
+
export declare function ensureProductionBuildProfileExistsAsync(projectDir: string, workflowStarter: WorkflowStarter): Promise<WorkflowStarter>;
|
|
20
|
+
export declare function customizeTemplateIfNeededAsync(workflowStarter: WorkflowStarter, projectDir: string, expoConfig: ExpoConfig): Promise<any>;
|