eas-cli 3.17.0 → 3.18.0
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/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 +17 -0
- package/build/channel/actions/SelectChannel.js +49 -0
- package/build/channel/branch-mapping.d.ts +4 -0
- package/build/channel/branch-mapping.js +30 -1
- package/build/channel/queries.d.ts +6 -1
- package/build/channel/queries.js +29 -3
- package/build/channel/utils.d.ts +2 -1
- package/build/channel/utils.js +14 -1
- package/build/commands/build/version/get.js +1 -0
- package/build/commands/build/version/sync.js +1 -0
- package/build/commands/channel/edit.d.ts +2 -2
- package/build/commands/channel/edit.js +4 -2
- 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/eas-update/utils.d.ts +15 -0
- package/build/eas-update/utils.js +6 -0
- package/build/graphql/generated.d.ts +89 -15
- package/build/graphql/generated.js +9 -2
- package/build/graphql/queries/ChannelQuery.d.ts +8 -4
- package/build/graphql/queries/ChannelQuery.js +43 -4
- package/build/graphql/types/UpdateChannelBasicInfo.d.ts +1 -0
- package/build/graphql/types/UpdateChannelBasicInfo.js +12 -0
- package/build/project/ios/target.d.ts +1 -1
- package/build/project/ios/target.js +4 -4
- package/build/rollout/actions/SelectRollout.d.ts +8 -0
- package/build/rollout/actions/SelectRollout.js +23 -0
- package/build/rollout/branch-mapping.d.ts +80 -0
- package/build/rollout/branch-mapping.js +211 -0
- package/build/rollout/utils.d.ts +3 -53
- package/build/rollout/utils.js +39 -100
- package/build/utils/profiles.d.ts +2 -1
- package/build/utils/profiles.js +35 -3
- package/build/utils/relay.d.ts +33 -0
- package/build/utils/relay.js +43 -0
- package/oclif.manifest.json +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getApplePlatformFromDeviceFamily = exports.getApplePlatformFromSdkRoot = exports.getApplePlatformFromTarget = exports.findTargetByName = exports.findApplicationTarget = exports.resolveTargetsAsync = exports.resolveBareProjectTargetsAsync = exports.
|
|
3
|
+
exports.getApplePlatformFromDeviceFamily = exports.getApplePlatformFromSdkRoot = exports.getApplePlatformFromTarget = exports.findTargetByName = exports.findApplicationTarget = exports.resolveTargetsAsync = exports.resolveBareProjectTargetsAsync = exports.resolveManagedProjectTargetsAsync = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
6
6
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
@@ -15,7 +15,7 @@ const AppExtensionsConfigSchema = joi_1.default.array().items(joi_1.default.obje
|
|
|
15
15
|
parentBundleIdentifier: joi_1.default.string(),
|
|
16
16
|
entitlements: joi_1.default.object(),
|
|
17
17
|
}));
|
|
18
|
-
async function
|
|
18
|
+
async function resolveManagedProjectTargetsAsync({ exp, projectDir, xcodeBuildContext, env, }) {
|
|
19
19
|
var _a, _b, _c, _d, _e, _f;
|
|
20
20
|
const { buildScheme, buildConfiguration } = xcodeBuildContext;
|
|
21
21
|
const applicationTargetName = buildScheme;
|
|
@@ -52,7 +52,7 @@ async function resolveMangedProjectTargetsAsync({ exp, projectDir, xcodeBuildCon
|
|
|
52
52
|
...extensionsTargets,
|
|
53
53
|
];
|
|
54
54
|
}
|
|
55
|
-
exports.
|
|
55
|
+
exports.resolveManagedProjectTargetsAsync = resolveManagedProjectTargetsAsync;
|
|
56
56
|
async function resolveBareProjectTargetsAsync({ exp, projectDir, xcodeBuildContext, }) {
|
|
57
57
|
const { buildScheme, buildConfiguration } = xcodeBuildContext;
|
|
58
58
|
const result = [];
|
|
@@ -93,7 +93,7 @@ async function resolveTargetsAsync(opts) {
|
|
|
93
93
|
return await resolveBareProjectTargetsAsync(opts);
|
|
94
94
|
}
|
|
95
95
|
else if (workflow === eas_build_job_1.Workflow.MANAGED) {
|
|
96
|
-
return await
|
|
96
|
+
return await resolveManagedProjectTargetsAsync(opts);
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
99
|
throw new Error(`Unknown workflow: ${workflow}`);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EASUpdateAction, EASUpdateContext } from '../../eas-update/utils';
|
|
2
|
+
import { UpdateChannelBasicInfoFragment } from '../../graphql/generated';
|
|
3
|
+
/**
|
|
4
|
+
* Select an existing rollout for the project.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SelectRollout implements EASUpdateAction<UpdateChannelBasicInfoFragment | null> {
|
|
7
|
+
runAsync(ctx: EASUpdateContext): Promise<UpdateChannelBasicInfoFragment | null>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectRollout = void 0;
|
|
4
|
+
const SelectChannel_1 = require("../../channel/actions/SelectChannel");
|
|
5
|
+
const branch_mapping_1 = require("../../channel/branch-mapping");
|
|
6
|
+
const branch_mapping_2 = require("../branch-mapping");
|
|
7
|
+
/**
|
|
8
|
+
* Select an existing rollout for the project.
|
|
9
|
+
*/
|
|
10
|
+
class SelectRollout {
|
|
11
|
+
async runAsync(ctx) {
|
|
12
|
+
const rolloutFilterPredicate = (channelInfo) => {
|
|
13
|
+
const branchMapping = (0, branch_mapping_1.getBranchMapping)(channelInfo.branchMapping);
|
|
14
|
+
return (0, branch_mapping_2.isRollout)(branchMapping);
|
|
15
|
+
};
|
|
16
|
+
const selectChannel = new SelectChannel_1.SelectChannel({
|
|
17
|
+
printedType: 'rollout',
|
|
18
|
+
filterPredicate: rolloutFilterPredicate,
|
|
19
|
+
});
|
|
20
|
+
return await selectChannel.runAsync(ctx);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.SelectRollout = SelectRollout;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { BranchMapping } from '../channel/branch-mapping';
|
|
2
|
+
import { UpdateChannelBasicInfoFragment } from '../graphql/generated';
|
|
3
|
+
import { UpdateBranchObject, UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
|
4
|
+
export type Rollout = LegacyRollout | ConstrainedRollout;
|
|
5
|
+
export type RolloutInfo = LegacyRolloutInfo | ConstrainedRolloutInfo;
|
|
6
|
+
type ConstrainedRollout = LegacyRollout & {
|
|
7
|
+
runtimeVersion: string;
|
|
8
|
+
};
|
|
9
|
+
type LegacyRollout = {
|
|
10
|
+
rolledOutBranch: UpdateBranchObject;
|
|
11
|
+
defaultBranch: UpdateBranchObject;
|
|
12
|
+
} & LegacyRolloutInfo;
|
|
13
|
+
type ConstrainedRolloutInfo = LegacyRolloutInfo & {
|
|
14
|
+
runtimeVersion: string;
|
|
15
|
+
};
|
|
16
|
+
type LegacyRolloutInfo = {
|
|
17
|
+
rolledOutBranchId: string;
|
|
18
|
+
percentRolledOut: number;
|
|
19
|
+
defaultBranchId: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function isLegacyRolloutInfo(rollout: RolloutInfo): rollout is LegacyRolloutInfo;
|
|
22
|
+
export declare function isConstrainedRolloutInfo(rollout: RolloutInfo): rollout is ConstrainedRolloutInfo;
|
|
23
|
+
export declare function isConstrainedRollout(rollout: Rollout): rollout is ConstrainedRollout;
|
|
24
|
+
export declare function getRolloutInfo(basicChannelInfo: UpdateChannelBasicInfoFragment): RolloutInfo;
|
|
25
|
+
export declare function getRolloutInfoFromBranchMapping(branchMapping: BranchMapping): RolloutInfo;
|
|
26
|
+
export declare function getRollout(channel: UpdateChannelObject): Rollout;
|
|
27
|
+
/**
|
|
28
|
+
* Detect if a branch mapping is a rollout.
|
|
29
|
+
*
|
|
30
|
+
* Types of rollout:
|
|
31
|
+
* 1. Legacy unconstrained rollout:
|
|
32
|
+
* Maps to a rollout branch via a rollout token
|
|
33
|
+
* Falls back to a default branch
|
|
34
|
+
*
|
|
35
|
+
* Example:
|
|
36
|
+
* {
|
|
37
|
+
version: 0,
|
|
38
|
+
data: [
|
|
39
|
+
{
|
|
40
|
+
branchId: uuidv4(),
|
|
41
|
+
branchMappingLogic: {
|
|
42
|
+
operand: 10 / 100,
|
|
43
|
+
clientKey: 'rolloutToken',
|
|
44
|
+
branchMappingOperator: hashLtOperator(),
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
|
48
|
+
],
|
|
49
|
+
}
|
|
50
|
+
*
|
|
51
|
+
* 2. RTV constrained rollout:
|
|
52
|
+
* Maps to a rollout branch via a rollout token, constrained by runtime version
|
|
53
|
+
* Falls back to a default branch
|
|
54
|
+
*
|
|
55
|
+
* Example:
|
|
56
|
+
* {
|
|
57
|
+
version: 0,
|
|
58
|
+
data: [
|
|
59
|
+
{
|
|
60
|
+
branchId: uuidv4(),
|
|
61
|
+
branchMappingLogic: andStatement([
|
|
62
|
+
{
|
|
63
|
+
operand: '1.0.0',
|
|
64
|
+
clientKey: 'runtimeVersion',
|
|
65
|
+
branchMappingOperator: equalsOperator(),
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
operand: 10 / 100,
|
|
69
|
+
clientKey: 'rolloutToken',
|
|
70
|
+
branchMappingOperator: hashLtOperator(),
|
|
71
|
+
},
|
|
72
|
+
]),
|
|
73
|
+
},
|
|
74
|
+
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
|
75
|
+
],
|
|
76
|
+
}
|
|
77
|
+
*/
|
|
78
|
+
export declare function isRollout(branchMapping: BranchMapping): boolean;
|
|
79
|
+
export declare function editRolloutBranchMapping(branchMapping: BranchMapping, percent: number): BranchMapping;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.editRolloutBranchMapping = exports.isRollout = 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 branchMapping = (0, branch_mapping_1.getBranchMapping)(basicChannelInfo.branchMapping);
|
|
22
|
+
assertRollout(branchMapping);
|
|
23
|
+
return getRolloutInfoFromBranchMapping(branchMapping);
|
|
24
|
+
}
|
|
25
|
+
exports.getRolloutInfo = getRolloutInfo;
|
|
26
|
+
function getRolloutInfoFromBranchMapping(branchMapping) {
|
|
27
|
+
assertRollout(branchMapping);
|
|
28
|
+
const rolledOutBranchId = branchMapping.data[0].branchId;
|
|
29
|
+
const defaultBranchId = branchMapping.data[1].branchId;
|
|
30
|
+
if (isRtvConstrainedRollout(branchMapping)) {
|
|
31
|
+
const statementNode = branchMapping.data[0].branchMappingLogic;
|
|
32
|
+
(0, branch_mapping_1.assertStatement)(statementNode);
|
|
33
|
+
const nodesFromStatement = (0, branch_mapping_1.getNodesFromStatement)(statementNode);
|
|
34
|
+
const runtimeVersionNode = nodesFromStatement.find(isRuntimeVersionNode);
|
|
35
|
+
(0, assert_1.default)(runtimeVersionNode, 'Runtime version node must be defined.');
|
|
36
|
+
(0, branch_mapping_1.assertNodeObject)(runtimeVersionNode);
|
|
37
|
+
const runtimeVersion = runtimeVersionNode.operand;
|
|
38
|
+
(0, branch_mapping_1.assertString)(runtimeVersion);
|
|
39
|
+
const rolloutNode = nodesFromStatement.find(isRolloutNode);
|
|
40
|
+
(0, assert_1.default)(rolloutNode, 'Rollout node must be defined.');
|
|
41
|
+
(0, branch_mapping_1.assertNodeObject)(rolloutNode);
|
|
42
|
+
const operand = rolloutNode.operand;
|
|
43
|
+
(0, branch_mapping_1.assertNumber)(operand);
|
|
44
|
+
return {
|
|
45
|
+
rolledOutBranchId,
|
|
46
|
+
percentRolledOut: operand * 100,
|
|
47
|
+
runtimeVersion,
|
|
48
|
+
defaultBranchId,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const rolloutNode = branchMapping.data[0].branchMappingLogic;
|
|
53
|
+
(0, branch_mapping_1.assertNodeObject)(rolloutNode);
|
|
54
|
+
const operand = rolloutNode.operand;
|
|
55
|
+
(0, branch_mapping_1.assertNumber)(operand);
|
|
56
|
+
return {
|
|
57
|
+
rolledOutBranchId,
|
|
58
|
+
percentRolledOut: operand * 100,
|
|
59
|
+
defaultBranchId,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.getRolloutInfoFromBranchMapping = getRolloutInfoFromBranchMapping;
|
|
64
|
+
function getRollout(channel) {
|
|
65
|
+
const branchMapping = (0, branch_mapping_1.getBranchMapping)(channel.branchMapping);
|
|
66
|
+
assertRollout(branchMapping);
|
|
67
|
+
const rolledOutBranchId = branchMapping.data[0].branchId;
|
|
68
|
+
const rolledOutBranch = (0, utils_1.getUpdateBranch)(channel, rolledOutBranchId);
|
|
69
|
+
const defaultBranchId = branchMapping.data[1].branchId;
|
|
70
|
+
const defaultBranch = (0, utils_1.getUpdateBranch)(channel, defaultBranchId);
|
|
71
|
+
const rolloutInfo = getRolloutInfo(channel);
|
|
72
|
+
return {
|
|
73
|
+
...rolloutInfo,
|
|
74
|
+
rolledOutBranch,
|
|
75
|
+
defaultBranch,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
exports.getRollout = getRollout;
|
|
79
|
+
/**
|
|
80
|
+
* Detect if a branch mapping is a rollout.
|
|
81
|
+
*
|
|
82
|
+
* Types of rollout:
|
|
83
|
+
* 1. Legacy unconstrained rollout:
|
|
84
|
+
* Maps to a rollout branch via a rollout token
|
|
85
|
+
* Falls back to a default branch
|
|
86
|
+
*
|
|
87
|
+
* Example:
|
|
88
|
+
* {
|
|
89
|
+
version: 0,
|
|
90
|
+
data: [
|
|
91
|
+
{
|
|
92
|
+
branchId: uuidv4(),
|
|
93
|
+
branchMappingLogic: {
|
|
94
|
+
operand: 10 / 100,
|
|
95
|
+
clientKey: 'rolloutToken',
|
|
96
|
+
branchMappingOperator: hashLtOperator(),
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
|
100
|
+
],
|
|
101
|
+
}
|
|
102
|
+
*
|
|
103
|
+
* 2. RTV constrained rollout:
|
|
104
|
+
* Maps to a rollout branch via a rollout token, constrained by runtime version
|
|
105
|
+
* Falls back to a default branch
|
|
106
|
+
*
|
|
107
|
+
* Example:
|
|
108
|
+
* {
|
|
109
|
+
version: 0,
|
|
110
|
+
data: [
|
|
111
|
+
{
|
|
112
|
+
branchId: uuidv4(),
|
|
113
|
+
branchMappingLogic: andStatement([
|
|
114
|
+
{
|
|
115
|
+
operand: '1.0.0',
|
|
116
|
+
clientKey: 'runtimeVersion',
|
|
117
|
+
branchMappingOperator: equalsOperator(),
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
operand: 10 / 100,
|
|
121
|
+
clientKey: 'rolloutToken',
|
|
122
|
+
branchMappingOperator: hashLtOperator(),
|
|
123
|
+
},
|
|
124
|
+
]),
|
|
125
|
+
},
|
|
126
|
+
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
|
127
|
+
],
|
|
128
|
+
}
|
|
129
|
+
*/
|
|
130
|
+
function isRollout(branchMapping) {
|
|
131
|
+
return isUnconstrainedRollout(branchMapping) || isRtvConstrainedRollout(branchMapping);
|
|
132
|
+
}
|
|
133
|
+
exports.isRollout = isRollout;
|
|
134
|
+
function editRolloutBranchMapping(branchMapping, percent) {
|
|
135
|
+
(0, assert_1.default)(Number.isInteger(percent) && percent >= 0 && percent <= 100, 'The rollout percentage must be an integer between 0 and 100 inclusive.');
|
|
136
|
+
assertRollout(branchMapping);
|
|
137
|
+
if (isRtvConstrainedRollout(branchMapping)) {
|
|
138
|
+
return editRtvConstrainedRollout(branchMapping, percent);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
return editLegacyRollout(branchMapping, percent);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.editRolloutBranchMapping = editRolloutBranchMapping;
|
|
145
|
+
function editRtvConstrainedRollout(branchMapping, percent) {
|
|
146
|
+
const newBranchMapping = { ...branchMapping };
|
|
147
|
+
const statementNode = newBranchMapping.data[0].branchMappingLogic;
|
|
148
|
+
(0, branch_mapping_1.assertStatement)(statementNode);
|
|
149
|
+
const nodesFromStatement = (0, branch_mapping_1.getNodesFromStatement)(statementNode);
|
|
150
|
+
const rolloutNode = nodesFromStatement.find(isRolloutNode);
|
|
151
|
+
(0, assert_1.default)(rolloutNode, 'Rollout node must be defined.');
|
|
152
|
+
(0, branch_mapping_1.assertNodeObject)(rolloutNode);
|
|
153
|
+
rolloutNode.operand = percent / 100;
|
|
154
|
+
return newBranchMapping;
|
|
155
|
+
}
|
|
156
|
+
function editLegacyRollout(branchMapping, percent) {
|
|
157
|
+
const newBranchMapping = { ...branchMapping };
|
|
158
|
+
const rolloutNode = newBranchMapping.data[0].branchMappingLogic;
|
|
159
|
+
(0, branch_mapping_1.assertNodeObject)(rolloutNode);
|
|
160
|
+
rolloutNode.operand = percent / 100;
|
|
161
|
+
return newBranchMapping;
|
|
162
|
+
}
|
|
163
|
+
function assertRollout(branchMapping) {
|
|
164
|
+
(0, assert_1.default)(isRollout(branchMapping), 'Branch mapping node must be a rollout. Received: ' + JSON.stringify(branchMapping));
|
|
165
|
+
}
|
|
166
|
+
function isRtvConstrainedRollout(branchMapping) {
|
|
167
|
+
if (branchMapping.data.length !== 2) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
const hasRtvRolloutNode = isRtvConstrainedRolloutNode(branchMapping.data[0].branchMappingLogic);
|
|
171
|
+
const defaultsToAlwaysTrueNode = (0, branch_mapping_1.isAlwaysTrue)(branchMapping.data[1].branchMappingLogic);
|
|
172
|
+
return hasRtvRolloutNode && defaultsToAlwaysTrueNode;
|
|
173
|
+
}
|
|
174
|
+
function isRtvConstrainedRolloutNode(node) {
|
|
175
|
+
if (!(0, branch_mapping_1.isStatement)(node) || !(0, branch_mapping_1.isAndStatement)(node)) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
const statementNodes = (0, branch_mapping_1.getNodesFromStatement)(node);
|
|
179
|
+
if (statementNodes.length !== 2) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
const hasRuntimeVersionNode = statementNodes.some(isRuntimeVersionNode);
|
|
183
|
+
const hasRolloutNode = statementNodes.some(isRolloutNode);
|
|
184
|
+
return hasRuntimeVersionNode && hasRolloutNode;
|
|
185
|
+
}
|
|
186
|
+
function isUnconstrainedRollout(branchMapping) {
|
|
187
|
+
if (branchMapping.data.length !== 2) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
const hasRolloutNode = isRolloutNode(branchMapping.data[0].branchMappingLogic);
|
|
191
|
+
const defaultsToAlwaysTrueNode = (0, branch_mapping_1.isAlwaysTrue)(branchMapping.data[1].branchMappingLogic);
|
|
192
|
+
return hasRolloutNode && defaultsToAlwaysTrueNode;
|
|
193
|
+
}
|
|
194
|
+
function isRuntimeVersionNode(node) {
|
|
195
|
+
if (typeof node === 'string') {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
if (Array.isArray(node)) {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
return node.clientKey === 'runtimeVersion' && node.branchMappingOperator === '==';
|
|
202
|
+
}
|
|
203
|
+
function isRolloutNode(node) {
|
|
204
|
+
if (typeof node === 'string') {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
if (Array.isArray(node)) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
return node.clientKey === 'rolloutToken' && node.branchMappingOperator === 'hash_lt';
|
|
211
|
+
}
|
package/build/rollout/utils.d.ts
CHANGED
|
@@ -1,53 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Types of rollout:
|
|
6
|
-
* 1. Legacy unconstrained rollout:
|
|
7
|
-
* Maps to a rollout branch via a rollout token
|
|
8
|
-
* Falls back to a default branch
|
|
9
|
-
*
|
|
10
|
-
* Example:
|
|
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 { UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
|
2
|
+
export declare function printRollout(channel: UpdateChannelObject): void;
|
|
3
|
+
export declare function printBranch(channel: UpdateChannelObject): void;
|
package/build/rollout/utils.js
CHANGED
|
@@ -1,105 +1,44 @@
|
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
branchMappingOperator: hashLtOperator(),
|
|
3
|
+
exports.printBranch = 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 formatFields_1 = tslib_1.__importDefault(require("../utils/formatFields"));
|
|
8
|
+
const branch_mapping_1 = require("./branch-mapping");
|
|
9
|
+
function printRollout(channel) {
|
|
10
|
+
const rollout = (0, branch_mapping_1.getRollout)(channel);
|
|
11
|
+
const rolledOutPercent = rollout.percentRolledOut;
|
|
12
|
+
log_1.default.addNewLineIfNone();
|
|
13
|
+
log_1.default.log(chalk_1.default.bold('Rollout:'));
|
|
14
|
+
log_1.default.log((0, formatFields_1.default)([
|
|
15
|
+
{ label: 'Channel', value: channel.name },
|
|
16
|
+
...((0, branch_mapping_1.isConstrainedRollout)(rollout)
|
|
17
|
+
? [{ label: 'Runtime Version', value: rollout.runtimeVersion }]
|
|
18
|
+
: []),
|
|
19
|
+
{
|
|
20
|
+
label: 'Branches',
|
|
21
|
+
value: `${rollout.rolledOutBranch.name} (${rolledOutPercent}%), ${rollout.defaultBranch.name} (${100 - rolledOutPercent}%)`,
|
|
23
22
|
},
|
|
24
|
-
|
|
25
|
-
|
|
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);
|
|
23
|
+
]));
|
|
24
|
+
log_1.default.addNewLineIfNone();
|
|
58
25
|
}
|
|
59
|
-
exports.
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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;
|
|
83
|
-
}
|
|
84
|
-
const hasRolloutNode = isRolloutNode(branchMapping.data[0].branchMappingLogic);
|
|
85
|
-
const defaultsToAlwaysTrueNode = (0, branch_mapping_1.isAlwaysTrue)(branchMapping.data[1].branchMappingLogic);
|
|
86
|
-
return hasRolloutNode && defaultsToAlwaysTrueNode;
|
|
87
|
-
}
|
|
88
|
-
function isRuntimeVersionNode(node) {
|
|
89
|
-
if (typeof node === 'string') {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
if (Array.isArray(node)) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
return node.clientKey === 'runtimeVersion' && node.branchMappingOperator === '==';
|
|
96
|
-
}
|
|
97
|
-
function isRolloutNode(node) {
|
|
98
|
-
if (typeof node === 'string') {
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
if (Array.isArray(node)) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
return node.clientKey === 'rolloutToken' && node.branchMappingOperator === 'hash_lt';
|
|
26
|
+
exports.printRollout = printRollout;
|
|
27
|
+
function printBranch(channel) {
|
|
28
|
+
const rollout = (0, branch_mapping_1.getRollout)(channel);
|
|
29
|
+
const rolledOutPercent = rollout.percentRolledOut;
|
|
30
|
+
log_1.default.addNewLineIfNone();
|
|
31
|
+
log_1.default.log(chalk_1.default.bold('Rollout:'));
|
|
32
|
+
log_1.default.log((0, formatFields_1.default)([
|
|
33
|
+
{ label: 'Channel', value: channel.name },
|
|
34
|
+
...((0, branch_mapping_1.isConstrainedRollout)(rollout)
|
|
35
|
+
? [{ label: 'Runtime Version', value: rollout.runtimeVersion }]
|
|
36
|
+
: []),
|
|
37
|
+
{
|
|
38
|
+
label: 'Branches',
|
|
39
|
+
value: `${rollout.rolledOutBranch.name} (${rolledOutPercent}%), ${rollout.defaultBranch.name} (${100 - rolledOutPercent}%)`,
|
|
40
|
+
},
|
|
41
|
+
]));
|
|
42
|
+
log_1.default.addNewLineIfNone();
|
|
105
43
|
}
|
|
44
|
+
exports.printBranch = printBranch;
|
|
@@ -6,10 +6,11 @@ export type ProfileData<T extends ProfileType> = {
|
|
|
6
6
|
platform: Platform;
|
|
7
7
|
profileName: string;
|
|
8
8
|
};
|
|
9
|
-
export declare function getProfilesAsync<T extends ProfileType>({ easJsonAccessor, platforms, profileName, type, }: {
|
|
9
|
+
export declare function getProfilesAsync<T extends ProfileType>({ easJsonAccessor, platforms, profileName, type, projectDir, }: {
|
|
10
10
|
easJsonAccessor: EasJsonAccessor;
|
|
11
11
|
platforms: Platform[];
|
|
12
12
|
profileName?: string;
|
|
13
|
+
projectDir: string;
|
|
13
14
|
type: T;
|
|
14
15
|
}): Promise<ProfileData<T>[]>;
|
|
15
16
|
/**
|
package/build/utils/profiles.js
CHANGED
|
@@ -3,14 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.maybePrintBuildProfileDeprecationWarningsAsync = exports.clearHasPrintedDeprecationWarnings = exports.getProfilesAsync = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const eas_json_1 = require("@expo/eas-json");
|
|
6
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
7
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
+
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
6
9
|
const log_1 = tslib_1.__importStar(require("../log"));
|
|
7
|
-
async function getProfilesAsync({ easJsonAccessor, platforms, profileName, type, }) {
|
|
10
|
+
async function getProfilesAsync({ easJsonAccessor, platforms, profileName, type, projectDir, }) {
|
|
8
11
|
const results = platforms.map(async function (platform) {
|
|
9
|
-
const profile = await
|
|
12
|
+
const profile = await readProfileWithOverridesAsync({
|
|
10
13
|
easJsonAccessor,
|
|
11
14
|
platform,
|
|
12
15
|
type,
|
|
13
16
|
profileName,
|
|
17
|
+
projectDir,
|
|
14
18
|
});
|
|
15
19
|
return {
|
|
16
20
|
profile,
|
|
@@ -21,10 +25,38 @@ async function getProfilesAsync({ easJsonAccessor, platforms, profileName, type,
|
|
|
21
25
|
return await Promise.all(results);
|
|
22
26
|
}
|
|
23
27
|
exports.getProfilesAsync = getProfilesAsync;
|
|
24
|
-
async function
|
|
28
|
+
async function setNodeVersionFromFileAsync(projectDir, profile) {
|
|
29
|
+
if (profile === null || profile === void 0 ? void 0 : profile.node) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const nodeVersion = await getNodeVersionFromFileAsync(projectDir);
|
|
33
|
+
if (nodeVersion) {
|
|
34
|
+
log_1.default.log(`The EAS build profile does not specify a Node.js version. Using the version specified in .nvmrc: ${nodeVersion} `);
|
|
35
|
+
profile.node = nodeVersion;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function getNodeVersionFromFileAsync(projectDir) {
|
|
39
|
+
const nvmrcPath = path_1.default.join(projectDir, '.nvmrc');
|
|
40
|
+
if (!(await fs_extra_1.default.pathExists(nvmrcPath))) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
let nodeVersion;
|
|
44
|
+
try {
|
|
45
|
+
nodeVersion = (await fs_extra_1.default.readFile(nvmrcPath, 'utf8')).toString().trim();
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
if (!semver_1.default.valid(nodeVersion)) {
|
|
51
|
+
throw new Error(`Invalid node version in .nvmrc: ${nodeVersion}`);
|
|
52
|
+
}
|
|
53
|
+
return nodeVersion;
|
|
54
|
+
}
|
|
55
|
+
async function readProfileWithOverridesAsync({ easJsonAccessor, platform, type, profileName, projectDir, }) {
|
|
25
56
|
if (type === 'build') {
|
|
26
57
|
const buildProfile = await eas_json_1.EasJsonUtils.getBuildProfileAsync(easJsonAccessor, platform, profileName);
|
|
27
58
|
await maybePrintBuildProfileDeprecationWarningsAsync(easJsonAccessor, platform, profileName);
|
|
59
|
+
await setNodeVersionFromFileAsync(projectDir, buildProfile);
|
|
28
60
|
return buildProfile;
|
|
29
61
|
}
|
|
30
62
|
else {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PageInfo } from '../graphql/generated';
|
|
2
|
+
export type Connection<T> = {
|
|
3
|
+
edges: Edge<T>[];
|
|
4
|
+
pageInfo: PageInfo;
|
|
5
|
+
};
|
|
6
|
+
type Edge<T> = {
|
|
7
|
+
node: T;
|
|
8
|
+
};
|
|
9
|
+
export type QueryParams = {
|
|
10
|
+
first: number;
|
|
11
|
+
after?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Fetches dataset in paginated manner (batch by batch) using GraphQL queries.
|
|
15
|
+
*
|
|
16
|
+
* @param queryAsync A promise based function for querying.
|
|
17
|
+
* @param beforeEachQuery Optional. A callback function to be called before each query
|
|
18
|
+
* @param afterEachQuery Optional. A callback function to be called after each query.
|
|
19
|
+
* @param filterPredicate Optional. A predicate function to filter the node.
|
|
20
|
+
* @param batchSize Optional. The batch size of the pagination. Defaults to 100.
|
|
21
|
+
*
|
|
22
|
+
* @return {Promise<T[]>} - A promise that resolves to an array (the dataset).
|
|
23
|
+
* @throws {Error} - If an error occurs during execution of the query or pagination.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getPaginatedDatasetAsync<T>({ queryAsync, beforeEachQuery, afterEachQuery, filterPredicate, batchSize, maxNodesFetched, }: {
|
|
26
|
+
queryAsync: ({ first, after }: QueryParams) => Promise<Connection<T>>;
|
|
27
|
+
beforeEachQuery?: (totalNodesFetched: number, dataset: T[]) => void;
|
|
28
|
+
afterEachQuery?: (totalNodesFetched: number, dataset: T[], batch: T[], pageInfo: PageInfo) => void;
|
|
29
|
+
filterPredicate?: (node: T) => boolean;
|
|
30
|
+
batchSize?: number;
|
|
31
|
+
maxNodesFetched?: number;
|
|
32
|
+
}): Promise<T[]>;
|
|
33
|
+
export {};
|