eas-cli 3.17.1 → 3.18.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 +55 -55
- package/build/branch/actions/SelectBranch.d.ts +33 -0
- package/build/branch/actions/SelectBranch.js +67 -0
- package/build/build/android/build.js +1 -2
- package/build/build/local.js +1 -1
- package/build/build/runBuildAndSubmit.js +2 -0
- package/build/channel/actions/SelectChannel.d.ts +33 -0
- package/build/channel/actions/SelectChannel.js +67 -0
- package/build/channel/branch-mapping.d.ts +20 -0
- package/build/channel/branch-mapping.js +75 -5
- package/build/channel/queries.d.ts +1 -6
- package/build/channel/queries.js +1 -25
- package/build/commands/build/version/get.js +1 -0
- package/build/commands/build/version/sync.js +1 -0
- package/build/commands/channel/rollout-preview.d.ts +32 -0
- package/build/commands/channel/rollout-preview.js +109 -0
- package/build/commands/metadata/lint.js +1 -0
- package/build/commands/metadata/pull.js +1 -0
- package/build/commands/metadata/push.js +1 -0
- package/build/commands/submit.js +1 -0
- package/build/commands/update/republish.js +23 -74
- package/build/eas-update/utils.d.ts +15 -0
- package/build/eas-update/utils.js +6 -0
- package/build/graphql/generated.d.ts +192 -18
- package/build/graphql/generated.js +8 -2
- package/build/graphql/queries/BranchQuery.d.ts +3 -2
- package/build/graphql/queries/BranchQuery.js +43 -1
- package/build/graphql/queries/ChannelQuery.d.ts +3 -2
- package/build/graphql/queries/ChannelQuery.js +19 -5
- package/build/graphql/queries/RuntimeQuery.d.ts +6 -0
- package/build/graphql/queries/RuntimeQuery.js +70 -0
- package/build/graphql/types/Runtime.d.ts +1 -0
- package/build/graphql/types/Runtime.js +11 -0
- package/build/graphql/types/UpdateBranch.js +3 -1
- package/build/graphql/types/UpdateBranchBasicInfo.d.ts +1 -0
- package/build/graphql/types/UpdateBranchBasicInfo.js +11 -0
- package/build/project/ios/target.d.ts +1 -1
- package/build/project/ios/target.js +4 -4
- package/build/rollout/actions/CreateRollout.d.ts +23 -0
- package/build/rollout/actions/CreateRollout.js +153 -0
- package/build/rollout/actions/EditRollout.d.ts +17 -0
- package/build/rollout/actions/EditRollout.js +79 -0
- package/build/rollout/actions/EndRollout.d.ts +24 -0
- package/build/rollout/actions/EndRollout.js +164 -0
- package/build/rollout/actions/ManageRollout.d.ts +24 -0
- package/build/rollout/actions/ManageRollout.js +78 -0
- package/build/rollout/actions/NonInteractiveRollout.d.ts +18 -0
- package/build/rollout/actions/NonInteractiveRollout.js +46 -0
- package/build/rollout/actions/RolloutMainMenu.d.ts +28 -0
- package/build/rollout/actions/RolloutMainMenu.js +110 -0
- package/build/rollout/actions/SelectRollout.d.ts +8 -0
- package/build/rollout/actions/SelectRollout.js +33 -0
- package/build/rollout/actions/SelectRuntime.d.ts +36 -0
- package/build/rollout/actions/SelectRuntime.js +167 -0
- package/build/rollout/branch-mapping.d.ts +128 -0
- package/build/rollout/branch-mapping.js +260 -0
- package/build/rollout/utils.d.ts +10 -53
- package/build/rollout/utils.js +78 -94
- package/build/update/configure.d.ts +6 -1
- package/build/update/configure.js +18 -8
- package/build/update/republish.d.ts +26 -0
- package/build/update/republish.js +83 -0
- package/build/utils/profiles.d.ts +2 -1
- package/build/utils/profiles.js +35 -3
- package/build/utils/relay.d.ts +80 -15
- package/build/utils/relay.js +211 -28
- package/oclif.manifest.json +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertRolloutBranchMapping = exports.editRolloutBranchMapping = exports.createRolloutBranchMapping = exports.isRollout = exports.isRolloutBranchMapping = exports.getRolloutBranchMapping = exports.composeRollout = exports.getRollout = exports.getRolloutInfoFromBranchMapping = exports.getRolloutInfo = exports.isConstrainedRollout = exports.isConstrainedRolloutInfo = exports.isLegacyRolloutInfo = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
|
+
const branch_mapping_1 = require("../channel/branch-mapping");
|
|
7
|
+
const utils_1 = require("../channel/utils");
|
|
8
|
+
function isLegacyRolloutInfo(rollout) {
|
|
9
|
+
return !isConstrainedRolloutInfo(rollout);
|
|
10
|
+
}
|
|
11
|
+
exports.isLegacyRolloutInfo = isLegacyRolloutInfo;
|
|
12
|
+
function isConstrainedRolloutInfo(rollout) {
|
|
13
|
+
return 'runtimeVersion' in rollout;
|
|
14
|
+
}
|
|
15
|
+
exports.isConstrainedRolloutInfo = isConstrainedRolloutInfo;
|
|
16
|
+
function isConstrainedRollout(rollout) {
|
|
17
|
+
return isConstrainedRolloutInfo(rollout);
|
|
18
|
+
}
|
|
19
|
+
exports.isConstrainedRollout = isConstrainedRollout;
|
|
20
|
+
function getRolloutInfo(basicChannelInfo) {
|
|
21
|
+
const rolloutBranchMapping = getRolloutBranchMapping(basicChannelInfo.branchMapping);
|
|
22
|
+
return getRolloutInfoFromBranchMapping(rolloutBranchMapping);
|
|
23
|
+
}
|
|
24
|
+
exports.getRolloutInfo = getRolloutInfo;
|
|
25
|
+
function getRolloutInfoFromBranchMapping(branchMapping) {
|
|
26
|
+
const rolledOutBranchId = branchMapping.data[0].branchId;
|
|
27
|
+
const defaultBranchId = branchMapping.data[1].branchId;
|
|
28
|
+
if (isRtvConstrainedRollout(branchMapping)) {
|
|
29
|
+
const statementNode = branchMapping.data[0].branchMappingLogic;
|
|
30
|
+
(0, branch_mapping_1.assertStatement)(statementNode);
|
|
31
|
+
const nodesFromStatement = (0, branch_mapping_1.getNodesFromStatement)(statementNode);
|
|
32
|
+
const runtimeVersionNode = nodesFromStatement.find(isRuntimeVersionNode);
|
|
33
|
+
(0, assert_1.default)(runtimeVersionNode, 'Runtime version node must be defined.');
|
|
34
|
+
(0, branch_mapping_1.assertNodeObject)(runtimeVersionNode);
|
|
35
|
+
const runtimeVersion = runtimeVersionNode.operand;
|
|
36
|
+
(0, branch_mapping_1.assertString)(runtimeVersion);
|
|
37
|
+
const rolloutNode = nodesFromStatement.find(isRolloutNode);
|
|
38
|
+
(0, assert_1.default)(rolloutNode, 'Rollout node must be defined.');
|
|
39
|
+
(0, branch_mapping_1.assertNodeObject)(rolloutNode);
|
|
40
|
+
const operand = rolloutNode.operand;
|
|
41
|
+
(0, branch_mapping_1.assertNumber)(operand);
|
|
42
|
+
return {
|
|
43
|
+
rolledOutBranchId,
|
|
44
|
+
percentRolledOut: operand * 100,
|
|
45
|
+
runtimeVersion,
|
|
46
|
+
defaultBranchId,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const rolloutNode = branchMapping.data[0].branchMappingLogic;
|
|
51
|
+
(0, branch_mapping_1.assertNodeObject)(rolloutNode);
|
|
52
|
+
const operand = rolloutNode.operand;
|
|
53
|
+
(0, branch_mapping_1.assertNumber)(operand);
|
|
54
|
+
return {
|
|
55
|
+
rolledOutBranchId,
|
|
56
|
+
percentRolledOut: operand * 100,
|
|
57
|
+
defaultBranchId,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.getRolloutInfoFromBranchMapping = getRolloutInfoFromBranchMapping;
|
|
62
|
+
function getRollout(channel) {
|
|
63
|
+
const rolloutBranchMapping = getRolloutBranchMapping(channel.branchMapping);
|
|
64
|
+
const rolledOutBranchId = rolloutBranchMapping.data[0].branchId;
|
|
65
|
+
const rolledOutBranch = (0, utils_1.getUpdateBranch)(channel, rolledOutBranchId);
|
|
66
|
+
const defaultBranchId = rolloutBranchMapping.data[1].branchId;
|
|
67
|
+
const defaultBranch = (0, utils_1.getUpdateBranch)(channel, defaultBranchId);
|
|
68
|
+
const rolloutInfo = getRolloutInfo(channel);
|
|
69
|
+
return composeRollout(rolloutInfo, defaultBranch, rolledOutBranch);
|
|
70
|
+
}
|
|
71
|
+
exports.getRollout = getRollout;
|
|
72
|
+
function composeRollout(rolloutInfo, defaultBranch, rolledOutBranch) {
|
|
73
|
+
if (rolloutInfo.defaultBranchId !== defaultBranch.id) {
|
|
74
|
+
throw new branch_mapping_1.BranchMappingValidationError(`Default branch id must match. Received: ${JSON.stringify(rolloutInfo)} ${defaultBranch.id}`);
|
|
75
|
+
}
|
|
76
|
+
if (rolloutInfo.rolledOutBranchId !== rolledOutBranch.id) {
|
|
77
|
+
throw new branch_mapping_1.BranchMappingValidationError(`Rolled out branch id must match. Received: ${JSON.stringify(rolloutInfo)} ${rolledOutBranch.id}`);
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
...rolloutInfo,
|
|
81
|
+
rolledOutBranch,
|
|
82
|
+
defaultBranch,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
exports.composeRollout = composeRollout;
|
|
86
|
+
function getRolloutBranchMapping(branchMappingString) {
|
|
87
|
+
const branchMapping = (0, branch_mapping_1.getBranchMapping)(branchMappingString);
|
|
88
|
+
assertRolloutBranchMapping(branchMapping);
|
|
89
|
+
return branchMapping;
|
|
90
|
+
}
|
|
91
|
+
exports.getRolloutBranchMapping = getRolloutBranchMapping;
|
|
92
|
+
/**
|
|
93
|
+
* Detect if a branch mapping is a rollout.
|
|
94
|
+
*
|
|
95
|
+
* Types of rollout:
|
|
96
|
+
* 1. Legacy unconstrained rollout:
|
|
97
|
+
* Maps to a rollout branch via a rollout token
|
|
98
|
+
* Falls back to a default branch
|
|
99
|
+
*
|
|
100
|
+
* Example:
|
|
101
|
+
* {
|
|
102
|
+
version: 0,
|
|
103
|
+
data: [
|
|
104
|
+
{
|
|
105
|
+
branchId: uuidv4(),
|
|
106
|
+
branchMappingLogic: {
|
|
107
|
+
operand: 10 / 100,
|
|
108
|
+
clientKey: 'rolloutToken',
|
|
109
|
+
branchMappingOperator: hashLtOperator(),
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
|
113
|
+
],
|
|
114
|
+
}
|
|
115
|
+
*
|
|
116
|
+
* 2. RTV constrained rollout:
|
|
117
|
+
* Maps to a rollout branch via a rollout token, constrained by runtime version
|
|
118
|
+
* Falls back to a default branch
|
|
119
|
+
*
|
|
120
|
+
* Example:
|
|
121
|
+
* {
|
|
122
|
+
version: 0,
|
|
123
|
+
data: [
|
|
124
|
+
{
|
|
125
|
+
branchId: uuidv4(),
|
|
126
|
+
branchMappingLogic: andStatement([
|
|
127
|
+
{
|
|
128
|
+
operand: '1.0.0',
|
|
129
|
+
clientKey: 'runtimeVersion',
|
|
130
|
+
branchMappingOperator: equalsOperator(),
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
operand: 10 / 100,
|
|
134
|
+
clientKey: 'rolloutToken',
|
|
135
|
+
branchMappingOperator: hashLtOperator(),
|
|
136
|
+
},
|
|
137
|
+
]),
|
|
138
|
+
},
|
|
139
|
+
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
|
140
|
+
],
|
|
141
|
+
}
|
|
142
|
+
*/
|
|
143
|
+
function isRolloutBranchMapping(branchMapping) {
|
|
144
|
+
return isUnconstrainedRollout(branchMapping) || isRtvConstrainedRollout(branchMapping);
|
|
145
|
+
}
|
|
146
|
+
exports.isRolloutBranchMapping = isRolloutBranchMapping;
|
|
147
|
+
function isRollout(channelInfo) {
|
|
148
|
+
const branchMapping = (0, branch_mapping_1.getBranchMapping)(channelInfo.branchMapping);
|
|
149
|
+
return isRolloutBranchMapping(branchMapping);
|
|
150
|
+
}
|
|
151
|
+
exports.isRollout = isRollout;
|
|
152
|
+
function createRolloutBranchMapping({ defaultBranchId, rolloutBranchId, percent, runtimeVersion, }) {
|
|
153
|
+
assertPercent(percent);
|
|
154
|
+
return {
|
|
155
|
+
version: 0,
|
|
156
|
+
data: [
|
|
157
|
+
{
|
|
158
|
+
branchId: rolloutBranchId,
|
|
159
|
+
branchMappingLogic: [
|
|
160
|
+
'and',
|
|
161
|
+
{
|
|
162
|
+
operand: runtimeVersion,
|
|
163
|
+
clientKey: 'runtimeVersion',
|
|
164
|
+
branchMappingOperator: '==',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
operand: percent / 100,
|
|
168
|
+
clientKey: 'rolloutToken',
|
|
169
|
+
branchMappingOperator: 'hash_lt',
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
{ branchId: defaultBranchId, branchMappingLogic: (0, branch_mapping_1.alwaysTrue)() },
|
|
174
|
+
],
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
exports.createRolloutBranchMapping = createRolloutBranchMapping;
|
|
178
|
+
function editRolloutBranchMapping(branchMapping, percent) {
|
|
179
|
+
assertPercent(percent);
|
|
180
|
+
if (isRtvConstrainedRollout(branchMapping)) {
|
|
181
|
+
return editRtvConstrainedRollout(branchMapping, percent);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
return editLegacyRollout(branchMapping, percent);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.editRolloutBranchMapping = editRolloutBranchMapping;
|
|
188
|
+
function editRtvConstrainedRollout(branchMapping, percent) {
|
|
189
|
+
const newBranchMapping = { ...branchMapping };
|
|
190
|
+
const statementNode = newBranchMapping.data[0].branchMappingLogic;
|
|
191
|
+
const nodesFromStatement = (0, branch_mapping_1.getNodesFromStatement)(statementNode);
|
|
192
|
+
const rolloutNode = nodesFromStatement.find(isRolloutNode);
|
|
193
|
+
(0, assert_1.default)(rolloutNode, 'Rollout node must be defined.');
|
|
194
|
+
rolloutNode.operand = percent / 100;
|
|
195
|
+
return newBranchMapping;
|
|
196
|
+
}
|
|
197
|
+
function editLegacyRollout(branchMapping, percent) {
|
|
198
|
+
const newBranchMapping = { ...branchMapping };
|
|
199
|
+
const rolloutNode = newBranchMapping.data[0].branchMappingLogic;
|
|
200
|
+
rolloutNode.operand = percent / 100;
|
|
201
|
+
return newBranchMapping;
|
|
202
|
+
}
|
|
203
|
+
function isRtvConstrainedRollout(branchMapping) {
|
|
204
|
+
if (branchMapping.data.length !== 2) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
const hasRtvRolloutNode = isRtvConstrainedRolloutNode(branchMapping.data[0].branchMappingLogic);
|
|
208
|
+
const defaultsToAlwaysTrueNode = (0, branch_mapping_1.isAlwaysTrue)(branchMapping.data[1].branchMappingLogic);
|
|
209
|
+
return hasRtvRolloutNode && defaultsToAlwaysTrueNode;
|
|
210
|
+
}
|
|
211
|
+
function isRtvConstrainedRolloutNode(node) {
|
|
212
|
+
if (!(0, branch_mapping_1.isStatement)(node) || !(0, branch_mapping_1.isAndStatement)(node)) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
const statementNodes = (0, branch_mapping_1.getNodesFromStatement)(node);
|
|
216
|
+
if (statementNodes.length !== 2) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
const hasRuntimeVersionNode = statementNodes.some(isRuntimeVersionNode);
|
|
220
|
+
const hasRolloutNode = statementNodes.some(isRolloutNode);
|
|
221
|
+
return hasRuntimeVersionNode && hasRolloutNode;
|
|
222
|
+
}
|
|
223
|
+
function isUnconstrainedRollout(branchMapping) {
|
|
224
|
+
if (branchMapping.data.length !== 2) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
const hasRolloutNode = isRolloutNode(branchMapping.data[0].branchMappingLogic);
|
|
228
|
+
const defaultsToAlwaysTrueNode = (0, branch_mapping_1.isAlwaysTrue)(branchMapping.data[1].branchMappingLogic);
|
|
229
|
+
return hasRolloutNode && defaultsToAlwaysTrueNode;
|
|
230
|
+
}
|
|
231
|
+
function isRuntimeVersionNode(node) {
|
|
232
|
+
if (typeof node === 'string') {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
if (Array.isArray(node)) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
return node.clientKey === 'runtimeVersion' && node.branchMappingOperator === '==';
|
|
239
|
+
}
|
|
240
|
+
function isRolloutNode(node) {
|
|
241
|
+
if (typeof node === 'string') {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
if (Array.isArray(node)) {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
return node.clientKey === 'rolloutToken' && node.branchMappingOperator === 'hash_lt';
|
|
248
|
+
}
|
|
249
|
+
function assertRolloutBranchMapping(branchMapping) {
|
|
250
|
+
if (!isRolloutBranchMapping(branchMapping)) {
|
|
251
|
+
throw new branch_mapping_1.BranchMappingValidationError('Branch mapping node must be a rollout. Received: ' + JSON.stringify(branchMapping));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
exports.assertRolloutBranchMapping = assertRolloutBranchMapping;
|
|
255
|
+
function assertPercent(percent) {
|
|
256
|
+
const isPercent = Number.isInteger(percent) && percent >= 0 && percent <= 100;
|
|
257
|
+
if (!isPercent) {
|
|
258
|
+
throw new branch_mapping_1.BranchMappingValidationError(`The percentage must be an integer between 0 and 100 inclusive. Received: ${percent}`);
|
|
259
|
+
}
|
|
260
|
+
}
|
package/build/rollout/utils.d.ts
CHANGED
|
@@ -1,53 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* {
|
|
12
|
-
version: 0,
|
|
13
|
-
data: [
|
|
14
|
-
{
|
|
15
|
-
branchId: uuidv4(),
|
|
16
|
-
branchMappingLogic: {
|
|
17
|
-
operand: 10 / 100,
|
|
18
|
-
clientKey: 'rolloutToken',
|
|
19
|
-
branchMappingOperator: hashLtOperator(),
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
|
23
|
-
],
|
|
24
|
-
}
|
|
25
|
-
*
|
|
26
|
-
* 2. RTV constrained rollout:
|
|
27
|
-
* Maps to a rollout branch via a rollout token, constrained by runtime version
|
|
28
|
-
* Falls back to a default branch
|
|
29
|
-
*
|
|
30
|
-
* Example:
|
|
31
|
-
* {
|
|
32
|
-
version: 0,
|
|
33
|
-
data: [
|
|
34
|
-
{
|
|
35
|
-
branchId: uuidv4(),
|
|
36
|
-
branchMappingLogic: andStatement([
|
|
37
|
-
{
|
|
38
|
-
operand: '1.0.0',
|
|
39
|
-
clientKey: 'runtimeVersion',
|
|
40
|
-
branchMappingOperator: equalsOperator(),
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
operand: 10 / 100,
|
|
44
|
-
clientKey: 'rolloutToken',
|
|
45
|
-
branchMappingOperator: hashLtOperator(),
|
|
46
|
-
},
|
|
47
|
-
]),
|
|
48
|
-
},
|
|
49
|
-
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
|
50
|
-
],
|
|
51
|
-
}
|
|
52
|
-
*/
|
|
53
|
-
export declare function isRollout(branchMapping: BranchMapping): boolean;
|
|
1
|
+
import { RuntimeFragment, UpdateFragment } from '../graphql/generated';
|
|
2
|
+
import { UpdateBranchObject, UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
|
3
|
+
import { Rollout } from './branch-mapping';
|
|
4
|
+
export declare function printRollout(channel: UpdateChannelObject): void;
|
|
5
|
+
export declare function displayRolloutDetails(channelName: string, rollout: Rollout): void;
|
|
6
|
+
export declare function formatBranchWithUpdateGroup(maybeUpdateGroup: UpdateFragment[] | undefined | null, branch: UpdateBranchObject, percentRolledOut: number): string;
|
|
7
|
+
export declare function formatRuntimeWithUpdateGroup(maybeUpdateGroup: UpdateFragment[] | undefined | null, runtime: RuntimeFragment): string;
|
|
8
|
+
export declare function promptForRolloutPercentAsync({ promptMessage, }: {
|
|
9
|
+
promptMessage: string;
|
|
10
|
+
}): Promise<number>;
|
package/build/rollout/utils.js
CHANGED
|
@@ -1,105 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* {
|
|
15
|
-
version: 0,
|
|
16
|
-
data: [
|
|
17
|
-
{
|
|
18
|
-
branchId: uuidv4(),
|
|
19
|
-
branchMappingLogic: {
|
|
20
|
-
operand: 10 / 100,
|
|
21
|
-
clientKey: 'rolloutToken',
|
|
22
|
-
branchMappingOperator: hashLtOperator(),
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
|
26
|
-
],
|
|
27
|
-
}
|
|
28
|
-
*
|
|
29
|
-
* 2. RTV constrained rollout:
|
|
30
|
-
* Maps to a rollout branch via a rollout token, constrained by runtime version
|
|
31
|
-
* Falls back to a default branch
|
|
32
|
-
*
|
|
33
|
-
* Example:
|
|
34
|
-
* {
|
|
35
|
-
version: 0,
|
|
36
|
-
data: [
|
|
37
|
-
{
|
|
38
|
-
branchId: uuidv4(),
|
|
39
|
-
branchMappingLogic: andStatement([
|
|
40
|
-
{
|
|
41
|
-
operand: '1.0.0',
|
|
42
|
-
clientKey: 'runtimeVersion',
|
|
43
|
-
branchMappingOperator: equalsOperator(),
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
operand: 10 / 100,
|
|
47
|
-
clientKey: 'rolloutToken',
|
|
48
|
-
branchMappingOperator: hashLtOperator(),
|
|
49
|
-
},
|
|
50
|
-
]),
|
|
51
|
-
},
|
|
52
|
-
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
|
53
|
-
],
|
|
54
|
-
}
|
|
55
|
-
*/
|
|
56
|
-
function isRollout(branchMapping) {
|
|
57
|
-
return isUnconstrainedRollout(branchMapping) || isRtvConstrainedRollout(branchMapping);
|
|
3
|
+
exports.promptForRolloutPercentAsync = exports.formatRuntimeWithUpdateGroup = exports.formatBranchWithUpdateGroup = exports.displayRolloutDetails = exports.printRollout = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const log_1 = tslib_1.__importDefault(require("../log"));
|
|
7
|
+
const prompts_1 = require("../prompts");
|
|
8
|
+
const utils_1 = require("../update/utils");
|
|
9
|
+
const formatFields_1 = tslib_1.__importDefault(require("../utils/formatFields"));
|
|
10
|
+
const branch_mapping_1 = require("./branch-mapping");
|
|
11
|
+
function printRollout(channel) {
|
|
12
|
+
const rollout = (0, branch_mapping_1.getRollout)(channel);
|
|
13
|
+
displayRolloutDetails(channel.name, rollout);
|
|
58
14
|
}
|
|
59
|
-
exports.
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
15
|
+
exports.printRollout = printRollout;
|
|
16
|
+
function displayRolloutDetails(channelName, rollout) {
|
|
17
|
+
const rolledOutPercent = rollout.percentRolledOut;
|
|
18
|
+
log_1.default.newLine();
|
|
19
|
+
log_1.default.log(chalk_1.default.bold('🚀 Rollout:'));
|
|
20
|
+
log_1.default.log((0, formatFields_1.default)([
|
|
21
|
+
{ label: 'Channel', value: channelName },
|
|
22
|
+
...((0, branch_mapping_1.isConstrainedRollout)(rollout)
|
|
23
|
+
? [{ label: 'Runtime Version', value: rollout.runtimeVersion }]
|
|
24
|
+
: []),
|
|
25
|
+
{
|
|
26
|
+
label: 'Branches',
|
|
27
|
+
value: `${rollout.rolledOutBranch.name} (${rolledOutPercent}%), ${rollout.defaultBranch.name} (${100 - rolledOutPercent}%)`,
|
|
28
|
+
},
|
|
29
|
+
]));
|
|
30
|
+
log_1.default.addNewLineIfNone();
|
|
67
31
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
32
|
+
exports.displayRolloutDetails = displayRolloutDetails;
|
|
33
|
+
function formatBranchWithUpdateGroup(maybeUpdateGroup, branch, percentRolledOut) {
|
|
34
|
+
const lines = [];
|
|
35
|
+
lines.push(chalk_1.default.bold(`🍽️ Served by branch ${chalk_1.default.bold(branch.name)} (${percentRolledOut}%)`));
|
|
36
|
+
if (!maybeUpdateGroup) {
|
|
37
|
+
lines.push(`No updates for target runtime`);
|
|
71
38
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
const hasRuntimeVersionNode = statementNodes.some(isRuntimeVersionNode);
|
|
77
|
-
const hasRolloutNode = statementNodes.some(isRolloutNode);
|
|
78
|
-
return hasRuntimeVersionNode && hasRolloutNode;
|
|
79
|
-
}
|
|
80
|
-
function isUnconstrainedRollout(branchMapping) {
|
|
81
|
-
if (branchMapping.data.length !== 2) {
|
|
82
|
-
return false;
|
|
39
|
+
else {
|
|
40
|
+
const [updateGroupDescription] = (0, utils_1.getUpdateGroupDescriptions)([maybeUpdateGroup]);
|
|
41
|
+
lines.push(...formatUpdateGroup(updateGroupDescription));
|
|
83
42
|
}
|
|
84
|
-
|
|
85
|
-
const defaultsToAlwaysTrueNode = (0, branch_mapping_1.isAlwaysTrue)(branchMapping.data[1].branchMappingLogic);
|
|
86
|
-
return hasRolloutNode && defaultsToAlwaysTrueNode;
|
|
43
|
+
return lines.join('\n ');
|
|
87
44
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
45
|
+
exports.formatBranchWithUpdateGroup = formatBranchWithUpdateGroup;
|
|
46
|
+
function formatRuntimeWithUpdateGroup(maybeUpdateGroup, runtime) {
|
|
47
|
+
const lines = [];
|
|
48
|
+
lines.push(chalk_1.default.bold(`🍽️ Served by runtime ${chalk_1.default.bold(runtime.version)}:`));
|
|
49
|
+
if (!maybeUpdateGroup) {
|
|
50
|
+
lines.push(`No updates published for this runtime`);
|
|
91
51
|
}
|
|
92
|
-
|
|
93
|
-
|
|
52
|
+
else {
|
|
53
|
+
const [updateGroupDescription] = (0, utils_1.getUpdateGroupDescriptions)([maybeUpdateGroup]);
|
|
54
|
+
lines.push(...formatUpdateGroup(updateGroupDescription));
|
|
94
55
|
}
|
|
95
|
-
return
|
|
56
|
+
return lines.join('\n ');
|
|
96
57
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
58
|
+
exports.formatRuntimeWithUpdateGroup = formatRuntimeWithUpdateGroup;
|
|
59
|
+
function formatUpdateGroup(updateGroup) {
|
|
60
|
+
var _a, _b, _c, _d;
|
|
61
|
+
const lines = [];
|
|
62
|
+
const formattedLines = (0, formatFields_1.default)([
|
|
63
|
+
{ label: 'Message', value: (_a = updateGroup.message) !== null && _a !== void 0 ? _a : 'N/A' },
|
|
64
|
+
{ label: 'Runtime Version', value: (_b = updateGroup.runtimeVersion) !== null && _b !== void 0 ? _b : 'N/A' },
|
|
65
|
+
{ label: 'Platforms', value: (_c = updateGroup.platforms) !== null && _c !== void 0 ? _c : 'N/A' },
|
|
66
|
+
{ label: 'Group ID', value: (_d = updateGroup.group) !== null && _d !== void 0 ? _d : 'N/A' },
|
|
67
|
+
]).split('\n');
|
|
68
|
+
lines.push(...formattedLines);
|
|
69
|
+
return lines;
|
|
70
|
+
}
|
|
71
|
+
async function promptForRolloutPercentAsync({ promptMessage, }) {
|
|
72
|
+
const { name: rolloutPercent } = await (0, prompts_1.promptAsync)({
|
|
73
|
+
type: 'text',
|
|
74
|
+
name: 'name',
|
|
75
|
+
format: value => {
|
|
76
|
+
return parseInt(value, 10);
|
|
77
|
+
},
|
|
78
|
+
message: promptMessage,
|
|
79
|
+
initial: 0,
|
|
80
|
+
validate: (rolloutPercent) => {
|
|
81
|
+
const floatValue = parseFloat(rolloutPercent);
|
|
82
|
+
return Number.isInteger(floatValue) && floatValue >= 0 && floatValue <= 100
|
|
83
|
+
? true
|
|
84
|
+
: 'The rollout percentage must be an integer between 0 and 100 inclusive.';
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
return rolloutPercent;
|
|
105
88
|
}
|
|
89
|
+
exports.promptForRolloutPercentAsync = promptForRolloutPercentAsync;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { ExpoConfig } from '@expo/config-types';
|
|
2
|
+
import { Workflow } from '@expo/eas-build-job';
|
|
2
3
|
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
3
4
|
import { RequestedPlatform } from '../platform';
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49: {
|
|
6
|
+
readonly policy: "appVersion";
|
|
7
|
+
};
|
|
8
|
+
export declare const DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48: {
|
|
5
9
|
readonly policy: "sdkVersion";
|
|
6
10
|
};
|
|
7
11
|
export declare const DEFAULT_BARE_RUNTIME_VERSION: "1.0.0";
|
|
12
|
+
export declare function getDefaultRuntimeVersion(workflow: Workflow, sdkVersion: string | undefined): NonNullable<ExpoConfig['runtimeVersion']>;
|
|
8
13
|
/**
|
|
9
14
|
* Make sure EAS Build profiles are configured to work with EAS Update by adding channels to build profiles.
|
|
10
15
|
*/
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureUseClassicUpdatesIsRemovedAsync = exports.ensureEASUpdateIsConfiguredAsync = exports.ensureEASUpdateIsConfiguredInEasJsonAsync = exports.DEFAULT_BARE_RUNTIME_VERSION = exports.
|
|
3
|
+
exports.ensureUseClassicUpdatesIsRemovedAsync = exports.ensureEASUpdateIsConfiguredAsync = exports.ensureEASUpdateIsConfiguredInEasJsonAsync = exports.getDefaultRuntimeVersion = exports.DEFAULT_BARE_RUNTIME_VERSION = exports.DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48 = exports.DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49 = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
6
6
|
const eas_json_1 = require("@expo/eas-json");
|
|
7
7
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
8
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
9
|
+
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
9
10
|
const api_1 = require("../api");
|
|
10
11
|
const generated_1 = require("../graphql/generated");
|
|
11
12
|
const log_1 = tslib_1.__importStar(require("../log"));
|
|
@@ -16,13 +17,20 @@ const workflow_1 = require("../project/workflow");
|
|
|
16
17
|
const prompts_1 = require("../prompts");
|
|
17
18
|
const UpdatesModule_1 = require("./android/UpdatesModule");
|
|
18
19
|
const UpdatesModule_2 = require("./ios/UpdatesModule");
|
|
19
|
-
exports.
|
|
20
|
+
exports.DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49 = { policy: 'appVersion' };
|
|
21
|
+
exports.DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48 = { policy: 'sdkVersion' };
|
|
20
22
|
exports.DEFAULT_BARE_RUNTIME_VERSION = '1.0.0';
|
|
21
|
-
function getDefaultRuntimeVersion(workflow) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
function getDefaultRuntimeVersion(workflow, sdkVersion) {
|
|
24
|
+
if (workflow === eas_build_job_1.Workflow.GENERIC) {
|
|
25
|
+
return exports.DEFAULT_BARE_RUNTIME_VERSION;
|
|
26
|
+
}
|
|
27
|
+
// Expo Go supports loading appVersion SDK 49 and above
|
|
28
|
+
const hasSupportedSdk = sdkVersion && semver_1.default.satisfies(sdkVersion, '>= 49.0.0');
|
|
29
|
+
return hasSupportedSdk
|
|
30
|
+
? exports.DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49
|
|
31
|
+
: exports.DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48;
|
|
25
32
|
}
|
|
33
|
+
exports.getDefaultRuntimeVersion = getDefaultRuntimeVersion;
|
|
26
34
|
function isRuntimeEqual(runtimeVersionA, runtimeVersionB) {
|
|
27
35
|
if (typeof runtimeVersionA === 'string' && typeof runtimeVersionB === 'string') {
|
|
28
36
|
return runtimeVersionA === runtimeVersionB;
|
|
@@ -81,8 +89,10 @@ async function ensureEASUpdatesIsConfiguredInExpoConfigAsync({ exp, projectId, p
|
|
|
81
89
|
let iosRuntimeVersion = (_e = (_d = exp.ios) === null || _d === void 0 ? void 0 : _d.runtimeVersion) !== null && _e !== void 0 ? _e : exp.runtimeVersion;
|
|
82
90
|
if ((['all', 'android'].includes(platform) && !androidRuntimeVersion) ||
|
|
83
91
|
(['all', 'ios'].includes(platform) && !iosRuntimeVersion)) {
|
|
84
|
-
androidRuntimeVersion =
|
|
85
|
-
|
|
92
|
+
androidRuntimeVersion =
|
|
93
|
+
androidRuntimeVersion !== null && androidRuntimeVersion !== void 0 ? androidRuntimeVersion : getDefaultRuntimeVersion(workflows.android, exp.sdkVersion);
|
|
94
|
+
iosRuntimeVersion =
|
|
95
|
+
iosRuntimeVersion !== null && iosRuntimeVersion !== void 0 ? iosRuntimeVersion : getDefaultRuntimeVersion(workflows.ios, exp.sdkVersion);
|
|
86
96
|
if (platform === 'all' && isRuntimeEqual(androidRuntimeVersion, iosRuntimeVersion)) {
|
|
87
97
|
modifyConfig.runtimeVersion = androidRuntimeVersion;
|
|
88
98
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ExpoConfig } from '@expo/config';
|
|
2
|
+
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
3
|
+
import { Update } from '../graphql/generated';
|
|
4
|
+
export type UpdateToRepublish = {
|
|
5
|
+
groupId: string;
|
|
6
|
+
branchId: string;
|
|
7
|
+
branchName: string;
|
|
8
|
+
} & Pick<Update, 'message' | 'runtimeVersion' | 'manifestFragment' | 'platform' | 'gitCommitHash' | 'codeSigningInfo'>;
|
|
9
|
+
/**
|
|
10
|
+
* @param updatesToPublish The update group to republish
|
|
11
|
+
* @param targetBranch The branch to repubish the update group on
|
|
12
|
+
*/
|
|
13
|
+
export declare function republishAsync({ graphqlClient, app, updatesToPublish, targetBranch, updateMessage, json, }: {
|
|
14
|
+
graphqlClient: ExpoGraphqlClient;
|
|
15
|
+
app: {
|
|
16
|
+
exp: ExpoConfig;
|
|
17
|
+
projectId: string;
|
|
18
|
+
};
|
|
19
|
+
updatesToPublish: UpdateToRepublish[];
|
|
20
|
+
targetBranch: {
|
|
21
|
+
branchName: string;
|
|
22
|
+
branchId: string;
|
|
23
|
+
};
|
|
24
|
+
updateMessage: string;
|
|
25
|
+
json?: boolean;
|
|
26
|
+
}): Promise<void>;
|