eas-cli 12.5.0 → 12.5.2
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 +72 -64
- package/build/build/build.js +4 -4
- package/build/build/evaluateConfigWithEnvVarsAsync.d.ts +1 -4
- package/build/build/evaluateConfigWithEnvVarsAsync.js +3 -6
- package/build/build/runBuildAndSubmit.d.ts +0 -2
- package/build/build/runBuildAndSubmit.js +0 -1
- package/build/commandUtils/flags.d.ts +9 -2
- package/build/commandUtils/flags.js +14 -21
- package/build/commands/build/index.d.ts +0 -2
- package/build/commands/build/index.js +0 -2
- package/build/commands/build/resign.d.ts +0 -1
- package/build/commands/build/resign.js +0 -2
- package/build/commands/build/version/get.d.ts +0 -1
- package/build/commands/build/version/get.js +0 -2
- package/build/commands/build/version/set.d.ts +0 -1
- package/build/commands/build/version/set.js +0 -3
- package/build/commands/build/version/sync.d.ts +0 -1
- package/build/commands/build/version/sync.js +0 -3
- package/build/commands/config.d.ts +0 -1
- package/build/commands/config.js +0 -2
- package/build/commands/env/create.d.ts +3 -1
- package/build/commands/env/create.js +106 -74
- package/build/commands/env/delete.d.ts +2 -2
- package/build/commands/env/delete.js +37 -26
- package/build/commands/env/exec.d.ts +23 -0
- package/build/commands/env/exec.js +125 -0
- package/build/commands/env/get.d.ts +2 -2
- package/build/commands/env/get.js +40 -26
- package/build/commands/env/link.d.ts +4 -2
- package/build/commands/env/link.js +53 -14
- package/build/commands/env/list.d.ts +1 -2
- package/build/commands/env/list.js +49 -42
- package/build/commands/env/pull.js +1 -1
- package/build/commands/env/unlink.d.ts +3 -2
- package/build/commands/env/unlink.js +48 -21
- package/build/commands/env/update.d.ts +4 -2
- package/build/commands/env/update.js +68 -66
- package/build/commands/update/index.js +0 -1
- package/build/commands/update/republish.d.ts +2 -0
- package/build/commands/update/republish.js +34 -4
- package/build/commands/worker/deploy.js +44 -21
- package/build/credentials/manager/Actions.d.ts +4 -2
- package/build/credentials/manager/Actions.js +2 -0
- package/build/credentials/manager/AndroidActions.js +5 -0
- package/build/credentials/manager/IosActions.js +5 -0
- package/build/credentials/manager/ManageAndroid.js +3 -0
- package/build/credentials/manager/ManageIos.js +3 -0
- package/build/graphql/generated.d.ts +103 -22
- package/build/graphql/mutations/EnvironmentVariableMutation.d.ts +13 -22
- package/build/graphql/mutations/EnvironmentVariableMutation.js +18 -2
- package/build/graphql/queries/EnvironmentVariablesQuery.d.ts +13 -7
- package/build/graphql/queries/EnvironmentVariablesQuery.js +21 -9
- package/build/graphql/types/EnvironmentVariable.js +2 -1
- package/build/graphql/types/Submission.js +1 -1
- package/build/project/publish.js +3 -2
- package/build/submit/utils/logs.js +16 -17
- package/build/update/getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync.d.ts +5 -0
- package/build/update/{getBranchNameFromChannelNameAsync.js → getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync.js} +8 -7
- package/build/update/republish.js +3 -2
- package/build/utils/prompts.d.ts +15 -3
- package/build/utils/prompts.js +33 -8
- package/build/utils/variableUtils.d.ts +4 -0
- package/build/utils/variableUtils.js +31 -0
- package/build/worker/assets.d.ts +7 -2
- package/build/worker/assets.js +5 -4
- package/build/worker/deployment.d.ts +10 -0
- package/build/worker/deployment.js +33 -22
- package/build/worker/upload.d.ts +1 -0
- package/build/worker/upload.js +29 -7
- package/build/worker/utils/logs.d.ts +14 -13
- package/build/worker/utils/logs.js +18 -18
- package/oclif.manifest.json +118 -108
- package/package.json +3 -3
- package/build/update/getBranchNameFromChannelNameAsync.d.ts +0 -2
- package/build/utils/formatVariable.d.ts +0 -2
- package/build/utils/formatVariable.js +0 -16
|
@@ -12,7 +12,7 @@ exports.EnvironmentVariableMutation = {
|
|
|
12
12
|
.mutation((0, graphql_tag_1.default) `
|
|
13
13
|
mutation LinkSharedEnvironmentVariable(
|
|
14
14
|
$appId: ID!
|
|
15
|
-
$environment: EnvironmentVariableEnvironment
|
|
15
|
+
$environment: EnvironmentVariableEnvironment
|
|
16
16
|
$environmentVariableId: ID!
|
|
17
17
|
) {
|
|
18
18
|
environmentVariable {
|
|
@@ -36,7 +36,7 @@ exports.EnvironmentVariableMutation = {
|
|
|
36
36
|
.mutation((0, graphql_tag_1.default) `
|
|
37
37
|
mutation UnlinkSharedEnvironmentVariable(
|
|
38
38
|
$appId: ID!
|
|
39
|
-
$environment: EnvironmentVariableEnvironment
|
|
39
|
+
$environment: EnvironmentVariableEnvironment
|
|
40
40
|
$environmentVariableId: ID!
|
|
41
41
|
) {
|
|
42
42
|
environmentVariable {
|
|
@@ -96,6 +96,22 @@ exports.EnvironmentVariableMutation = {
|
|
|
96
96
|
.toPromise());
|
|
97
97
|
return data.environmentVariable.createEnvironmentVariableForApp;
|
|
98
98
|
},
|
|
99
|
+
async updateAsync(graphqlClient, input) {
|
|
100
|
+
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
101
|
+
.mutation((0, graphql_tag_1.default) `
|
|
102
|
+
mutation UpdateEnvironmentVariable($input: UpdateEnvironmentVariableInput!) {
|
|
103
|
+
environmentVariable {
|
|
104
|
+
updateEnvironmentVariable(environmentVariableData: $input) {
|
|
105
|
+
id
|
|
106
|
+
...EnvironmentVariableFragment
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
${(0, graphql_1.print)(EnvironmentVariable_1.EnvironmentVariableFragmentNode)}
|
|
111
|
+
`, { input })
|
|
112
|
+
.toPromise());
|
|
113
|
+
return data.environmentVariable.updateEnvironmentVariable;
|
|
114
|
+
},
|
|
99
115
|
async deleteAsync(graphqlClient, id) {
|
|
100
116
|
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
101
117
|
.mutation((0, graphql_tag_1.default) `
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
-
import { EnvironmentVariableFragment } from '../generated';
|
|
2
|
+
import { EnvironmentVariableEnvironment, EnvironmentVariableFragment } from '../generated';
|
|
3
|
+
type EnvironmentVariableWithLinkedEnvironments = EnvironmentVariableFragment & {
|
|
4
|
+
linkedEnvironments?: EnvironmentVariableEnvironment[] | null;
|
|
5
|
+
};
|
|
3
6
|
export declare const EnvironmentVariablesQuery: {
|
|
4
7
|
byAppIdWithSensitiveAsync(graphqlClient: ExpoGraphqlClient, { appId, environment, filterNames, }: {
|
|
5
8
|
appId: string;
|
|
6
|
-
environment
|
|
9
|
+
environment?: EnvironmentVariableEnvironment | undefined;
|
|
7
10
|
filterNames?: string[] | undefined;
|
|
8
11
|
}): Promise<EnvironmentVariableFragment[]>;
|
|
9
12
|
byAppIdAsync(graphqlClient: ExpoGraphqlClient, { appId, environment, filterNames, }: {
|
|
10
13
|
appId: string;
|
|
11
|
-
environment
|
|
14
|
+
environment?: EnvironmentVariableEnvironment | undefined;
|
|
12
15
|
filterNames?: string[] | undefined;
|
|
13
|
-
}): Promise<
|
|
14
|
-
sharedAsync(graphqlClient: ExpoGraphqlClient, { appId, filterNames }: {
|
|
16
|
+
}): Promise<EnvironmentVariableWithLinkedEnvironments[]>;
|
|
17
|
+
sharedAsync(graphqlClient: ExpoGraphqlClient, { appId, filterNames, environment, }: {
|
|
15
18
|
appId: string;
|
|
16
19
|
filterNames?: string[] | undefined;
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
environment?: EnvironmentVariableEnvironment | undefined;
|
|
21
|
+
}): Promise<EnvironmentVariableWithLinkedEnvironments[]>;
|
|
22
|
+
sharedWithSensitiveAsync(graphqlClient: ExpoGraphqlClient, { appId, filterNames, environment, }: {
|
|
19
23
|
appId: string;
|
|
20
24
|
filterNames?: string[] | undefined;
|
|
25
|
+
environment?: EnvironmentVariableEnvironment | undefined;
|
|
21
26
|
}): Promise<EnvironmentVariableFragment[]>;
|
|
22
27
|
};
|
|
28
|
+
export {};
|
|
@@ -13,7 +13,7 @@ exports.EnvironmentVariablesQuery = {
|
|
|
13
13
|
query EnvironmentVariablesIncludingSensitiveByAppId(
|
|
14
14
|
$appId: String!
|
|
15
15
|
$filterNames: [String!]
|
|
16
|
-
$environment: EnvironmentVariableEnvironment
|
|
16
|
+
$environment: EnvironmentVariableEnvironment
|
|
17
17
|
) {
|
|
18
18
|
app {
|
|
19
19
|
byId(appId: $appId) {
|
|
@@ -25,6 +25,7 @@ exports.EnvironmentVariablesQuery = {
|
|
|
25
25
|
id
|
|
26
26
|
name
|
|
27
27
|
value
|
|
28
|
+
environments
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
}
|
|
@@ -39,13 +40,14 @@ exports.EnvironmentVariablesQuery = {
|
|
|
39
40
|
query EnvironmentVariablesByAppId(
|
|
40
41
|
$appId: String!
|
|
41
42
|
$filterNames: [String!]
|
|
42
|
-
$environment: EnvironmentVariableEnvironment
|
|
43
|
+
$environment: EnvironmentVariableEnvironment
|
|
43
44
|
) {
|
|
44
45
|
app {
|
|
45
46
|
byId(appId: $appId) {
|
|
46
47
|
id
|
|
47
48
|
environmentVariables(filterNames: $filterNames, environment: $environment) {
|
|
48
49
|
id
|
|
50
|
+
linkedEnvironments(appId: $appId)
|
|
49
51
|
...EnvironmentVariableFragment
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -56,17 +58,22 @@ exports.EnvironmentVariablesQuery = {
|
|
|
56
58
|
.toPromise());
|
|
57
59
|
return data.app?.byId.environmentVariables ?? [];
|
|
58
60
|
},
|
|
59
|
-
async sharedAsync(graphqlClient, { appId, filterNames }) {
|
|
61
|
+
async sharedAsync(graphqlClient, { appId, filterNames, environment, }) {
|
|
60
62
|
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
61
63
|
.query((0, graphql_tag_1.default) `
|
|
62
|
-
query EnvironmentVariablesShared(
|
|
64
|
+
query EnvironmentVariablesShared(
|
|
65
|
+
$appId: String!
|
|
66
|
+
$filterNames: [String!]
|
|
67
|
+
$environment: EnvironmentVariableEnvironment
|
|
68
|
+
) {
|
|
63
69
|
app {
|
|
64
70
|
byId(appId: $appId) {
|
|
65
71
|
id
|
|
66
72
|
ownerAccount {
|
|
67
73
|
id
|
|
68
|
-
environmentVariables(filterNames: $filterNames) {
|
|
74
|
+
environmentVariables(filterNames: $filterNames, environment: $environment) {
|
|
69
75
|
id
|
|
76
|
+
linkedEnvironments(appId: $appId)
|
|
70
77
|
...EnvironmentVariableFragment
|
|
71
78
|
}
|
|
72
79
|
}
|
|
@@ -74,32 +81,37 @@ exports.EnvironmentVariablesQuery = {
|
|
|
74
81
|
}
|
|
75
82
|
}
|
|
76
83
|
${(0, graphql_1.print)(EnvironmentVariable_1.EnvironmentVariableFragmentNode)}
|
|
77
|
-
`, { appId, filterNames }, { additionalTypenames: ['EnvironmentVariable'] })
|
|
84
|
+
`, { appId, filterNames, environment }, { additionalTypenames: ['EnvironmentVariable'] })
|
|
78
85
|
.toPromise());
|
|
79
86
|
return data.app?.byId.ownerAccount.environmentVariables ?? [];
|
|
80
87
|
},
|
|
81
|
-
async sharedWithSensitiveAsync(graphqlClient, { appId, filterNames }) {
|
|
88
|
+
async sharedWithSensitiveAsync(graphqlClient, { appId, filterNames, environment, }) {
|
|
82
89
|
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
83
90
|
.query((0, graphql_tag_1.default) `
|
|
84
91
|
query EnvironmentVariablesSharedWithSensitive(
|
|
85
92
|
$appId: String!
|
|
86
93
|
$filterNames: [String!]
|
|
94
|
+
$environment: EnvironmentVariableEnvironment
|
|
87
95
|
) {
|
|
88
96
|
app {
|
|
89
97
|
byId(appId: $appId) {
|
|
90
98
|
id
|
|
91
99
|
ownerAccount {
|
|
92
100
|
id
|
|
93
|
-
environmentVariablesIncludingSensitive(
|
|
101
|
+
environmentVariablesIncludingSensitive(
|
|
102
|
+
filterNames: $filterNames
|
|
103
|
+
environment: $environment
|
|
104
|
+
) {
|
|
94
105
|
id
|
|
95
106
|
name
|
|
96
107
|
value
|
|
108
|
+
environments
|
|
97
109
|
}
|
|
98
110
|
}
|
|
99
111
|
}
|
|
100
112
|
}
|
|
101
113
|
}
|
|
102
|
-
`, { appId, filterNames }, { additionalTypenames: ['EnvironmentVariableWithSecret'] })
|
|
114
|
+
`, { appId, filterNames, environment }, { additionalTypenames: ['EnvironmentVariableWithSecret'] })
|
|
103
115
|
.toPromise());
|
|
104
116
|
return data.app?.byId.ownerAccount.environmentVariablesIncludingSensitive ?? [];
|
|
105
117
|
},
|
package/build/project/publish.js
CHANGED
|
@@ -25,7 +25,7 @@ const PublishQuery_1 = require("../graphql/queries/PublishQuery");
|
|
|
25
25
|
const log_1 = tslib_1.__importStar(require("../log"));
|
|
26
26
|
const platform_1 = require("../platform");
|
|
27
27
|
const prompts_1 = require("../prompts");
|
|
28
|
-
const
|
|
28
|
+
const getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync_1 = require("../update/getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync");
|
|
29
29
|
const utils_2 = require("../update/utils");
|
|
30
30
|
const uploads_1 = require("../uploads");
|
|
31
31
|
const expoCli_1 = require("../utils/expoCli");
|
|
@@ -383,7 +383,8 @@ async function getBranchNameForCommandAsync({ graphqlClient, projectId, channelN
|
|
|
383
383
|
throw new Error('Cannot specify both --channel and --branch. Specify either --channel, --branch, or --auto.');
|
|
384
384
|
}
|
|
385
385
|
if (channelNameArg) {
|
|
386
|
-
|
|
386
|
+
const { branchName } = await (0, getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync_1.getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync)(graphqlClient, projectId, channelNameArg);
|
|
387
|
+
return branchName;
|
|
387
388
|
}
|
|
388
389
|
if (branchNameArg) {
|
|
389
390
|
return branchNameArg;
|
|
@@ -22,23 +22,22 @@ async function displayLogsAsync(submission, { verbose = false, moreSubmissions =
|
|
|
22
22
|
}
|
|
23
23
|
exports.displayLogsAsync = displayLogsAsync;
|
|
24
24
|
async function downloadAndPrintSubmissionLogsAsync(submission) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
log_1.default.log(msgWithPrefix);
|
|
25
|
+
for (const logFile of submission.logFiles) {
|
|
26
|
+
const response = await (0, fetch_1.default)(logFile);
|
|
27
|
+
const logs = parseLogs(await response.text());
|
|
28
|
+
log_1.default.addNewLineIfNone();
|
|
29
|
+
const prefix = chalk_1.default.blueBright('[logs] ');
|
|
30
|
+
for (const { level, msg } of logs) {
|
|
31
|
+
const msgWithPrefix = `${prefix}${msg}`;
|
|
32
|
+
if (level === 'error') {
|
|
33
|
+
log_1.default.error(msgWithPrefix);
|
|
34
|
+
}
|
|
35
|
+
else if (level === 'warn') {
|
|
36
|
+
log_1.default.warn(msgWithPrefix);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
log_1.default.log(msgWithPrefix);
|
|
40
|
+
}
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
+
export declare function getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync(graphqlClient: ExpoGraphqlClient, projectId: string, channelName: string): Promise<{
|
|
3
|
+
branchName: string;
|
|
4
|
+
branchId: string;
|
|
5
|
+
}>;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync = void 0;
|
|
4
4
|
const queries_1 = require("../branch/queries");
|
|
5
5
|
const errors_1 = require("../channel/errors");
|
|
6
6
|
const queries_2 = require("../channel/queries");
|
|
7
7
|
const ChannelQuery_1 = require("../graphql/queries/ChannelQuery");
|
|
8
|
-
async function
|
|
9
|
-
let
|
|
8
|
+
async function getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync(graphqlClient, projectId, channelName) {
|
|
9
|
+
let branchInfo;
|
|
10
10
|
try {
|
|
11
11
|
const channel = await ChannelQuery_1.ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
|
|
12
12
|
appId: projectId,
|
|
13
13
|
channelName,
|
|
14
14
|
});
|
|
15
15
|
if (channel.updateBranches.length === 1) {
|
|
16
|
-
|
|
16
|
+
const branch = channel.updateBranches[0];
|
|
17
|
+
branchInfo = { branchId: branch.id, branchName: branch.name };
|
|
17
18
|
}
|
|
18
19
|
else if (channel.updateBranches.length === 0) {
|
|
19
20
|
throw new Error("Channel has no branches associated with it. Run 'eas channel:edit' to map a branch");
|
|
@@ -38,8 +39,8 @@ async function getBranchNameFromChannelNameAsync(graphqlClient, projectId, chann
|
|
|
38
39
|
if (!newChannel) {
|
|
39
40
|
throw new Error(`Could not create channel with name ${channelName} on project with id ${projectId}`);
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
+
branchInfo = { branchId, branchName: channelName };
|
|
42
43
|
}
|
|
43
|
-
return
|
|
44
|
+
return branchInfo;
|
|
44
45
|
}
|
|
45
|
-
exports.
|
|
46
|
+
exports.getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync = getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync;
|
|
@@ -26,9 +26,10 @@ async function republishAsync({ graphqlClient, app, updatesToPublish, targetBran
|
|
|
26
26
|
update.branchId === arbitraryUpdate.branchId &&
|
|
27
27
|
update.branchName === arbitraryUpdate.branchName &&
|
|
28
28
|
update.runtimeVersion === arbitraryUpdate.runtimeVersion;
|
|
29
|
-
(0, assert_1.default)(updatesToPublish.every(isSameGroup), 'All updates must belong to the same update group');
|
|
29
|
+
(0, assert_1.default)(updatesToPublish.every(isSameGroup), 'All updates being republished must belong to the same update group');
|
|
30
30
|
(0, assert_1.default)(updatesToPublish.every(u => u.isRollBackToEmbedded) ||
|
|
31
31
|
updatesToPublish.every(u => !u.isRollBackToEmbedded), 'All updates must either be roll back to embedded updates or not');
|
|
32
|
+
(0, assert_1.default)(!updatesToPublish.some(u => !!u.rolloutControlUpdate), 'Cannot republish an update that is being rolled-out. Either complete the update rollout and then republish or publish a new rollout update.');
|
|
32
33
|
const { runtimeVersion } = arbitraryUpdate;
|
|
33
34
|
// If codesigning was created for the original update, we need to add it to the republish.
|
|
34
35
|
// If one wishes to not sign the republish or sign with a different key, a normal publish should
|
|
@@ -44,7 +45,7 @@ async function republishAsync({ graphqlClient, app, updatesToPublish, targetBran
|
|
|
44
45
|
throw new Error('Republished updates must use the same code signing key and algorithm as original update');
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
|
-
log_1.default.withTick(`The republished update group will be signed`);
|
|
48
|
+
log_1.default.withTick(`The republished update group will be signed with the same code signing key and algorithm as the original update`);
|
|
48
49
|
}
|
|
49
50
|
const publishIndicator = (0, ora_1.ora)('Republishing...').start();
|
|
50
51
|
let updatesRepublished;
|
package/build/utils/prompts.d.ts
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment } from '../graphql/generated';
|
|
2
|
-
export declare function
|
|
1
|
+
import { EnvironmentVariableEnvironment, EnvironmentVariableVisibility } from '../graphql/generated';
|
|
2
|
+
export declare function promptVariableVisibilityAsync(nonInteractive: boolean, selectedVisibility?: EnvironmentVariableVisibility | null): Promise<EnvironmentVariableVisibility>;
|
|
3
|
+
type EnvironmentPromptArgs = {
|
|
4
|
+
nonInteractive: boolean;
|
|
5
|
+
selectedEnvironments?: EnvironmentVariableEnvironment[];
|
|
6
|
+
availableEnvironments?: EnvironmentVariableEnvironment[];
|
|
7
|
+
};
|
|
8
|
+
export declare function promptVariableEnvironmentAsync(input: EnvironmentPromptArgs & {
|
|
9
|
+
multiple: true;
|
|
10
|
+
}): Promise<EnvironmentVariableEnvironment[]>;
|
|
11
|
+
export declare function promptVariableEnvironmentAsync(input: EnvironmentPromptArgs & {
|
|
12
|
+
multiple?: false;
|
|
13
|
+
}): Promise<EnvironmentVariableEnvironment>;
|
|
3
14
|
export declare function promptVariableValueAsync({ nonInteractive, required, hidden, initial, }: {
|
|
4
15
|
nonInteractive: boolean;
|
|
5
16
|
required?: boolean;
|
|
6
17
|
initial?: string | null;
|
|
7
18
|
hidden?: boolean;
|
|
8
19
|
}): Promise<string>;
|
|
9
|
-
export declare function promptVariableNameAsync(nonInteractive: boolean): Promise<string>;
|
|
20
|
+
export declare function promptVariableNameAsync(nonInteractive: boolean, initialValue?: string): Promise<string>;
|
|
21
|
+
export {};
|
package/build/utils/prompts.js
CHANGED
|
@@ -1,19 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promptVariableNameAsync = exports.promptVariableValueAsync = exports.promptVariableEnvironmentAsync = void 0;
|
|
3
|
+
exports.promptVariableNameAsync = exports.promptVariableValueAsync = exports.promptVariableEnvironmentAsync = exports.promptVariableVisibilityAsync = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const capitalize_1 = tslib_1.__importDefault(require("./expodash/capitalize"));
|
|
6
7
|
const generated_1 = require("../graphql/generated");
|
|
7
8
|
const prompts_1 = require("../prompts");
|
|
8
|
-
async function
|
|
9
|
+
async function promptVariableVisibilityAsync(nonInteractive, selectedVisibility) {
|
|
10
|
+
if (nonInteractive) {
|
|
11
|
+
throw new Error('The `--visibility` flag must be set when running in `--non-interactive` mode.');
|
|
12
|
+
}
|
|
13
|
+
return await (0, prompts_1.selectAsync)('Select visibility:', Object.values(generated_1.EnvironmentVariableVisibility).map(visibility => ({
|
|
14
|
+
title: (0, capitalize_1.default)(visibility),
|
|
15
|
+
value: visibility,
|
|
16
|
+
selected: visibility === selectedVisibility,
|
|
17
|
+
})));
|
|
18
|
+
}
|
|
19
|
+
exports.promptVariableVisibilityAsync = promptVariableVisibilityAsync;
|
|
20
|
+
async function promptVariableEnvironmentAsync({ nonInteractive, selectedEnvironments, multiple = false, availableEnvironments, }) {
|
|
9
21
|
if (nonInteractive) {
|
|
10
22
|
throw new Error('The `--environment` flag must be set when running in `--non-interactive` mode.');
|
|
11
23
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
if (!multiple) {
|
|
25
|
+
return await (0, prompts_1.selectAsync)('Select environment:', (availableEnvironments ?? Object.values(generated_1.EnvironmentVariableEnvironment)).map(environment => ({
|
|
26
|
+
title: environment,
|
|
27
|
+
value: environment,
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
const { environments } = await (0, prompts_1.promptAsync)({
|
|
31
|
+
message: 'Select environment:',
|
|
32
|
+
name: 'environments',
|
|
33
|
+
type: 'multiselect',
|
|
34
|
+
choices: Object.values(generated_1.EnvironmentVariableEnvironment).map(environment => ({
|
|
35
|
+
title: environment,
|
|
36
|
+
value: environment,
|
|
37
|
+
selected: selectedEnvironments?.includes(environment),
|
|
38
|
+
})),
|
|
39
|
+
});
|
|
40
|
+
return environments;
|
|
17
41
|
}
|
|
18
42
|
exports.promptVariableEnvironmentAsync = promptVariableEnvironmentAsync;
|
|
19
43
|
async function promptVariableValueAsync({ nonInteractive, required = true, hidden = false, initial, }) {
|
|
@@ -41,7 +65,7 @@ async function promptVariableValueAsync({ nonInteractive, required = true, hidde
|
|
|
41
65
|
return variableValue;
|
|
42
66
|
}
|
|
43
67
|
exports.promptVariableValueAsync = promptVariableValueAsync;
|
|
44
|
-
async function promptVariableNameAsync(nonInteractive) {
|
|
68
|
+
async function promptVariableNameAsync(nonInteractive, initialValue) {
|
|
45
69
|
const validationMessage = 'Variable name may not be empty.';
|
|
46
70
|
if (nonInteractive) {
|
|
47
71
|
throw new Error(validationMessage);
|
|
@@ -50,6 +74,7 @@ async function promptVariableNameAsync(nonInteractive) {
|
|
|
50
74
|
type: 'text',
|
|
51
75
|
name: 'name',
|
|
52
76
|
message: `Variable name:`,
|
|
77
|
+
initial: initialValue,
|
|
53
78
|
validate: value => {
|
|
54
79
|
if (!value) {
|
|
55
80
|
return validationMessage;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EnvironmentVariableEnvironment, EnvironmentVariableFragment } from '../graphql/generated';
|
|
2
|
+
export declare function formatVariableName(variable: EnvironmentVariableFragment): string;
|
|
3
|
+
export declare function performForEnvironmentsAsync(environments: EnvironmentVariableEnvironment[] | null, fun: (environment: EnvironmentVariableEnvironment | undefined) => Promise<any>): Promise<any[]>;
|
|
4
|
+
export declare function formatVariable(variable: EnvironmentVariableFragment): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatVariable = exports.performForEnvironmentsAsync = exports.formatVariableName = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const dateformat_1 = tslib_1.__importDefault(require("dateformat"));
|
|
6
|
+
const formatFields_1 = tslib_1.__importDefault(require("./formatFields"));
|
|
7
|
+
const generated_1 = require("../graphql/generated");
|
|
8
|
+
function formatVariableName(variable) {
|
|
9
|
+
const name = variable.name;
|
|
10
|
+
const scope = variable.scope === generated_1.EnvironmentVariableScope.Project ? 'project' : 'shared';
|
|
11
|
+
const environments = variable.environments?.join(', ') ?? '';
|
|
12
|
+
const updatedAt = variable.updatedAt ? new Date(variable.updatedAt).toLocaleString() : '';
|
|
13
|
+
return `${name} | ${scope} | ${environments} | Updated at: ${updatedAt}`;
|
|
14
|
+
}
|
|
15
|
+
exports.formatVariableName = formatVariableName;
|
|
16
|
+
async function performForEnvironmentsAsync(environments, fun) {
|
|
17
|
+
const selectedEnvironments = environments ?? [undefined];
|
|
18
|
+
return await Promise.all(selectedEnvironments.map(env => fun(env)));
|
|
19
|
+
}
|
|
20
|
+
exports.performForEnvironmentsAsync = performForEnvironmentsAsync;
|
|
21
|
+
function formatVariable(variable) {
|
|
22
|
+
return (0, formatFields_1.default)([
|
|
23
|
+
{ label: 'ID', value: variable.id },
|
|
24
|
+
{ label: 'Name', value: variable.name },
|
|
25
|
+
{ label: 'Value', value: variable.value ?? '(secret)' },
|
|
26
|
+
{ label: 'Scope', value: variable.scope },
|
|
27
|
+
{ label: 'Created at', value: (0, dateformat_1.default)(variable.createdAt, 'mmm dd HH:MM:ss') },
|
|
28
|
+
{ label: 'Updated at', value: (0, dateformat_1.default)(variable.updatedAt, 'mmm dd HH:MM:ss') },
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
exports.formatVariable = formatVariable;
|
package/build/worker/assets.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ interface AssetMapOptions {
|
|
|
10
10
|
/** Mapping of normalized file paths to a SHA512 hash */
|
|
11
11
|
export type AssetMap = Record<string, string>;
|
|
12
12
|
/** Creates an asset map of a given target path */
|
|
13
|
-
declare function createAssetMapAsync(assetPath
|
|
13
|
+
declare function createAssetMapAsync(assetPath?: string, options?: AssetMapOptions): Promise<AssetMap>;
|
|
14
14
|
export interface Manifest {
|
|
15
15
|
env: Record<string, string | undefined>;
|
|
16
16
|
}
|
|
@@ -28,8 +28,13 @@ interface WorkerFileEntry {
|
|
|
28
28
|
}
|
|
29
29
|
/** Reads worker files while normalizing sourcemaps and providing normalized paths */
|
|
30
30
|
declare function listWorkerFilesAsync(workerPath: string): AsyncGenerator<WorkerFileEntry>;
|
|
31
|
+
interface AssetFileEntry {
|
|
32
|
+
normalizedPath: string;
|
|
33
|
+
sha512: string;
|
|
34
|
+
path: string;
|
|
35
|
+
}
|
|
31
36
|
/** Reads files of an asset maps and enumerates normalized paths and data */
|
|
32
|
-
declare function listAssetMapFilesAsync(assetPath: string, assetMap: AssetMap): AsyncGenerator<
|
|
37
|
+
declare function listAssetMapFilesAsync(assetPath: string, assetMap: AssetMap): AsyncGenerator<AssetFileEntry>;
|
|
33
38
|
/** Entry of a normalized (gzip-safe) path and file data */
|
|
34
39
|
export type FileEntry = readonly [normalizedPath: string, data: Buffer | string];
|
|
35
40
|
/** Packs file entries into a tar.gz file (path to tgz returned) */
|
package/build/worker/assets.js
CHANGED
|
@@ -65,8 +65,10 @@ function listFilesRecursively(basePath) {
|
|
|
65
65
|
/** Creates an asset map of a given target path */
|
|
66
66
|
async function createAssetMapAsync(assetPath, options) {
|
|
67
67
|
const map = Object.create(null);
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
if (assetPath) {
|
|
69
|
+
for await (const file of listFilesRecursively(assetPath)) {
|
|
70
|
+
map[file.normalizedPath] = await computeSha512HashAsync(file.path, options?.hashOptions);
|
|
71
|
+
}
|
|
70
72
|
}
|
|
71
73
|
return map;
|
|
72
74
|
}
|
|
@@ -103,11 +105,10 @@ exports.listWorkerFilesAsync = listWorkerFilesAsync;
|
|
|
103
105
|
async function* listAssetMapFilesAsync(assetPath, assetMap) {
|
|
104
106
|
for (const normalizedPath in assetMap) {
|
|
105
107
|
const filePath = node_path_1.default.resolve(assetPath, normalizedPath.split('/').join(node_path_1.default.sep));
|
|
106
|
-
const data = await node_fs_1.default.promises.readFile(filePath);
|
|
107
108
|
yield {
|
|
108
109
|
normalizedPath,
|
|
109
110
|
path: filePath,
|
|
110
|
-
|
|
111
|
+
sha512: assetMap[normalizedPath],
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
114
|
}
|
|
@@ -10,6 +10,16 @@ export declare function getSignedDeploymentUrlAsync(graphqlClient: ExpoGraphqlCl
|
|
|
10
10
|
/** If the terminal is running in non interactive mode or not */
|
|
11
11
|
nonInteractive?: boolean;
|
|
12
12
|
}): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Assign a dev domain name to a project.
|
|
15
|
+
* - When running in interactive mode, it will prompt the user with a suggested domain name.
|
|
16
|
+
* - When running in non interactive mode, it will auto-assign the suggested domain name.
|
|
17
|
+
*/
|
|
18
|
+
export declare function assignDevDomainNameAsync({ graphqlClient, appId, nonInteractive, }: {
|
|
19
|
+
graphqlClient: ExpoGraphqlClient;
|
|
20
|
+
appId: string;
|
|
21
|
+
nonInteractive?: boolean;
|
|
22
|
+
}): ReturnType<typeof DeploymentsMutation.assignDevDomainNameAsync>;
|
|
13
23
|
export declare function assignWorkerDeploymentAliasAsync({ graphqlClient, appId, deploymentId, aliasName, }: {
|
|
14
24
|
graphqlClient: ExpoGraphqlClient;
|
|
15
25
|
appId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.selectWorkerDeploymentOnAppAsync = exports.assignWorkerDeploymentProductionAsync = exports.assignWorkerDeploymentAliasAsync = exports.getSignedDeploymentUrlAsync = void 0;
|
|
3
|
+
exports.selectWorkerDeploymentOnAppAsync = exports.assignWorkerDeploymentProductionAsync = exports.assignWorkerDeploymentAliasAsync = exports.assignDevDomainNameAsync = exports.getSignedDeploymentUrlAsync = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
6
|
const mutations_1 = require("./mutations");
|
|
@@ -19,23 +19,20 @@ async function getSignedDeploymentUrlAsync(graphqlClient, options) {
|
|
|
19
19
|
}
|
|
20
20
|
catch (error) {
|
|
21
21
|
const isMissingDevDomain = error?.graphQLErrors?.some(e => ['APP_NO_DEV_DOMAIN_NAME'].includes(e?.extensions?.errorCode));
|
|
22
|
+
// Throw unexpected errors eagerly
|
|
22
23
|
if (!isMissingDevDomain) {
|
|
23
24
|
throw error;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
throw new Error('The project URL needs to be set up, but the terminal is running in non-interactive mode.');
|
|
27
|
-
}
|
|
28
|
-
const suggestedDevDomainName = await queries_1.DeploymentsQuery.getSuggestedDevDomainByAppIdAsync(graphqlClient, { appId: options.appId });
|
|
26
|
+
// Ensure the callback is invoked, containing cleanup logic for possible spinners
|
|
29
27
|
options.onSetupDevDomain?.();
|
|
30
|
-
|
|
28
|
+
// Assign the dev domain name by prompting the user
|
|
29
|
+
await assignDevDomainNameAsync({
|
|
31
30
|
graphqlClient,
|
|
32
31
|
appId: options.appId,
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
return await mutations_1.DeploymentsMutation.createSignedDeploymentUrlAsync(graphqlClient, {
|
|
36
|
-
appId: options.appId,
|
|
37
|
-
deploymentIdentifier: options.deploymentIdentifier,
|
|
32
|
+
nonInteractive: options.nonInteractive,
|
|
38
33
|
});
|
|
34
|
+
// Retry creating the signed URL
|
|
35
|
+
return await getSignedDeploymentUrlAsync(graphqlClient, options);
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
38
|
exports.getSignedDeploymentUrlAsync = getSignedDeploymentUrlAsync;
|
|
@@ -55,14 +52,14 @@ function formatDevDomainName(name = '') {
|
|
|
55
52
|
.replace(DEV_DOMAIN_INVALID_MULTIPLE_HYPHENS, '-')
|
|
56
53
|
.trim();
|
|
57
54
|
}
|
|
58
|
-
async function
|
|
55
|
+
async function promptDevDomainNameAsync(initialDevDomain) {
|
|
59
56
|
const rootDomain = `.${logs_1.EXPO_BASE_DOMAIN}.app`;
|
|
60
57
|
const memoizedFormatDevDomainName = (0, memoize_1.memoize)(formatDevDomainName);
|
|
61
58
|
const { name } = await (0, prompts_1.promptAsync)({
|
|
62
59
|
type: 'text',
|
|
63
60
|
name: 'name',
|
|
64
61
|
message: 'Choose a preview URL for your project:',
|
|
65
|
-
initial,
|
|
62
|
+
initial: initialDevDomain,
|
|
66
63
|
validate: (value) => {
|
|
67
64
|
if (!value) {
|
|
68
65
|
return 'You have to choose a preview URL for your project';
|
|
@@ -95,29 +92,43 @@ async function chooseDevDomainNameAsync({ graphqlClient, appId, initial, }) {
|
|
|
95
92
|
}
|
|
96
93
|
},
|
|
97
94
|
});
|
|
95
|
+
// This should never happen due to the validation, if it does its an error
|
|
98
96
|
if (!name) {
|
|
99
97
|
throw new Error('No preview URL provided, aborting deployment.');
|
|
100
98
|
}
|
|
99
|
+
return name;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Assign a dev domain name to a project.
|
|
103
|
+
* - When running in interactive mode, it will prompt the user with a suggested domain name.
|
|
104
|
+
* - When running in non interactive mode, it will auto-assign the suggested domain name.
|
|
105
|
+
*/
|
|
106
|
+
async function assignDevDomainNameAsync({ graphqlClient, appId, nonInteractive, }) {
|
|
107
|
+
let devDomainName = await queries_1.DeploymentsQuery.getSuggestedDevDomainByAppIdAsync(graphqlClient, {
|
|
108
|
+
appId,
|
|
109
|
+
});
|
|
110
|
+
if (!nonInteractive) {
|
|
111
|
+
devDomainName = await promptDevDomainNameAsync(devDomainName);
|
|
112
|
+
}
|
|
101
113
|
try {
|
|
102
|
-
|
|
114
|
+
return await mutations_1.DeploymentsMutation.assignDevDomainNameAsync(graphqlClient, {
|
|
103
115
|
appId,
|
|
104
|
-
name,
|
|
116
|
+
name: devDomainName,
|
|
105
117
|
});
|
|
106
|
-
if (!success) {
|
|
107
|
-
throw new Error('Failed to assign preview URL');
|
|
108
|
-
}
|
|
109
118
|
}
|
|
110
119
|
catch (error) {
|
|
111
120
|
const isChosenNameTaken = error?.graphQLErrors?.some(e => ['DEV_DOMAIN_NAME_TAKEN'].includes(e?.extensions?.errorCode));
|
|
112
|
-
|
|
113
|
-
log_1.default.error(`The preview URL "${name}" is already taken, choose a different URL.`);
|
|
114
|
-
await chooseDevDomainNameAsync({ graphqlClient, appId, initial });
|
|
115
|
-
}
|
|
121
|
+
// Throw unexpected errors eagerly
|
|
116
122
|
if (!isChosenNameTaken) {
|
|
117
123
|
throw error;
|
|
118
124
|
}
|
|
125
|
+
if (!nonInteractive) {
|
|
126
|
+
log_1.default.error(`The preview URL "${devDomainName}" is already taken, choose a different URL.`);
|
|
127
|
+
}
|
|
128
|
+
return await assignDevDomainNameAsync({ graphqlClient, appId, nonInteractive });
|
|
119
129
|
}
|
|
120
130
|
}
|
|
131
|
+
exports.assignDevDomainNameAsync = assignDevDomainNameAsync;
|
|
121
132
|
async function assignWorkerDeploymentAliasAsync({ graphqlClient, appId, deploymentId, aliasName, }) {
|
|
122
133
|
return await mutations_1.DeploymentsMutation.assignAliasAsync(graphqlClient, {
|
|
123
134
|
appId,
|
package/build/worker/upload.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface UploadResult {
|
|
|
13
13
|
response: Response;
|
|
14
14
|
}
|
|
15
15
|
export declare function uploadAsync(params: UploadParams): Promise<UploadResult>;
|
|
16
|
+
export declare function callUploadApiAsync(url: string | URL, init?: RequestInit): Promise<unknown>;
|
|
16
17
|
export interface UploadPending {
|
|
17
18
|
params: UploadParams;
|
|
18
19
|
}
|