eas-cli 21.0.0 → 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 +158 -118
- package/build/build/utils/url.d.ts +1 -0
- package/build/build/utils/url.js +6 -1
- 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/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/simulator/start.js +1 -0
- package/build/graphql/generated.d.ts +50 -12
- package/build/graphql/mutations/AppMutation.d.ts +2 -0
- package/build/graphql/mutations/AppMutation.js +19 -0
- 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 +1934 -1726
- package/package.json +6 -6
|
@@ -5,19 +5,29 @@ import { selectPaginatedAsync } from '../utils/relay';
|
|
|
5
5
|
export declare function getSignedDeploymentUrlAsync(graphqlClient: ExpoGraphqlClient, options: {
|
|
6
6
|
appId: string;
|
|
7
7
|
deploymentIdentifier?: string | null;
|
|
8
|
+
/** Custom dev domain name (preview URL subdomain) requested through the `--dev-domain` flag */
|
|
9
|
+
devDomainName?: string;
|
|
8
10
|
/** Callback which is invoked when the project is going to setup the dev domain */
|
|
9
11
|
onSetupDevDomain?: () => any;
|
|
10
12
|
/** If the terminal is running in non interactive mode or not */
|
|
11
13
|
nonInteractive?: boolean;
|
|
12
14
|
}): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Assert that a user-provided dev domain name (preview URL subdomain) is valid.
|
|
17
|
+
* Unlike the interactive prompt, which reformats invalid input while typing,
|
|
18
|
+
* this throws an error when the name contains invalid characters.
|
|
19
|
+
*/
|
|
20
|
+
export declare function assertValidDevDomainName(name: string): void;
|
|
13
21
|
/**
|
|
14
22
|
* Assign a dev domain name to a project.
|
|
23
|
+
* - When a dev domain name is provided, it will assign that name without prompting.
|
|
15
24
|
* - When running in interactive mode, it will prompt the user with a suggested domain name.
|
|
16
25
|
* - When running in non interactive mode, it will auto-assign the suggested domain name.
|
|
17
26
|
*/
|
|
18
|
-
export declare function assignDevDomainNameAsync({ graphqlClient, appId, nonInteractive, }: {
|
|
27
|
+
export declare function assignDevDomainNameAsync({ graphqlClient, appId, devDomainName: requestedDevDomainName, nonInteractive, }: {
|
|
19
28
|
graphqlClient: ExpoGraphqlClient;
|
|
20
29
|
appId: string;
|
|
30
|
+
devDomainName?: string;
|
|
21
31
|
nonInteractive?: boolean;
|
|
22
32
|
}): ReturnType<typeof DeploymentsMutation.assignDevDomainNameAsync>;
|
|
23
33
|
export declare function assignWorkerDeploymentAliasAsync({ graphqlClient, appId, deploymentId, aliasName, }: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSignedDeploymentUrlAsync = getSignedDeploymentUrlAsync;
|
|
4
|
+
exports.assertValidDevDomainName = assertValidDevDomainName;
|
|
4
5
|
exports.assignDevDomainNameAsync = assignDevDomainNameAsync;
|
|
5
6
|
exports.assignWorkerDeploymentAliasAsync = assignWorkerDeploymentAliasAsync;
|
|
6
7
|
exports.assignWorkerDeploymentProductionAsync = assignWorkerDeploymentProductionAsync;
|
|
@@ -18,8 +19,18 @@ const prompts_1 = require("../prompts");
|
|
|
18
19
|
const memoize_1 = require("../utils/expodash/memoize");
|
|
19
20
|
const relay_1 = require("../utils/relay");
|
|
20
21
|
async function getSignedDeploymentUrlAsync(graphqlClient, options) {
|
|
22
|
+
let currentDevDomainName = null;
|
|
23
|
+
if (options.devDomainName) {
|
|
24
|
+
currentDevDomainName = await queries_1.DeploymentsQuery.getDevDomainNameByAppIdAsync(graphqlClient, {
|
|
25
|
+
appId: options.appId,
|
|
26
|
+
});
|
|
27
|
+
if (currentDevDomainName && currentDevDomainName !== options.devDomainName) {
|
|
28
|
+
throw new Error(`The project's preview URL is already set to "${currentDevDomainName}.${logs_1.EXPO_BASE_DOMAIN}.app" and cannot be changed to "${options.devDomainName}.${logs_1.EXPO_BASE_DOMAIN}.app" through "eas deploy".\nRemove the --dev-domain flag to deploy to the existing preview URL.`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
let signedUrl;
|
|
21
32
|
try {
|
|
22
|
-
|
|
33
|
+
signedUrl = await mutations_1.DeploymentsMutation.createSignedDeploymentUrlAsync(graphqlClient, {
|
|
23
34
|
appId: options.appId,
|
|
24
35
|
deploymentIdentifier: options.deploymentIdentifier,
|
|
25
36
|
});
|
|
@@ -36,11 +47,23 @@ async function getSignedDeploymentUrlAsync(graphqlClient, options) {
|
|
|
36
47
|
await assignDevDomainNameAsync({
|
|
37
48
|
graphqlClient,
|
|
38
49
|
appId: options.appId,
|
|
50
|
+
devDomainName: options.devDomainName,
|
|
39
51
|
nonInteractive: options.nonInteractive,
|
|
40
52
|
});
|
|
41
|
-
// Retry creating the signed URL
|
|
42
|
-
|
|
53
|
+
// Retry creating the signed URL. The dev domain name was just assigned, so drop it from
|
|
54
|
+
// the retry to skip the pre-checks (and their extra query) — it is known to be set now.
|
|
55
|
+
return await getSignedDeploymentUrlAsync(graphqlClient, {
|
|
56
|
+
...options,
|
|
57
|
+
devDomainName: undefined,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
// The --dev-domain flag is applied when the server requires a preview URL to be assigned
|
|
61
|
+
// before the first deployment. If the deployment was accepted without that assignment,
|
|
62
|
+
// fail instead of silently deploying without the requested preview URL.
|
|
63
|
+
if (options.devDomainName && !currentDevDomainName) {
|
|
64
|
+
throw new Error(`The --dev-domain flag was provided, but the project's preview URL was not assigned as part of this deployment.\nRemove the --dev-domain flag and set the preview URL from the project's hosting settings on the website instead.`);
|
|
43
65
|
}
|
|
66
|
+
return signedUrl;
|
|
44
67
|
}
|
|
45
68
|
const DEV_DOMAIN_INVALID_START_END_CHARACTERS = /^[^a-z0-9]+|[^a-z0-9-]+$/;
|
|
46
69
|
const DEV_DOMAIN_INVALID_REPLACEMENT_HYPHEN = /[^a-z0-9-]+/;
|
|
@@ -58,6 +81,36 @@ function formatDevDomainName(name = '') {
|
|
|
58
81
|
.replace(DEV_DOMAIN_INVALID_MULTIPLE_HYPHENS, '-')
|
|
59
82
|
.trim();
|
|
60
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Validate a dev domain name (preview URL subdomain), matching the rules of the interactive prompt.
|
|
86
|
+
* Returns `true` when valid, or an error message describing why the name is invalid.
|
|
87
|
+
*/
|
|
88
|
+
function validateDevDomainName(value) {
|
|
89
|
+
if (!value) {
|
|
90
|
+
return 'You have to choose a preview URL for your project';
|
|
91
|
+
}
|
|
92
|
+
if (value.length < 3) {
|
|
93
|
+
return 'Preview URLs must be at least 3 characters long';
|
|
94
|
+
}
|
|
95
|
+
if (value.endsWith('-')) {
|
|
96
|
+
return 'Preview URLs cannot end with a hyphen (-)';
|
|
97
|
+
}
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Assert that a user-provided dev domain name (preview URL subdomain) is valid.
|
|
102
|
+
* Unlike the interactive prompt, which reformats invalid input while typing,
|
|
103
|
+
* this throws an error when the name contains invalid characters.
|
|
104
|
+
*/
|
|
105
|
+
function assertValidDevDomainName(name) {
|
|
106
|
+
const validationResult = validateDevDomainName(name);
|
|
107
|
+
if (validationResult !== true) {
|
|
108
|
+
throw new Error(validationResult);
|
|
109
|
+
}
|
|
110
|
+
if (formatDevDomainName(name) !== name) {
|
|
111
|
+
throw new Error(`Preview URLs can only contain lowercase letters, numbers, and non-consecutive hyphens (-), and cannot start or end with a hyphen: "${name}"`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
61
114
|
async function promptDevDomainNameAsync(initialDevDomain) {
|
|
62
115
|
const rootDomain = `.${logs_1.EXPO_BASE_DOMAIN}.app`;
|
|
63
116
|
const memoizedFormatDevDomainName = (0, memoize_1.memoize)(formatDevDomainName);
|
|
@@ -66,18 +119,7 @@ async function promptDevDomainNameAsync(initialDevDomain) {
|
|
|
66
119
|
name: 'name',
|
|
67
120
|
message: 'Choose a preview URL for your project:',
|
|
68
121
|
initial: initialDevDomain,
|
|
69
|
-
validate:
|
|
70
|
-
if (!value) {
|
|
71
|
-
return 'You have to choose a preview URL for your project';
|
|
72
|
-
}
|
|
73
|
-
if (value.length < 3) {
|
|
74
|
-
return 'Preview URLs must be at least 3 characters long';
|
|
75
|
-
}
|
|
76
|
-
if (value.endsWith('-')) {
|
|
77
|
-
return 'Preview URLs cannot end with a hyphen (-)';
|
|
78
|
-
}
|
|
79
|
-
return true;
|
|
80
|
-
},
|
|
122
|
+
validate: validateDevDomainName,
|
|
81
123
|
onState(state) {
|
|
82
124
|
const value = memoizedFormatDevDomainName(state.value);
|
|
83
125
|
if (value !== state.value) {
|
|
@@ -106,14 +148,16 @@ async function promptDevDomainNameAsync(initialDevDomain) {
|
|
|
106
148
|
}
|
|
107
149
|
/**
|
|
108
150
|
* Assign a dev domain name to a project.
|
|
151
|
+
* - When a dev domain name is provided, it will assign that name without prompting.
|
|
109
152
|
* - When running in interactive mode, it will prompt the user with a suggested domain name.
|
|
110
153
|
* - When running in non interactive mode, it will auto-assign the suggested domain name.
|
|
111
154
|
*/
|
|
112
|
-
async function assignDevDomainNameAsync({ graphqlClient, appId, nonInteractive, }) {
|
|
113
|
-
let devDomainName =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
155
|
+
async function assignDevDomainNameAsync({ graphqlClient, appId, devDomainName: requestedDevDomainName, nonInteractive, }) {
|
|
156
|
+
let devDomainName = requestedDevDomainName ??
|
|
157
|
+
(await queries_1.DeploymentsQuery.getSuggestedDevDomainByAppIdAsync(graphqlClient, {
|
|
158
|
+
appId,
|
|
159
|
+
}));
|
|
160
|
+
if (!requestedDevDomainName && !nonInteractive) {
|
|
117
161
|
devDomainName = await promptDevDomainNameAsync(devDomainName);
|
|
118
162
|
}
|
|
119
163
|
try {
|
|
@@ -128,9 +172,14 @@ async function assignDevDomainNameAsync({ graphqlClient, appId, nonInteractive,
|
|
|
128
172
|
if (!isChosenNameTaken) {
|
|
129
173
|
throw error;
|
|
130
174
|
}
|
|
131
|
-
if (
|
|
132
|
-
|
|
175
|
+
if (nonInteractive) {
|
|
176
|
+
throw new Error(requestedDevDomainName
|
|
177
|
+
? `The preview URL "${requestedDevDomainName}" is already taken, choose a different URL with the --dev-domain flag.`
|
|
178
|
+
: `The suggested preview URL "${devDomainName}" is already taken, choose a different URL with the --dev-domain flag.`);
|
|
133
179
|
}
|
|
180
|
+
// In interactive mode, fall back to the prompt so a taken name (requested or suggested)
|
|
181
|
+
// does not abort the deployment.
|
|
182
|
+
log_1.default.error(`The preview URL "${devDomainName}" is already taken, choose a different URL.`);
|
|
134
183
|
return await assignDevDomainNameAsync({ graphqlClient, appId, nonInteractive });
|
|
135
184
|
}
|
|
136
185
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
-
import { type PaginatedWorkerDeploymentsQueryVariables, SuggestedDevDomainNameQueryVariables, type WorkerDeploymentAliasFragment, type WorkerDeploymentFragment } from '../graphql/generated';
|
|
2
|
+
import { DevDomainNameByAppIdQueryVariables, type PaginatedWorkerDeploymentsQueryVariables, SuggestedDevDomainNameQueryVariables, type WorkerDeploymentAliasFragment, type WorkerDeploymentFragment } from '../graphql/generated';
|
|
3
3
|
import type { Connection } from '../utils/relay';
|
|
4
4
|
export declare const DeploymentsQuery: {
|
|
5
5
|
getAllDeploymentsPaginatedAsync(graphqlClient: ExpoGraphqlClient, { appId, first, after, last, before }: PaginatedWorkerDeploymentsQueryVariables): Promise<Connection<WorkerDeploymentFragment>>;
|
|
6
6
|
getSuggestedDevDomainByAppIdAsync(graphqlClient: ExpoGraphqlClient, { appId }: SuggestedDevDomainNameQueryVariables): Promise<string>;
|
|
7
|
+
getDevDomainNameByAppIdAsync(graphqlClient: ExpoGraphqlClient, { appId }: DevDomainNameByAppIdQueryVariables): Promise<string | null>;
|
|
7
8
|
getAllAliasesPaginatedAsync(graphqlClient: ExpoGraphqlClient, { appId, first, after, last, before, }: {
|
|
8
9
|
appId: string;
|
|
9
10
|
first?: number;
|
package/build/worker/queries.js
CHANGED
|
@@ -59,6 +59,24 @@ exports.DeploymentsQuery = {
|
|
|
59
59
|
.toPromise());
|
|
60
60
|
return data.app.byId.suggestedDevDomainName;
|
|
61
61
|
},
|
|
62
|
+
async getDevDomainNameByAppIdAsync(graphqlClient, { appId }) {
|
|
63
|
+
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
64
|
+
.query((0, graphql_tag_1.default) `
|
|
65
|
+
query DevDomainNameByAppId($appId: String!) {
|
|
66
|
+
app {
|
|
67
|
+
byId(appId: $appId) {
|
|
68
|
+
id
|
|
69
|
+
devDomainName {
|
|
70
|
+
id
|
|
71
|
+
name
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`, { appId }, { additionalTypenames: ['AppDevDomainName'] })
|
|
77
|
+
.toPromise());
|
|
78
|
+
return data.app.byId.devDomainName?.name ?? null;
|
|
79
|
+
},
|
|
62
80
|
async getAllAliasesPaginatedAsync(graphqlClient, { appId, first, after, last, before, }) {
|
|
63
81
|
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
64
82
|
.query((0, graphql_tag_1.default) `
|