eoas 3.1.1 → 3.1.2-beta
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/dist/commands/init.js +14 -1
- package/dist/lib/expoConfig.d.ts +6 -0
- package/dist/lib/expoConfig.js +37 -4
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -105,9 +105,22 @@ class Init extends core_1.Command {
|
|
|
105
105
|
.replace(/\\/g, '\\\\')
|
|
106
106
|
.replace(/'/g, "\\'")}'`,
|
|
107
107
|
enabled: true,
|
|
108
|
+
// Branch surfing: a build on a channel that allows it can be pointed at
|
|
109
|
+
// another branch at runtime, and expo-updates only accepts an override for
|
|
110
|
+
// header keys that already existed at build time — so these have to be
|
|
111
|
+
// declared here even when the value is empty. Dropping one of them does not
|
|
112
|
+
// disable the feature, it strips that header from every poll for the rest of
|
|
113
|
+
// the install; the picker refuses to appear rather than let that happen.
|
|
108
114
|
requestHeaders: {
|
|
109
|
-
'expo-channel-name':
|
|
115
|
+
'expo-channel-name': {
|
|
116
|
+
__comment: 'Declare as a literal if you surf branches: see xprem-branch below.',
|
|
117
|
+
value: 'process.env.RELEASE_CHANNEL',
|
|
118
|
+
},
|
|
110
119
|
'expo-app-id': appId,
|
|
120
|
+
'xprem-branch': {
|
|
121
|
+
__comment: 'Branch surfing — the branch to serve; empty means the channel decides.',
|
|
122
|
+
value: '',
|
|
123
|
+
},
|
|
111
124
|
},
|
|
112
125
|
};
|
|
113
126
|
const updateConfigSpinner = (0, ora_1.ora)('Updating Expo config').start();
|
package/dist/lib/expoConfig.d.ts
CHANGED
|
@@ -24,4 +24,10 @@ export declare function getExpoConfigUpdateUrl(config: ExpoConfig): string | und
|
|
|
24
24
|
export declare function getExpoAppId(config: ExpoConfig): string | undefined;
|
|
25
25
|
export declare function requireExpoAppId(config: ExpoConfig): string;
|
|
26
26
|
export declare function createOrModifyExpoConfigAsync(projectDir: string, exp: Record<string, any>): Promise<void>;
|
|
27
|
+
export type CommentedValue = {
|
|
28
|
+
__comment: string;
|
|
29
|
+
value: any;
|
|
30
|
+
};
|
|
31
|
+
/** Strips the comment wrappers, for the JSON path and for reading values back. */
|
|
32
|
+
export declare function unwrapValue(value: any): any;
|
|
27
33
|
export declare function resolveServerUrl(config: ExpoConfig, customServerUrl?: string): Promise<string>;
|
package/dist/lib/expoConfig.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveServerUrl = exports.createOrModifyExpoConfigAsync = exports.requireExpoAppId = exports.getExpoAppId = exports.getExpoConfigUpdateUrl = exports.getPublicExpoConfigAsync = exports.isUsingStaticExpoConfig = exports.ensureExpoConfigExists = exports.getPrivateExpoConfigAsync = exports.RequestedPlatform = void 0;
|
|
3
|
+
exports.resolveServerUrl = exports.unwrapValue = exports.createOrModifyExpoConfigAsync = exports.requireExpoAppId = exports.getExpoAppId = exports.getExpoConfigUpdateUrl = exports.getPublicExpoConfigAsync = exports.isUsingStaticExpoConfig = exports.ensureExpoConfigExists = exports.getPrivateExpoConfigAsync = exports.RequestedPlatform = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
// This file is copied from eas-cli[https://github.com/expo/eas-cli] to ensure consistent user experience across the CLI.
|
|
6
6
|
const config_1 = require("@expo/config");
|
|
@@ -254,7 +254,33 @@ function updateObjectExpression(j, configObject, updates) {
|
|
|
254
254
|
configObject.properties.push(newProperty);
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
|
+
// The key is deliberately underscored: it is a sentinel this module reads and
|
|
258
|
+
// strips, and it must not be mistakable for a real Expo config field.
|
|
259
|
+
function isCommented(value) {
|
|
260
|
+
if (typeof value !== 'object' || value === null || !('value' in value)) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
264
|
+
return typeof value.__comment === 'string';
|
|
265
|
+
}
|
|
266
|
+
/** Strips the comment wrappers, for the JSON path and for reading values back. */
|
|
267
|
+
function unwrapValue(value) {
|
|
268
|
+
if (isCommented(value)) {
|
|
269
|
+
return unwrapValue(value.value);
|
|
270
|
+
}
|
|
271
|
+
if (Array.isArray(value)) {
|
|
272
|
+
return value.map(unwrapValue);
|
|
273
|
+
}
|
|
274
|
+
if (typeof value === 'object' && value !== null) {
|
|
275
|
+
return Object.fromEntries(Object.entries(value).map(([key, val]) => [key, unwrapValue(val)]));
|
|
276
|
+
}
|
|
277
|
+
return value;
|
|
278
|
+
}
|
|
279
|
+
exports.unwrapValue = unwrapValue;
|
|
257
280
|
function createValueNode(j, value) {
|
|
281
|
+
if (isCommented(value)) {
|
|
282
|
+
return createValueNode(j, value.value);
|
|
283
|
+
}
|
|
258
284
|
if (typeof value === 'string' && value.startsWith('process.env.')) {
|
|
259
285
|
if (/^process\.env\.\w+$/.test(value)) {
|
|
260
286
|
return j.memberExpression(j.memberExpression(j.identifier('process'), j.identifier('env')), j.identifier(value.split('.')[2]));
|
|
@@ -262,8 +288,15 @@ function createValueNode(j, value) {
|
|
|
262
288
|
return parseExpressionNode(j, value);
|
|
263
289
|
}
|
|
264
290
|
if (typeof value === 'object' && value !== null) {
|
|
265
|
-
return j.objectExpression(Object.entries(value).map(([key, val]) =>
|
|
266
|
-
|
|
291
|
+
return j.objectExpression(Object.entries(value).map(([key, val]) => {
|
|
292
|
+
// Force stringLiteral pour garder les guillemets
|
|
293
|
+
const property = j.objectProperty(j.stringLiteral(key), createValueNode(j, val));
|
|
294
|
+
if (isCommented(val)) {
|
|
295
|
+
// eslint-disable-next-line no-underscore-dangle -- see isCommented
|
|
296
|
+
property.comments = [j.commentLine(` ${val.__comment}`, true, false)];
|
|
297
|
+
}
|
|
298
|
+
return property;
|
|
299
|
+
}));
|
|
267
300
|
}
|
|
268
301
|
return j.literal(value);
|
|
269
302
|
}
|
|
@@ -276,7 +309,7 @@ function parseExpressionNode(j, code) {
|
|
|
276
309
|
// contents (backslashes in Windows paths, quotes, ...).
|
|
277
310
|
function stringifyWithEnv(obj) {
|
|
278
311
|
const rawExpressions = [];
|
|
279
|
-
const json = JSON.stringify(obj, (_key, value) => typeof value === 'string' && value.startsWith('process.env.')
|
|
312
|
+
const json = JSON.stringify(unwrapValue(obj), (_key, value) => typeof value === 'string' && value.startsWith('process.env.')
|
|
280
313
|
? `__RAW_EXPR_${rawExpressions.push(value) - 1}__`
|
|
281
314
|
: value, 2);
|
|
282
315
|
return json.replace(/"__RAW_EXPR_(\d+)__"/g, (_match, index) => rawExpressions[Number(index)]);
|