eas-cli 2.6.0 → 2.7.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 +101 -50
- package/build/branch/queries.d.ts +8 -1
- package/build/branch/queries.js +50 -1
- package/build/build/android/build.js +1 -0
- package/build/build/ios/build.js +1 -0
- package/build/build/local.js +1 -1
- package/build/build/validate.d.ts +1 -0
- package/build/build/validate.js +121 -1
- package/build/channel/queries.d.ts +11 -0
- package/build/channel/queries.js +46 -1
- package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +1 -1
- package/build/commands/branch/create.d.ts +0 -3
- package/build/commands/branch/create.js +2 -27
- package/build/commands/channel/create.d.ts +0 -7
- package/build/commands/channel/create.js +4 -31
- package/build/commands/credentials.d.ts +1 -0
- package/build/commands/credentials.js +3 -2
- package/build/commands/update/configure.d.ts +1 -0
- package/build/commands/update/configure.js +10 -218
- package/build/commands/update/index.d.ts +3 -9
- package/build/commands/update/index.js +136 -143
- package/build/credentials/manager/HelperActions.d.ts +2 -0
- package/build/credentials/manager/ManageAndroid.js +8 -1
- package/build/credentials/manager/ManageIos.js +8 -1
- package/build/credentials/manager/SelectPlatform.d.ts +3 -1
- package/build/credentials/manager/SelectPlatform.js +2 -1
- package/build/graphql/generated.d.ts +26 -17
- package/build/graphql/types/Build.js +1 -0
- package/build/log.d.ts +1 -0
- package/build/log.js +3 -0
- package/build/project/projectUtils.d.ts +3 -1
- package/build/project/projectUtils.js +10 -3
- package/build/project/publish.d.ts +13 -10
- package/build/project/publish.js +68 -38
- package/build/project/workflow.d.ts +1 -0
- package/build/project/workflow.js +9 -1
- package/build/prompts.js +3 -1
- package/build/submit/ArchiveSource.js +12 -16
- package/build/update/configure.d.ts +22 -0
- package/build/update/configure.js +200 -0
- package/build/utils/expoCli.d.ts +6 -0
- package/build/utils/expoCli.js +46 -1
- package/build/utils/expodash/memoize.d.ts +2 -0
- package/build/utils/expodash/memoize.js +17 -0
- package/build/utils/image.d.ts +6 -0
- package/build/utils/image.js +107 -0
- package/build/utils/statuspageService.js +1 -0
- package/oclif.manifest.json +1 -1
- package/package.json +8 -4
package/build/build/validate.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkGoogleServicesFileAsync = exports.checkNodeEnvVariable = void 0;
|
|
3
|
+
exports.validatePNGsForManagedProjectAsync = exports.checkGoogleServicesFileAsync = exports.checkNodeEnvVariable = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
6
7
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
7
8
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
|
+
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
8
10
|
const log_1 = tslib_1.__importStar(require("../log"));
|
|
11
|
+
const image_1 = require("../utils/image");
|
|
9
12
|
const vcs_1 = require("../vcs");
|
|
10
13
|
function checkNodeEnvVariable(ctx) {
|
|
11
14
|
var _a;
|
|
@@ -39,3 +42,120 @@ exports.checkGoogleServicesFileAsync = checkGoogleServicesFileAsync;
|
|
|
39
42
|
function isInsideDirectory(file, directory) {
|
|
40
43
|
return file.startsWith(directory);
|
|
41
44
|
}
|
|
45
|
+
async function validatePNGsForManagedProjectAsync(ctx) {
|
|
46
|
+
if (ctx.workflow !== eas_build_job_1.Workflow.MANAGED) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// don't run PNG checks on SDK 47 and newer
|
|
50
|
+
// see https://github.com/expo/eas-cli/pull/1477#issuecomment-1293914917
|
|
51
|
+
if (!ctx.exp.sdkVersion || semver_1.default.satisfies(ctx.exp.sdkVersion, '>= 47.0.0')) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (ctx.platform === eas_build_job_1.Platform.ANDROID) {
|
|
55
|
+
await validateAndroidPNGsAsync(ctx);
|
|
56
|
+
}
|
|
57
|
+
// Validating iOS PNGs is currently disabled
|
|
58
|
+
// See https://github.com/expo/eas-cli/pull/1477 for context
|
|
59
|
+
//
|
|
60
|
+
// else {
|
|
61
|
+
// await validateIosPNGsAsync(ctx as CommonContext<Platform.IOS>);
|
|
62
|
+
// }
|
|
63
|
+
}
|
|
64
|
+
exports.validatePNGsForManagedProjectAsync = validatePNGsForManagedProjectAsync;
|
|
65
|
+
async function validateAndroidPNGsAsync(ctx) {
|
|
66
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
67
|
+
const pngs = [
|
|
68
|
+
{
|
|
69
|
+
configPath: 'exp.icon',
|
|
70
|
+
pngPath: ctx.exp.icon,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
configPath: 'exp.android.icon',
|
|
74
|
+
pngPath: (_a = ctx.exp.android) === null || _a === void 0 ? void 0 : _a.icon,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
configPath: 'exp.android.adaptiveIcon.foregroundImage',
|
|
78
|
+
pngPath: (_c = (_b = ctx.exp.android) === null || _b === void 0 ? void 0 : _b.adaptiveIcon) === null || _c === void 0 ? void 0 : _c.foregroundImage,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
configPath: 'exp.android.adaptiveIcon.backgroundImage',
|
|
82
|
+
pngPath: (_e = (_d = ctx.exp.android) === null || _d === void 0 ? void 0 : _d.adaptiveIcon) === null || _e === void 0 ? void 0 : _e.backgroundImage,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
configPath: 'exp.splash.image',
|
|
86
|
+
pngPath: (_f = ctx.exp.splash) === null || _f === void 0 ? void 0 : _f.image,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
configPath: 'exp.notification.icon',
|
|
90
|
+
pngPath: (_g = ctx.exp.notification) === null || _g === void 0 ? void 0 : _g.icon,
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
await validatePNGsAsync(pngs);
|
|
94
|
+
}
|
|
95
|
+
// Validating iOS PNGs is currently disabled
|
|
96
|
+
// See https://github.com/expo/eas-cli/pull/1477 for context
|
|
97
|
+
//
|
|
98
|
+
// async function validateIosPNGsAsync(ctx: CommonContext<Platform.IOS>): Promise<void> {
|
|
99
|
+
// const pngs: ConfigPng[] = [
|
|
100
|
+
// {
|
|
101
|
+
// configPath: 'exp.icon',
|
|
102
|
+
// pngPath: ctx.exp.icon,
|
|
103
|
+
// },
|
|
104
|
+
// {
|
|
105
|
+
// configPath: 'exp.ios.icon',
|
|
106
|
+
// pngPath: ctx.exp.ios?.icon,
|
|
107
|
+
// },
|
|
108
|
+
// {
|
|
109
|
+
// configPath: 'exp.splash.image',
|
|
110
|
+
// pngPath: ctx.exp.splash?.image,
|
|
111
|
+
// },
|
|
112
|
+
// {
|
|
113
|
+
// configPath: 'exp.notification.icon',
|
|
114
|
+
// pngPath: ctx.exp.notification?.icon,
|
|
115
|
+
// },
|
|
116
|
+
// ];
|
|
117
|
+
// await validatePNGsAsync(pngs);
|
|
118
|
+
// const icon = ctx.exp.ios?.icon ?? ctx.exp.icon;
|
|
119
|
+
// if (!icon) {
|
|
120
|
+
// return;
|
|
121
|
+
// }
|
|
122
|
+
// const iconConfigPath = `expo${ctx.exp.ios?.icon ? '.ios' : ''}.icon`;
|
|
123
|
+
// try {
|
|
124
|
+
// await ensurePNGIsNotTransparentAsync(icon);
|
|
125
|
+
// } catch (err: any) {
|
|
126
|
+
// if (err instanceof ImageTransparencyError) {
|
|
127
|
+
// Log.error(
|
|
128
|
+
// `Your iOS app icon (${iconConfigPath}) can't have transparency if you wish to upload your app to the Apple App Store.`
|
|
129
|
+
// );
|
|
130
|
+
// Log.error(learnMore('https://expo.fyi/remove-alpha-channel', { dim: false }));
|
|
131
|
+
// Errors.exit(1);
|
|
132
|
+
// } else {
|
|
133
|
+
// throw err;
|
|
134
|
+
// }
|
|
135
|
+
// }
|
|
136
|
+
// }
|
|
137
|
+
async function validatePNGsAsync(configPngs) {
|
|
138
|
+
const validationPromises = configPngs.map(configPng => validatePNGAsync(configPng));
|
|
139
|
+
const validationResults = await Promise.allSettled(validationPromises);
|
|
140
|
+
const failedValidations = validationResults.filter((result) => result.status === 'rejected');
|
|
141
|
+
if (failedValidations.length === 0) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
log_1.default.error('PNG images validation failed:');
|
|
145
|
+
for (const { reason } of failedValidations) {
|
|
146
|
+
const error = reason;
|
|
147
|
+
log_1.default.error(`- ${error.message}`);
|
|
148
|
+
}
|
|
149
|
+
core_1.Errors.exit(1);
|
|
150
|
+
}
|
|
151
|
+
async function validatePNGAsync({ configPath, pngPath }) {
|
|
152
|
+
if (!pngPath) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (!pngPath.endsWith('.png')) {
|
|
156
|
+
throw new Error(`"${configPath}" is not a PNG file`);
|
|
157
|
+
}
|
|
158
|
+
if (!(await (0, image_1.isPNGAsync)(pngPath))) {
|
|
159
|
+
throw new Error(`"${configPath}" is not valid PNG`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
2
|
import { PaginatedQueryOptions } from '../commandUtils/pagination';
|
|
3
|
+
import { CreateUpdateChannelOnAppMutation } from '../graphql/generated';
|
|
3
4
|
import { UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
|
4
5
|
export declare const CHANNELS_LIMIT = 25;
|
|
5
6
|
export declare function selectChannelOnAppAsync(graphqlClient: ExpoGraphqlClient, { projectId, selectionPromptTitle, paginatedQueryOptions, }: {
|
|
@@ -16,3 +17,13 @@ export declare function listAndRenderBranchesAndUpdatesOnChannelAsync(graphqlCli
|
|
|
16
17
|
channelName: string;
|
|
17
18
|
paginatedQueryOptions: PaginatedQueryOptions;
|
|
18
19
|
}): Promise<void>;
|
|
20
|
+
export declare function createChannelOnAppAsync(graphqlClient: ExpoGraphqlClient, { appId, branchId, channelName, }: {
|
|
21
|
+
appId: string;
|
|
22
|
+
branchId: string;
|
|
23
|
+
channelName: string;
|
|
24
|
+
}): Promise<CreateUpdateChannelOnAppMutation>;
|
|
25
|
+
export declare function ensureChannelExistsAsync(graphqlClient: ExpoGraphqlClient, { appId, branchId, channelName }: {
|
|
26
|
+
appId: string;
|
|
27
|
+
branchId: string;
|
|
28
|
+
channelName: string;
|
|
29
|
+
}): Promise<void>;
|
package/build/channel/queries.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listAndRenderBranchesAndUpdatesOnChannelAsync = exports.listAndRenderChannelsOnAppAsync = exports.selectChannelOnAppAsync = exports.CHANNELS_LIMIT = void 0;
|
|
3
|
+
exports.ensureChannelExistsAsync = exports.createChannelOnAppAsync = exports.listAndRenderBranchesAndUpdatesOnChannelAsync = exports.listAndRenderChannelsOnAppAsync = exports.selectChannelOnAppAsync = exports.CHANNELS_LIMIT = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
7
|
+
const client_1 = require("../graphql/client");
|
|
6
8
|
const BranchQuery_1 = require("../graphql/queries/BranchQuery");
|
|
7
9
|
const ChannelQuery_1 = require("../graphql/queries/ChannelQuery");
|
|
8
10
|
const log_1 = tslib_1.__importDefault(require("../log"));
|
|
@@ -132,3 +134,46 @@ function renderChannelHeaderContent({ channelName, channelId, }) {
|
|
|
132
134
|
log_1.default.addNewLineIfNone();
|
|
133
135
|
log_1.default.log((0, chalk_1.default) `{bold Branches pointed at this channel and their most recent update group:}`);
|
|
134
136
|
}
|
|
137
|
+
async function createChannelOnAppAsync(graphqlClient, { appId, branchId, channelName, }) {
|
|
138
|
+
// Point the new channel at a branch with its same name.
|
|
139
|
+
const branchMapping = JSON.stringify({
|
|
140
|
+
data: [{ branchId, branchMappingLogic: 'true' }],
|
|
141
|
+
version: 0,
|
|
142
|
+
});
|
|
143
|
+
return await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
144
|
+
.mutation((0, graphql_tag_1.default) `
|
|
145
|
+
mutation CreateUpdateChannelOnApp($appId: ID!, $name: String!, $branchMapping: String!) {
|
|
146
|
+
updateChannel {
|
|
147
|
+
createUpdateChannelForApp(appId: $appId, name: $name, branchMapping: $branchMapping) {
|
|
148
|
+
id
|
|
149
|
+
name
|
|
150
|
+
branchMapping
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
`, {
|
|
155
|
+
appId,
|
|
156
|
+
name: channelName,
|
|
157
|
+
branchMapping,
|
|
158
|
+
})
|
|
159
|
+
.toPromise());
|
|
160
|
+
}
|
|
161
|
+
exports.createChannelOnAppAsync = createChannelOnAppAsync;
|
|
162
|
+
async function ensureChannelExistsAsync(graphqlClient, { appId, branchId, channelName }) {
|
|
163
|
+
var _a;
|
|
164
|
+
try {
|
|
165
|
+
await createChannelOnAppAsync(graphqlClient, {
|
|
166
|
+
appId,
|
|
167
|
+
channelName,
|
|
168
|
+
branchId,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
catch (e) {
|
|
172
|
+
const isIgnorableError = ((_a = e.graphQLErrors) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
|
|
173
|
+
e.graphQLErrors[0].extensions.errorCode === 'CHANNEL_ALREADY_EXISTS';
|
|
174
|
+
if (!isIgnorableError) {
|
|
175
|
+
throw e;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.ensureChannelExistsAsync = ensureChannelExistsAsync;
|
|
@@ -22,7 +22,7 @@ async function saveProjectIdToAppConfigAsync(projectDir, projectId, options = {}
|
|
|
22
22
|
const exp = (0, expoConfig_1.getExpoConfig)(projectDir, options);
|
|
23
23
|
const result = await (0, config_1.modifyConfigAsync)(projectDir, {
|
|
24
24
|
extra: { ...exp.extra, eas: { ...(_a = exp.extra) === null || _a === void 0 ? void 0 : _a.eas, projectId } },
|
|
25
|
-
});
|
|
25
|
+
}, { skipSDKVersionRequirement: true });
|
|
26
26
|
switch (result.type) {
|
|
27
27
|
case 'success':
|
|
28
28
|
break;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
-
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
3
|
-
import { CreateUpdateBranchForAppMutationVariables, UpdateBranch } from '../../graphql/generated';
|
|
4
|
-
export declare function createUpdateBranchOnAppAsync(graphqlClient: ExpoGraphqlClient, { appId, name }: CreateUpdateBranchForAppMutationVariables): Promise<Pick<UpdateBranch, 'id' | 'name'>>;
|
|
5
2
|
export default class BranchCreate extends EasCommand {
|
|
6
3
|
static description: string;
|
|
7
4
|
static args: {
|
|
@@ -1,41 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.createUpdateBranchOnAppAsync = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
6
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
-
const
|
|
6
|
+
const queries_1 = require("../../branch/queries");
|
|
8
7
|
const utils_1 = require("../../branch/utils");
|
|
9
8
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
10
9
|
const flags_1 = require("../../commandUtils/flags");
|
|
11
|
-
const client_1 = require("../../graphql/client");
|
|
12
10
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
13
11
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
14
12
|
const prompts_1 = require("../../prompts");
|
|
15
13
|
const json_1 = require("../../utils/json");
|
|
16
|
-
async function createUpdateBranchOnAppAsync(graphqlClient, { appId, name }) {
|
|
17
|
-
const result = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
18
|
-
.mutation((0, graphql_tag_1.default) `
|
|
19
|
-
mutation createUpdateBranchForApp($appId: ID!, $name: String!) {
|
|
20
|
-
updateBranch {
|
|
21
|
-
createUpdateBranchForApp(appId: $appId, name: $name) {
|
|
22
|
-
id
|
|
23
|
-
name
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
`, {
|
|
28
|
-
appId,
|
|
29
|
-
name,
|
|
30
|
-
})
|
|
31
|
-
.toPromise());
|
|
32
|
-
const newBranch = result.updateBranch.createUpdateBranchForApp;
|
|
33
|
-
if (!newBranch) {
|
|
34
|
-
throw new Error(`Could not create branch ${name}.`);
|
|
35
|
-
}
|
|
36
|
-
return newBranch;
|
|
37
|
-
}
|
|
38
|
-
exports.createUpdateBranchOnAppAsync = createUpdateBranchOnAppAsync;
|
|
39
14
|
class BranchCreate extends EasCommand_1.default {
|
|
40
15
|
async runAsync() {
|
|
41
16
|
let { args: { name }, flags: { json: jsonFlag, 'non-interactive': nonInteractive }, } = await this.parse(BranchCreate);
|
|
@@ -59,7 +34,7 @@ class BranchCreate extends EasCommand_1.default {
|
|
|
59
34
|
validate: value => (value ? true : validationMessage),
|
|
60
35
|
}));
|
|
61
36
|
}
|
|
62
|
-
const newBranch = await createUpdateBranchOnAppAsync(graphqlClient, { appId: projectId, name });
|
|
37
|
+
const newBranch = await (0, queries_1.createUpdateBranchOnAppAsync)(graphqlClient, { appId: projectId, name });
|
|
63
38
|
if (jsonFlag) {
|
|
64
39
|
(0, json_1.printJsonOnlyOutput)(newBranch);
|
|
65
40
|
}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
-
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
3
|
-
import { CreateUpdateChannelOnAppMutation } from '../../graphql/generated';
|
|
4
|
-
export declare function createUpdateChannelOnAppAsync(graphqlClient: ExpoGraphqlClient, { appId, channelName, branchId, }: {
|
|
5
|
-
appId: string;
|
|
6
|
-
channelName: string;
|
|
7
|
-
branchId: string;
|
|
8
|
-
}): Promise<CreateUpdateChannelOnAppMutation>;
|
|
9
2
|
export default class ChannelCreate extends EasCommand {
|
|
10
3
|
static description: string;
|
|
11
4
|
static args: {
|
|
@@ -1,46 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.createUpdateChannelOnAppAsync = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
6
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
-
const
|
|
6
|
+
const queries_1 = require("../../branch/queries");
|
|
8
7
|
const utils_1 = require("../../branch/utils");
|
|
8
|
+
const queries_2 = require("../../channel/queries");
|
|
9
9
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
10
10
|
const flags_1 = require("../../commandUtils/flags");
|
|
11
|
-
const client_1 = require("../../graphql/client");
|
|
12
11
|
const BranchQuery_1 = require("../../graphql/queries/BranchQuery");
|
|
13
12
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
14
13
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
15
14
|
const prompts_1 = require("../../prompts");
|
|
16
15
|
const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
|
|
17
16
|
const json_1 = require("../../utils/json");
|
|
18
|
-
const create_1 = require("../branch/create");
|
|
19
|
-
async function createUpdateChannelOnAppAsync(graphqlClient, { appId, channelName, branchId, }) {
|
|
20
|
-
// Point the new channel at a branch with its same name.
|
|
21
|
-
const branchMapping = JSON.stringify({
|
|
22
|
-
data: [{ branchId, branchMappingLogic: 'true' }],
|
|
23
|
-
version: 0,
|
|
24
|
-
});
|
|
25
|
-
return await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
26
|
-
.mutation((0, graphql_tag_1.default) `
|
|
27
|
-
mutation CreateUpdateChannelOnApp($appId: ID!, $name: String!, $branchMapping: String!) {
|
|
28
|
-
updateChannel {
|
|
29
|
-
createUpdateChannelForApp(appId: $appId, name: $name, branchMapping: $branchMapping) {
|
|
30
|
-
id
|
|
31
|
-
name
|
|
32
|
-
branchMapping
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
`, {
|
|
37
|
-
appId,
|
|
38
|
-
name: channelName,
|
|
39
|
-
branchMapping,
|
|
40
|
-
})
|
|
41
|
-
.toPromise());
|
|
42
|
-
}
|
|
43
|
-
exports.createUpdateChannelOnAppAsync = createUpdateChannelOnAppAsync;
|
|
44
17
|
class ChannelCreate extends EasCommand_1.default {
|
|
45
18
|
async runAsync() {
|
|
46
19
|
let { args: { name: channelName }, flags: { json: jsonFlag, 'non-interactive': nonInteractive }, } = await this.parse(ChannelCreate);
|
|
@@ -74,7 +47,7 @@ class ChannelCreate extends EasCommand_1.default {
|
|
|
74
47
|
}
|
|
75
48
|
catch (error) {
|
|
76
49
|
if (error instanceof utils_1.BranchNotFoundError) {
|
|
77
|
-
const newBranch = await (0,
|
|
50
|
+
const newBranch = await (0, queries_1.createUpdateBranchOnAppAsync)(graphqlClient, {
|
|
78
51
|
appId: projectId,
|
|
79
52
|
name: channelName,
|
|
80
53
|
});
|
|
@@ -85,7 +58,7 @@ class ChannelCreate extends EasCommand_1.default {
|
|
|
85
58
|
throw error;
|
|
86
59
|
}
|
|
87
60
|
}
|
|
88
|
-
const { updateChannel: { createUpdateChannelForApp: newChannel }, } = await
|
|
61
|
+
const { updateChannel: { createUpdateChannelForApp: newChannel }, } = await (0, queries_2.createChannelOnAppAsync)(graphqlClient, {
|
|
89
62
|
appId: projectId,
|
|
90
63
|
channelName,
|
|
91
64
|
branchId,
|
|
@@ -6,6 +6,7 @@ export default class Credentials extends EasCommand {
|
|
|
6
6
|
};
|
|
7
7
|
static contextDefinition: {
|
|
8
8
|
analytics: import("../commandUtils/context/AnalyticsContextField").default;
|
|
9
|
+
getDynamicProjectConfigAsync: import("../commandUtils/context/DynamicProjectConfigContextField").DynamicProjectConfigContextField;
|
|
9
10
|
projectConfig: import("../commandUtils/context/OptionalProjectConfigContextField").OptionalProjectConfigContextField;
|
|
10
11
|
loggedIn: import("../commandUtils/context/LoggedInContextField").default;
|
|
11
12
|
};
|
|
@@ -8,10 +8,10 @@ const SelectPlatform_1 = require("../credentials/manager/SelectPlatform");
|
|
|
8
8
|
class Credentials extends EasCommand_1.default {
|
|
9
9
|
async runAsync() {
|
|
10
10
|
const { flags } = await this.parse(Credentials);
|
|
11
|
-
const { loggedIn: { actor, graphqlClient }, projectConfig, analytics, } = await this.getContextAsync(Credentials, {
|
|
11
|
+
const { loggedIn: { actor, graphqlClient }, projectConfig, getDynamicProjectConfigAsync, analytics, } = await this.getContextAsync(Credentials, {
|
|
12
12
|
nonInteractive: false,
|
|
13
13
|
});
|
|
14
|
-
await new SelectPlatform_1.SelectPlatform(actor, graphqlClient, analytics, projectConfig !== null && projectConfig !== void 0 ? projectConfig : null, flags.platform).runAsync();
|
|
14
|
+
await new SelectPlatform_1.SelectPlatform(actor, graphqlClient, analytics, projectConfig !== null && projectConfig !== void 0 ? projectConfig : null, getDynamicProjectConfigAsync, flags.platform).runAsync();
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.default = Credentials;
|
|
@@ -23,5 +23,6 @@ Credentials.flags = {
|
|
|
23
23
|
Credentials.contextDefinition = {
|
|
24
24
|
..._a.ContextOptions.LoggedIn,
|
|
25
25
|
..._a.ContextOptions.OptionalProjectConfig,
|
|
26
|
+
..._a.ContextOptions.DynamicProjectConfig,
|
|
26
27
|
..._a.ContextOptions.Analytics,
|
|
27
28
|
};
|
|
@@ -2,6 +2,7 @@ import EasCommand from '../../commandUtils/EasCommand';
|
|
|
2
2
|
export default class UpdateConfigure extends EasCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
5
6
|
platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
7
|
};
|
|
7
8
|
static contextDefinition: {
|
|
@@ -2,61 +2,25 @@
|
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const config_1 = require("@expo/config");
|
|
6
|
-
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
7
5
|
const core_1 = require("@oclif/core");
|
|
8
|
-
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
9
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
10
|
-
const api_1 = require("../../api");
|
|
11
6
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
12
|
-
const
|
|
13
|
-
const log_1 = tslib_1.
|
|
14
|
-
const
|
|
15
|
-
const projectUtils_1 = require("../../project/projectUtils");
|
|
16
|
-
const workflow_1 = require("../../project/workflow");
|
|
17
|
-
const UpdatesModule_1 = require("../../update/android/UpdatesModule");
|
|
18
|
-
const UpdatesModule_2 = require("../../update/ios/UpdatesModule");
|
|
19
|
-
const DEFAULT_MANAGED_RUNTIME_VERSION = { policy: 'sdkVersion' };
|
|
20
|
-
const DEFAULT_BARE_RUNTIME_VERSION = '1.0.0';
|
|
7
|
+
const flags_1 = require("../../commandUtils/flags");
|
|
8
|
+
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
9
|
+
const configure_1 = require("../../update/configure");
|
|
21
10
|
class UpdateConfigure extends EasCommand_1.default {
|
|
22
11
|
async runAsync() {
|
|
23
|
-
log_1.default.log('💡 The following process will configure your project to run EAS Update. These changes only apply to your local project files and you can safely revert them at any time.');
|
|
24
12
|
const { flags } = await this.parse(UpdateConfigure);
|
|
13
|
+
const platform = flags.platform;
|
|
25
14
|
const { projectConfig: { projectId, exp, projectDir }, loggedIn: { graphqlClient }, } = await this.getContextAsync(UpdateConfigure, {
|
|
26
|
-
nonInteractive:
|
|
15
|
+
nonInteractive: flags['non-interactive'],
|
|
27
16
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
await (0, projectUtils_1.installExpoUpdatesAsync)(projectDir);
|
|
31
|
-
}
|
|
32
|
-
const [androidWorkflow, iosWorkflow] = await Promise.all([
|
|
33
|
-
(0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.ANDROID),
|
|
34
|
-
(0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.IOS),
|
|
35
|
-
]);
|
|
36
|
-
const updatedExp = await configureAppJSONForEASUpdateAsync({
|
|
37
|
-
projectDir,
|
|
17
|
+
log_1.default.log('💡 The following process will configure your project to run EAS Update. These changes only apply to your local project files and you can safely revert them at any time.');
|
|
18
|
+
await (0, configure_1.ensureEASUpdatesIsConfiguredAsync)(graphqlClient, {
|
|
38
19
|
exp,
|
|
39
|
-
platform,
|
|
40
|
-
workflows: {
|
|
41
|
-
android: androidWorkflow,
|
|
42
|
-
ios: iosWorkflow,
|
|
43
|
-
},
|
|
44
20
|
projectId,
|
|
21
|
+
projectDir,
|
|
22
|
+
platform,
|
|
45
23
|
});
|
|
46
|
-
log_1.default.withTick(`Configured ${chalk_1.default.bold('app.json')} for EAS Update`);
|
|
47
|
-
// configure native files for EAS Update
|
|
48
|
-
if ([platform_1.RequestedPlatform.Android, platform_1.RequestedPlatform.All].includes(platform) &&
|
|
49
|
-
androidWorkflow === eas_build_job_1.Workflow.GENERIC) {
|
|
50
|
-
await (0, UpdatesModule_1.syncUpdatesConfigurationAsync)(graphqlClient, projectDir, updatedExp, projectId);
|
|
51
|
-
log_1.default.withTick(`Configured ${chalk_1.default.bold('AndroidManifest.xml')} for EAS Update`);
|
|
52
|
-
}
|
|
53
|
-
if ([platform_1.RequestedPlatform.Ios, platform_1.RequestedPlatform.All].includes(platform) &&
|
|
54
|
-
iosWorkflow === eas_build_job_1.Workflow.GENERIC) {
|
|
55
|
-
await (0, UpdatesModule_2.syncUpdatesConfigurationAsync)(graphqlClient, projectDir, updatedExp, projectId);
|
|
56
|
-
log_1.default.withTick(`Configured ${chalk_1.default.bold('Expo.plist')} for EAS Update`);
|
|
57
|
-
}
|
|
58
|
-
log_1.default.addNewLineIfNone();
|
|
59
|
-
log_1.default.warn(`All builds of your app going forward will be eligible to receive updates published with EAS Update.`);
|
|
60
24
|
log_1.default.addNewLineIfNone();
|
|
61
25
|
log_1.default.log(`🎉 Your app is configured to run EAS Update!`);
|
|
62
26
|
}
|
|
@@ -71,181 +35,9 @@ UpdateConfigure.flags = {
|
|
|
71
35
|
options: ['android', 'ios', 'all'],
|
|
72
36
|
default: 'all',
|
|
73
37
|
}),
|
|
38
|
+
...flags_1.EASNonInteractiveFlag,
|
|
74
39
|
};
|
|
75
40
|
UpdateConfigure.contextDefinition = {
|
|
76
41
|
..._a.ContextOptions.ProjectConfig,
|
|
77
42
|
..._a.ContextOptions.LoggedIn,
|
|
78
43
|
};
|
|
79
|
-
async function configureAppJSONForEASUpdateAsync({ projectDir, exp, platform, workflows, projectId, }) {
|
|
80
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
81
|
-
// this command is non-interactive in the way it was designed
|
|
82
|
-
const easUpdateURL = (0, api_1.getEASUpdateURL)(projectId);
|
|
83
|
-
const updates = { ...exp.updates, url: easUpdateURL };
|
|
84
|
-
const androidDefaultRuntimeVersion = workflows['android'] === eas_build_job_1.Workflow.GENERIC
|
|
85
|
-
? DEFAULT_BARE_RUNTIME_VERSION
|
|
86
|
-
: DEFAULT_MANAGED_RUNTIME_VERSION;
|
|
87
|
-
const iosDefaultRuntimeVersion = workflows['ios'] === eas_build_job_1.Workflow.GENERIC
|
|
88
|
-
? DEFAULT_BARE_RUNTIME_VERSION
|
|
89
|
-
: DEFAULT_MANAGED_RUNTIME_VERSION;
|
|
90
|
-
const newAndroidRuntimeVersion = (_d = (_c = (_b = exp.android) === null || _b === void 0 ? void 0 : _b.runtimeVersion) !== null && _c !== void 0 ? _c : exp.runtimeVersion) !== null && _d !== void 0 ? _d : androidDefaultRuntimeVersion;
|
|
91
|
-
const newIosRuntimeVersion = (_g = (_f = (_e = exp.ios) === null || _e === void 0 ? void 0 : _e.runtimeVersion) !== null && _f !== void 0 ? _f : exp.runtimeVersion) !== null && _g !== void 0 ? _g : iosDefaultRuntimeVersion;
|
|
92
|
-
let newConfig;
|
|
93
|
-
let newConfigOnlyAddedValues;
|
|
94
|
-
switch (platform) {
|
|
95
|
-
case platform_1.RequestedPlatform.All: {
|
|
96
|
-
if (isRuntimeEqual(newAndroidRuntimeVersion, newIosRuntimeVersion)) {
|
|
97
|
-
newConfig = {
|
|
98
|
-
runtimeVersion: newAndroidRuntimeVersion,
|
|
99
|
-
android: {
|
|
100
|
-
...exp.android,
|
|
101
|
-
runtimeVersion: undefined,
|
|
102
|
-
},
|
|
103
|
-
ios: { ...exp.ios, runtimeVersion: undefined },
|
|
104
|
-
updates,
|
|
105
|
-
};
|
|
106
|
-
newConfigOnlyAddedValues = {
|
|
107
|
-
runtimeVersion: newAndroidRuntimeVersion,
|
|
108
|
-
...(exp.android && 'runtimeVersion' in exp.android
|
|
109
|
-
? {
|
|
110
|
-
android: {
|
|
111
|
-
runtimeVersion: '<remove this key>',
|
|
112
|
-
},
|
|
113
|
-
}
|
|
114
|
-
: {}),
|
|
115
|
-
...(exp.ios && 'runtimeVersion' in exp.ios
|
|
116
|
-
? {
|
|
117
|
-
ios: {
|
|
118
|
-
runtimeVersion: '<remove this key>',
|
|
119
|
-
},
|
|
120
|
-
}
|
|
121
|
-
: {}),
|
|
122
|
-
updates: {
|
|
123
|
-
url: easUpdateURL,
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
newConfig = {
|
|
129
|
-
runtimeVersion: undefined,
|
|
130
|
-
android: {
|
|
131
|
-
...exp.android,
|
|
132
|
-
runtimeVersion: newAndroidRuntimeVersion,
|
|
133
|
-
},
|
|
134
|
-
ios: {
|
|
135
|
-
...exp.ios,
|
|
136
|
-
runtimeVersion: newIosRuntimeVersion,
|
|
137
|
-
},
|
|
138
|
-
updates,
|
|
139
|
-
};
|
|
140
|
-
newConfigOnlyAddedValues = {
|
|
141
|
-
...('runtimeVersion' in exp
|
|
142
|
-
? {
|
|
143
|
-
runtimeVersion: '<remove this key>', // top level runtime is redundant if it is specified in both android and ios
|
|
144
|
-
}
|
|
145
|
-
: {}),
|
|
146
|
-
android: {
|
|
147
|
-
runtimeVersion: newAndroidRuntimeVersion,
|
|
148
|
-
},
|
|
149
|
-
ios: {
|
|
150
|
-
runtimeVersion: newIosRuntimeVersion,
|
|
151
|
-
},
|
|
152
|
-
updates: {
|
|
153
|
-
url: easUpdateURL,
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
case platform_1.RequestedPlatform.Android: {
|
|
160
|
-
newConfig = {
|
|
161
|
-
android: {
|
|
162
|
-
...exp.android,
|
|
163
|
-
runtimeVersion: newAndroidRuntimeVersion,
|
|
164
|
-
},
|
|
165
|
-
updates,
|
|
166
|
-
};
|
|
167
|
-
newConfigOnlyAddedValues = {
|
|
168
|
-
android: {
|
|
169
|
-
runtimeVersion: newAndroidRuntimeVersion,
|
|
170
|
-
},
|
|
171
|
-
updates: {
|
|
172
|
-
url: easUpdateURL,
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
case platform_1.RequestedPlatform.Ios: {
|
|
178
|
-
newConfig = {
|
|
179
|
-
ios: {
|
|
180
|
-
...exp.ios,
|
|
181
|
-
runtimeVersion: newIosRuntimeVersion,
|
|
182
|
-
},
|
|
183
|
-
updates,
|
|
184
|
-
};
|
|
185
|
-
newConfigOnlyAddedValues = {
|
|
186
|
-
ios: {
|
|
187
|
-
runtimeVersion: newIosRuntimeVersion,
|
|
188
|
-
},
|
|
189
|
-
updates: {
|
|
190
|
-
url: easUpdateURL,
|
|
191
|
-
},
|
|
192
|
-
};
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
default: {
|
|
196
|
-
throw new Error(`Unsupported platform: ${platform}`);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
const result = await (0, config_1.modifyConfigAsync)(projectDir, newConfig);
|
|
200
|
-
const preexistingAndroidRuntimeVersion = (_j = (_h = exp.android) === null || _h === void 0 ? void 0 : _h.runtimeVersion) !== null && _j !== void 0 ? _j : exp.runtimeVersion;
|
|
201
|
-
const preexistingIosRuntimeVersion = (_l = (_k = exp.ios) === null || _k === void 0 ? void 0 : _k.runtimeVersion) !== null && _l !== void 0 ? _l : exp.runtimeVersion;
|
|
202
|
-
switch (result.type) {
|
|
203
|
-
case 'success':
|
|
204
|
-
if ((_m = exp.updates) === null || _m === void 0 ? void 0 : _m.url) {
|
|
205
|
-
if (exp.updates.url !== easUpdateURL) {
|
|
206
|
-
log_1.default.withTick(`Overwrote "${(_o = exp.updates) === null || _o === void 0 ? void 0 : _o.url}" with "${easUpdateURL}" for the updates.url value in app.json`);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
log_1.default.withTick(`Set updates.url value, to "${easUpdateURL}" in app.json`);
|
|
211
|
-
}
|
|
212
|
-
if (!preexistingAndroidRuntimeVersion &&
|
|
213
|
-
[platform_1.RequestedPlatform.Android, platform_1.RequestedPlatform.All].includes(platform)) {
|
|
214
|
-
log_1.default.withTick(`Set ${platform_1.appPlatformDisplayNames[generated_1.AppPlatform.Android]} runtimeVersion to "${JSON.stringify((_q = (_p = newConfig.android) === null || _p === void 0 ? void 0 : _p.runtimeVersion) !== null && _q !== void 0 ? _q : newConfig.runtimeVersion)}" in app.json`);
|
|
215
|
-
}
|
|
216
|
-
if (!preexistingIosRuntimeVersion &&
|
|
217
|
-
[platform_1.RequestedPlatform.Ios, platform_1.RequestedPlatform.All].includes(platform)) {
|
|
218
|
-
log_1.default.withTick(`Set ${platform_1.appPlatformDisplayNames[generated_1.AppPlatform.Ios]} runtimeVersion to "${JSON.stringify((_s = (_r = newConfig.ios) === null || _r === void 0 ? void 0 : _r.runtimeVersion) !== null && _s !== void 0 ? _s : newConfig.runtimeVersion)}" in app.json`);
|
|
219
|
-
}
|
|
220
|
-
break;
|
|
221
|
-
case 'warn': {
|
|
222
|
-
log_1.default.addNewLineIfNone();
|
|
223
|
-
log_1.default.warn(`It looks like you are using a dynamic configuration! ${(0, log_1.learnMore)('https://docs.expo.dev/workflow/configuration/#dynamic-configuration-with-appconfigjs)')}`);
|
|
224
|
-
log_1.default.warn(`In order to finish configuring your project for EAS Update, you are going to need manually add the following to your app.config.js:\n${(0, log_1.learnMore)('https://expo.fyi/eas-update-config.md')}\n`);
|
|
225
|
-
log_1.default.log(chalk_1.default.bold(JSON.stringify(newConfigOnlyAddedValues, null, 2)));
|
|
226
|
-
log_1.default.addNewLineIfNone();
|
|
227
|
-
if (workflows['android'] === eas_build_job_1.Workflow.GENERIC || workflows['ios'] === eas_build_job_1.Workflow.GENERIC) {
|
|
228
|
-
log_1.default.warn(`You will also have to manually edit the projects ${chalk_1.default.bold('Expo.plist/AndroidManifest.xml')}. ${(0, log_1.learnMore)('https://expo.fyi/eas-update-config.md#native-configuration')}`);
|
|
229
|
-
}
|
|
230
|
-
log_1.default.addNewLineIfNone();
|
|
231
|
-
throw new Error(result.message);
|
|
232
|
-
}
|
|
233
|
-
case 'fail':
|
|
234
|
-
throw new Error(result.message);
|
|
235
|
-
default:
|
|
236
|
-
throw new Error('Unexpected result type from modifyConfigAsync');
|
|
237
|
-
}
|
|
238
|
-
(0, assert_1.default)(result.config, 'A successful result should have a config');
|
|
239
|
-
return result.config.expo;
|
|
240
|
-
}
|
|
241
|
-
function isRuntimeEqual(runtimeVersionA, runtimeVersionB) {
|
|
242
|
-
if (typeof runtimeVersionA === 'string' && typeof runtimeVersionB === 'string') {
|
|
243
|
-
return runtimeVersionA === runtimeVersionB;
|
|
244
|
-
}
|
|
245
|
-
else if (typeof runtimeVersionA === 'object' && typeof runtimeVersionB === 'object') {
|
|
246
|
-
return runtimeVersionA.policy === runtimeVersionB.policy;
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
}
|