eas-cli 20.5.1 → 21.0.1
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 +171 -178
- package/build/analytics/AnalyticsManager.js +3 -0
- package/build/analytics/agent.d.ts +5 -0
- package/build/analytics/agent.js +26 -0
- package/build/build/utils/url.d.ts +1 -0
- package/build/build/utils/url.js +6 -1
- package/build/commandUtils/workflow/buildProfileUtils.d.ts +11 -29
- package/build/commandUtils/workflow/buildProfileUtils.js +47 -126
- package/build/commandUtils/workflow/creation.d.ts +11 -3
- package/build/commandUtils/workflow/creation.js +151 -261
- package/build/commands/browse.d.ts +17 -0
- package/build/commands/browse.js +90 -0
- package/build/commands/deploy/index.d.ts +1 -0
- package/build/commands/deploy/index.js +15 -1
- package/build/commands/integrations/posthog/dashboard.d.ts +1 -0
- package/build/commands/integrations/posthog/dashboard.js +30 -6
- package/build/commands/observe/metrics.js +1 -1
- package/build/commands/open.d.ts +1 -4
- package/build/commands/open.js +4 -32
- package/build/commands/project/delete.d.ts +16 -0
- package/build/commands/project/delete.js +129 -0
- package/build/commands/project/init.d.ts +0 -7
- package/build/commands/project/init.js +4 -274
- package/build/commands/simulator/get.js +57 -4
- package/build/commands/simulator/start.js +1 -0
- package/build/commands/workflow/create.d.ts +3 -0
- package/build/commands/workflow/create.js +118 -87
- package/build/credentials/ios/appstore/bundleIdCapabilities.js +9 -3
- package/build/graphql/generated.d.ts +253 -253
- package/build/graphql/generated.js +41 -4
- package/build/graphql/mutations/AppMutation.d.ts +2 -0
- package/build/graphql/mutations/AppMutation.js +19 -0
- package/build/graphql/mutations/PostHogMutation.d.ts +2 -1
- package/build/graphql/mutations/PostHogMutation.js +14 -0
- package/build/graphql/queries/DeviceRunSessionQuery.js +15 -0
- package/build/graphql/queries/UserQuery.js +0 -10
- package/build/graphql/queries/WorkflowRunQuery.js +1 -0
- package/build/integrations/asc/utils.js +6 -4
- package/build/observe/metricNames.d.ts +1 -1
- package/build/observe/metricNames.js +7 -6
- package/build/project/android/applicationId.d.ts +2 -1
- package/build/project/android/applicationId.js +19 -11
- package/build/project/ios/bundleIdentifier.d.ts +2 -1
- package/build/project/ios/bundleIdentifier.js +19 -11
- package/build/project/projectInitialization.d.ts +9 -0
- package/build/project/projectInitialization.js +277 -0
- package/build/project/publish.js +73 -40
- package/build/user/sudo.d.ts +14 -0
- package/build/user/sudo.js +62 -0
- package/build/worker/deployment.d.ts +11 -1
- package/build/worker/deployment.js +71 -22
- package/build/worker/queries.d.ts +2 -1
- package/build/worker/queries.js +18 -0
- package/oclif.manifest.json +1764 -1602
- package/package.json +9 -8
- package/build/commands/project/onboarding.d.ts +0 -14
- package/build/commands/project/onboarding.js +0 -362
- package/build/graphql/mutations/UserPreferencesMutation.d.ts +0 -10
- package/build/graphql/mutations/UserPreferencesMutation.js +0 -41
|
@@ -6,24 +6,35 @@ const core_1 = require("@oclif/core");
|
|
|
6
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
7
|
const promises_1 = tslib_1.__importDefault(require("fs/promises"));
|
|
8
8
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
9
|
+
const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
|
|
9
10
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
11
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
11
12
|
const buildProfileUtils_1 = require("../../commandUtils/workflow/buildProfileUtils");
|
|
12
13
|
const creation_1 = require("../../commandUtils/workflow/creation");
|
|
13
14
|
const validation_1 = require("../../commandUtils/workflow/validation");
|
|
14
|
-
const log_1 = tslib_1.
|
|
15
|
+
const log_1 = tslib_1.__importStar(require("../../log"));
|
|
16
|
+
const expoConfig_1 = require("../../project/expoConfig");
|
|
17
|
+
const projectInitialization_1 = require("../../project/projectInitialization");
|
|
15
18
|
const prompts_1 = require("../../prompts");
|
|
16
19
|
const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
|
|
17
|
-
const workflowFile_1 = require("../../utils/workflowFile");
|
|
18
20
|
class WorkflowCreate extends EasCommand_1.default {
|
|
19
21
|
static description = 'create a new workflow configuration YAML file';
|
|
20
22
|
static args = {
|
|
21
23
|
name: core_1.Args.string({
|
|
22
|
-
description: 'Name of the workflow file
|
|
24
|
+
description: 'Name of the workflow file. When provided without --template, a placeholder workflow is created.',
|
|
23
25
|
required: false,
|
|
24
26
|
}),
|
|
25
27
|
};
|
|
26
28
|
static flags = {
|
|
29
|
+
template: core_1.Flags.option({
|
|
30
|
+
description: 'Template to use for the workflow file',
|
|
31
|
+
options: [
|
|
32
|
+
creation_1.WorkflowStarterName.BUILD,
|
|
33
|
+
creation_1.WorkflowStarterName.UPDATE,
|
|
34
|
+
creation_1.WorkflowStarterName.DEPLOY,
|
|
35
|
+
creation_1.WorkflowStarterName.CUSTOM,
|
|
36
|
+
],
|
|
37
|
+
})(),
|
|
27
38
|
'skip-validation': core_1.Flags.boolean({
|
|
28
39
|
description: 'If set, the workflow file will not be validated before being created',
|
|
29
40
|
default: false,
|
|
@@ -33,58 +44,60 @@ class WorkflowCreate extends EasCommand_1.default {
|
|
|
33
44
|
...this.ContextOptions.DynamicProjectConfig,
|
|
34
45
|
...this.ContextOptions.ProjectDir,
|
|
35
46
|
...this.ContextOptions.LoggedIn,
|
|
47
|
+
...this.ContextOptions.Vcs,
|
|
36
48
|
};
|
|
37
49
|
async runAsync() {
|
|
38
50
|
const { args: { name: argFileName }, flags, } = await this.parse(WorkflowCreate);
|
|
39
51
|
try {
|
|
40
|
-
const { getDynamicPrivateProjectConfigAsync, loggedIn: { graphqlClient }, projectDir, } = await this.getContextAsync(WorkflowCreate, {
|
|
52
|
+
const { getDynamicPrivateProjectConfigAsync, loggedIn: { actor, graphqlClient }, projectDir, vcsClient, } = await this.getContextAsync(WorkflowCreate, {
|
|
41
53
|
nonInteractive: false,
|
|
42
54
|
withServerSideEnvironment: null,
|
|
43
55
|
});
|
|
56
|
+
if (argFileName && !flags.template) {
|
|
57
|
+
await createPlaceholderWorkflowFileAsync({ argFileName, projectDir });
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const privateExpoConfig = await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir);
|
|
61
|
+
if (!privateExpoConfig.extra?.eas?.projectId) {
|
|
62
|
+
// Unlike `eas init`, we intentionally do not call `ensureOwnerSlugConsistencyAsync` here.
|
|
63
|
+
// The workflow scaffolder should only link/create a project ID, not rewrite the app
|
|
64
|
+
// config's `owner`/`slug` fields. If those are inconsistent, we leave them for `eas init`
|
|
65
|
+
// to reconcile.
|
|
66
|
+
await (0, projectInitialization_1.initializeWithoutExplicitIDAsync)(graphqlClient, actor, projectDir, {
|
|
67
|
+
force: false,
|
|
68
|
+
nonInteractive: false,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
44
71
|
const { exp: originalExpoConfig, projectId } = await getDynamicPrivateProjectConfigAsync();
|
|
72
|
+
let workflowStarter = flags.template
|
|
73
|
+
? (0, nullthrows_1.default)(creation_1.workflowStarters.find(s => s.name === flags.template))
|
|
74
|
+
: await chooseTemplateAsync();
|
|
45
75
|
let expoConfig = originalExpoConfig;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
workflowStarter
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!shouldProceed) {
|
|
58
|
-
workflowStarter = undefined;
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
default:
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
switch (workflowStarter.name) {
|
|
67
|
-
case creation_1.WorkflowStarterName.DEPLOY:
|
|
68
|
-
case creation_1.WorkflowStarterName.UPDATE: {
|
|
69
|
-
const shouldProceed = await (0, buildProfileUtils_1.runUpdateConfigureIfNeededAsync)({
|
|
70
|
-
projectDir,
|
|
71
|
-
expoConfig,
|
|
72
|
-
});
|
|
73
|
-
if (!shouldProceed) {
|
|
74
|
-
workflowStarter = undefined;
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
// Need to refetch the Expo config because it may have changed
|
|
78
|
-
expoConfig = (await getDynamicPrivateProjectConfigAsync()).exp;
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
default:
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
76
|
+
if (workflowStarter.name === creation_1.WorkflowStarterName.BUILD ||
|
|
77
|
+
workflowStarter.name === creation_1.WorkflowStarterName.UPDATE ||
|
|
78
|
+
workflowStarter.name === creation_1.WorkflowStarterName.DEPLOY) {
|
|
79
|
+
expoConfig = await configureProjectForStarterAsync({
|
|
80
|
+
workflowStarter,
|
|
81
|
+
projectDir,
|
|
82
|
+
expoConfig: originalExpoConfig,
|
|
83
|
+
projectId,
|
|
84
|
+
vcsClient,
|
|
85
|
+
getDynamicPrivateProjectConfigAsync,
|
|
86
|
+
});
|
|
84
87
|
}
|
|
85
|
-
const { fileName, filePath } = await
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
const { fileName, filePath } = await resolveTemplateFileNameAsync({
|
|
89
|
+
argFileName,
|
|
90
|
+
projectDir,
|
|
91
|
+
workflowStarter,
|
|
92
|
+
});
|
|
93
|
+
workflowStarter = await (0, creation_1.customizeTemplateIfNeededAsync)({
|
|
94
|
+
workflowStarter,
|
|
95
|
+
projectDir,
|
|
96
|
+
expoConfig,
|
|
97
|
+
graphqlClient,
|
|
98
|
+
projectId,
|
|
99
|
+
vcsClient,
|
|
100
|
+
});
|
|
88
101
|
log_1.default.debug(`Creating workflow file ${fileName} from template ${workflowStarter.name}`);
|
|
89
102
|
const yamlString = [
|
|
90
103
|
workflowStarter.header,
|
|
@@ -94,28 +107,53 @@ class WorkflowCreate extends EasCommand_1.default {
|
|
|
94
107
|
await (0, validation_1.validateWorkflowFileAsync)({ yamlConfig: yamlString, filePath: fileName }, projectDir, graphqlClient, projectId);
|
|
95
108
|
}
|
|
96
109
|
await ensureWorkflowsDirectoryExistsAsync({ projectDir });
|
|
97
|
-
|
|
110
|
+
await promises_1.default.writeFile(filePath, yamlString);
|
|
98
111
|
log_1.default.withTick(`Created ${chalk_1.default.bold(filePath)}`);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
log_1.default.addNewLineIfNone();
|
|
104
|
-
log_1.default.log('Next steps:');
|
|
105
|
-
log_1.default.addNewLineIfNone();
|
|
106
|
-
log_1.default.log((0, formatFields_1.default)(workflowStarter.nextSteps.map((step, index) => ({
|
|
107
|
-
label: `${index + 1}.`,
|
|
108
|
-
value: step,
|
|
109
|
-
}))));
|
|
110
|
-
}
|
|
112
|
+
logNextSteps([
|
|
113
|
+
...(workflowStarter.nextSteps ?? []).map(step => `${chalk_1.default.yellow('[Action required]')} ${step}`),
|
|
114
|
+
(0, creation_1.howToRunWorkflow)(fileName, workflowStarter),
|
|
115
|
+
]);
|
|
111
116
|
}
|
|
112
117
|
catch (error) {
|
|
113
118
|
(0, validation_1.logWorkflowValidationErrors)(error);
|
|
114
119
|
log_1.default.error('Failed to create workflow file.');
|
|
120
|
+
process.exitCode = 1;
|
|
115
121
|
}
|
|
116
122
|
}
|
|
117
123
|
}
|
|
118
124
|
exports.WorkflowCreate = WorkflowCreate;
|
|
125
|
+
async function configureProjectForStarterAsync({ workflowStarter, projectDir, expoConfig, projectId, vcsClient, getDynamicPrivateProjectConfigAsync, }) {
|
|
126
|
+
await (0, buildProfileUtils_1.configureEasBuildIfNeededAsync)({ projectDir, expoConfig, vcsClient });
|
|
127
|
+
if (workflowStarter.name === creation_1.WorkflowStarterName.UPDATE ||
|
|
128
|
+
workflowStarter.name === creation_1.WorkflowStarterName.DEPLOY) {
|
|
129
|
+
await (0, buildProfileUtils_1.configureEasUpdateIfNeededAsync)({ projectDir, expoConfig, projectId, vcsClient });
|
|
130
|
+
}
|
|
131
|
+
return (await getDynamicPrivateProjectConfigAsync()).exp;
|
|
132
|
+
}
|
|
133
|
+
function logNextSteps(steps) {
|
|
134
|
+
log_1.default.addNewLineIfNone();
|
|
135
|
+
log_1.default.log('➡️ Next steps:');
|
|
136
|
+
log_1.default.addNewLineIfNone();
|
|
137
|
+
log_1.default.log((0, formatFields_1.default)(steps.map((step, index) => ({
|
|
138
|
+
label: `${index + 1}.`,
|
|
139
|
+
value: step,
|
|
140
|
+
}))));
|
|
141
|
+
}
|
|
142
|
+
async function createPlaceholderWorkflowFileAsync({ argFileName, projectDir, }) {
|
|
143
|
+
const fileName = ensureYamlExtension(argFileName);
|
|
144
|
+
const filePath = path_1.default.join(projectDir, '.eas', 'workflows', fileName);
|
|
145
|
+
if (await fs_extra_1.default.pathExists(filePath)) {
|
|
146
|
+
log_1.default.error(`Workflow file already exists: ${chalk_1.default.bold(filePath)}`);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
await ensureWorkflowsDirectoryExistsAsync({ projectDir });
|
|
150
|
+
await promises_1.default.writeFile(filePath, creation_1.PLACEHOLDER_WORKFLOW_CONTENTS);
|
|
151
|
+
log_1.default.withTick(`Created ${chalk_1.default.bold(filePath)}`);
|
|
152
|
+
logNextSteps([
|
|
153
|
+
`Fill in the "name", "on", and "jobs" fields. Learn more: ${(0, log_1.link)('https://docs.expo.dev/eas/workflows/syntax/')}`,
|
|
154
|
+
`Run this workflow with ${chalk_1.default.bold(`eas workflow:run ${fileName}`)}`,
|
|
155
|
+
]);
|
|
156
|
+
}
|
|
119
157
|
async function ensureWorkflowsDirectoryExistsAsync({ projectDir, }) {
|
|
120
158
|
try {
|
|
121
159
|
await promises_1.default.access(path_1.default.join(projectDir, '.eas', 'workflows'));
|
|
@@ -137,35 +175,28 @@ async function chooseTemplateAsync() {
|
|
|
137
175
|
})).starter;
|
|
138
176
|
return workflowStarter;
|
|
139
177
|
}
|
|
140
|
-
async function
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
})).fileName;
|
|
150
|
-
if (!fileName) {
|
|
151
|
-
fileName = undefined;
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
try {
|
|
155
|
-
workflowFile_1.WorkflowFile.validateYamlExtension(fileName);
|
|
156
|
-
}
|
|
157
|
-
catch (error) {
|
|
158
|
-
log_1.default.error(error instanceof Error ? error.message : 'Invalid YAML file name extension');
|
|
159
|
-
fileName = undefined;
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
178
|
+
async function resolveTemplateFileNameAsync({ argFileName, projectDir, workflowStarter, }) {
|
|
179
|
+
const baseName = argFileName ? ensureYamlExtension(argFileName) : workflowStarter.defaultFileName;
|
|
180
|
+
const ext = path_1.default.extname(baseName);
|
|
181
|
+
const stem = baseName.slice(0, baseName.length - ext.length);
|
|
182
|
+
let fileName = baseName;
|
|
183
|
+
let filePath = path_1.default.join(projectDir, '.eas', 'workflows', fileName);
|
|
184
|
+
let counter = 1;
|
|
185
|
+
while (await fs_extra_1.default.pathExists(filePath)) {
|
|
186
|
+
fileName = `${stem}-${counter}${ext}`;
|
|
162
187
|
filePath = path_1.default.join(projectDir, '.eas', 'workflows', fileName);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
188
|
+
counter++;
|
|
189
|
+
}
|
|
190
|
+
return { fileName, filePath };
|
|
191
|
+
}
|
|
192
|
+
function ensureYamlExtension(name) {
|
|
193
|
+
const ext = path_1.default.extname(name);
|
|
194
|
+
if (!ext) {
|
|
195
|
+
return `${name}.yml`;
|
|
196
|
+
}
|
|
197
|
+
const lowerExt = ext.toLowerCase();
|
|
198
|
+
if (lowerExt === '.yml' || lowerExt === '.yaml') {
|
|
199
|
+
return name;
|
|
169
200
|
}
|
|
170
|
-
|
|
201
|
+
throw new Error(`Workflow file name must end with .yml or .yaml, but got "${name}".`);
|
|
171
202
|
}
|
|
@@ -43,10 +43,16 @@ async function syncCapabilitiesForEntitlementsAsync(bundleId, entitlements = {},
|
|
|
43
43
|
await bundleId.updateBundleIdCapabilityAsync(modifiedRequest);
|
|
44
44
|
}
|
|
45
45
|
catch (error) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
log_1.default.error('Failed to patch capabilities:', (0, util_1.inspect)(modifiedRequest, { depth: null, colors: true }));
|
|
47
|
+
const context = `Failed to update Apple capabilities for app "${bundleId.attributes.identifier}".\nYou can enable or disable capabilities manually in the Apple developer console at https://developer.apple.com/account/resources/identifiers/bundleId/edit/${bundleId.id}, then re-run this command.\nAuto capability syncing can be disabled with the environment variable \`EXPO_NO_CAPABILITY_SYNC=1\`.`;
|
|
48
|
+
if (error.message?.match?.(/bundle '[\w\d]+' cannot be deleted. Delete all the Apps/)) {
|
|
49
|
+
throw new Error(`${context}\n${error.message}`);
|
|
49
50
|
}
|
|
51
|
+
// Preserve the underlying Apple error and stack, but attach the same
|
|
52
|
+
// actionable context so the user knows how to unblock their build.
|
|
53
|
+
const wrapped = new Error(`${context}\n\nApple API error: ${error.message}`);
|
|
54
|
+
wrapped.cause = error;
|
|
55
|
+
throw wrapped;
|
|
50
56
|
}
|
|
51
57
|
}
|
|
52
58
|
return { enabled: enabledCapabilityNames, disabled: disabledCapabilityNames };
|