@expo/build-tools 0.1.167 → 0.1.169
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/android/expoUpdates.d.ts +1 -0
- package/dist/android/expoUpdates.js +18 -1
- package/dist/android/expoUpdates.js.map +1 -1
- package/dist/ios/expoUpdates.d.ts +1 -0
- package/dist/ios/expoUpdates.js +18 -1
- package/dist/ios/expoUpdates.js.map +1 -1
- package/dist/utils/expoUpdates.d.ts +2 -0
- package/dist/utils/expoUpdates.js +52 -4
- package/dist/utils/expoUpdates.js.map +1 -1
- package/package.json +2 -2
|
@@ -7,6 +7,7 @@ export declare enum AndroidMetadataName {
|
|
|
7
7
|
}
|
|
8
8
|
export declare function androidSetRuntimeVersionNativelyAsync(ctx: BuildContext<Job>, runtimeVersion: string): Promise<void>;
|
|
9
9
|
export declare function androidSetChannelNativelyAsync(ctx: BuildContext<Job>): Promise<void>;
|
|
10
|
+
export declare function androidGetNativelyDefinedChannelAsync(ctx: BuildContext<Job>): Promise<string | null>;
|
|
10
11
|
export declare function androidSetClassicReleaseChannelNativelyAsync(ctx: BuildContext<Job>): Promise<void>;
|
|
11
12
|
export declare function androidGetNativelyDefinedClassicReleaseChannelAsync(ctx: BuildContext<Job>): Promise<string | null>;
|
|
12
13
|
export declare function androidGetNativelyDefinedRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null>;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.androidGetNativelyDefinedRuntimeVersionAsync = exports.androidGetNativelyDefinedClassicReleaseChannelAsync = exports.androidSetClassicReleaseChannelNativelyAsync = exports.androidSetChannelNativelyAsync = exports.androidSetRuntimeVersionNativelyAsync = exports.AndroidMetadataName = void 0;
|
|
6
|
+
exports.androidGetNativelyDefinedRuntimeVersionAsync = exports.androidGetNativelyDefinedClassicReleaseChannelAsync = exports.androidSetClassicReleaseChannelNativelyAsync = exports.androidGetNativelyDefinedChannelAsync = exports.androidSetChannelNativelyAsync = exports.androidSetRuntimeVersionNativelyAsync = exports.AndroidMetadataName = void 0;
|
|
7
7
|
const assert_1 = __importDefault(require("assert"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
@@ -38,6 +38,23 @@ async function androidSetChannelNativelyAsync(ctx) {
|
|
|
38
38
|
await config_plugins_1.AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);
|
|
39
39
|
}
|
|
40
40
|
exports.androidSetChannelNativelyAsync = androidSetChannelNativelyAsync;
|
|
41
|
+
async function androidGetNativelyDefinedChannelAsync(ctx) {
|
|
42
|
+
var _a;
|
|
43
|
+
const manifestPath = await config_plugins_1.AndroidConfig.Paths.getAndroidManifestAsync(ctx.reactNativeProjectDirectory);
|
|
44
|
+
if (!(await fs_extra_1.default.pathExists(manifestPath))) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const androidManifest = await config_plugins_1.AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);
|
|
48
|
+
const stringifiedUpdatesRequestHeaders = config_plugins_1.AndroidConfig.Manifest.getMainApplicationMetaDataValue(androidManifest, AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY);
|
|
49
|
+
try {
|
|
50
|
+
const updatesRequestHeaders = JSON.parse(stringifiedUpdatesRequestHeaders !== null && stringifiedUpdatesRequestHeaders !== void 0 ? stringifiedUpdatesRequestHeaders : '{}');
|
|
51
|
+
return (_a = updatesRequestHeaders['expo-channel-name']) !== null && _a !== void 0 ? _a : null;
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
throw new Error(`Failed to parse ${AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY} from AndroidManifest.xml: ${err.message}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.androidGetNativelyDefinedChannelAsync = androidGetNativelyDefinedChannelAsync;
|
|
41
58
|
async function androidSetClassicReleaseChannelNativelyAsync(ctx) {
|
|
42
59
|
const { releaseChannel } = ctx.job;
|
|
43
60
|
(0, assert_1.default)(releaseChannel, 'releaseChannel must be defined');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/android/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,wDAA0B;AAC1B,yDAA0D;AAK1D,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,mIAA4G,CAAA;IAC5G,oFAA6D,CAAA;IAC7D,oFAA6D,CAAA;AAC/D,CAAC,EAJW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAI9B;AAEM,KAAK,UAAU,qCAAqC,CACzD,GAAsB,EACtB,cAAsB;IAEtB,MAAM,YAAY,GAAG,MAAM,8BAAa,CAAC,KAAK,CAAC,uBAAuB,CACpE,GAAG,CAAC,2BAA2B,CAChC,CAAC;IAEF,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE;QACxC,MAAM,IAAI,KAAK,CAAC,qCAAqC,YAAY,EAAE,CAAC,CAAC;KACtE;IAED,MAAM,eAAe,GAAG,MAAM,8BAAa,CAAC,QAAQ,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;IAC5F,MAAM,OAAO,GAAG,8BAAa,CAAC,QAAQ,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAAC;IAClF,8BAAa,CAAC,QAAQ,CAAC,gCAAgC,CACrD,OAAO,EACP,mBAAmB,CAAC,eAAe,EACnC,cAAc,EACd,OAAO,CACR,CAAC;IACF,MAAM,8BAAa,CAAC,QAAQ,CAAC,yBAAyB,CAAC,YAAY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ACP,mBAAmB,CAAC,eAAe,EACnC,WAAW,YAAY,EAAE,EACzB,OAAO,CACR,CAAC;IACF,MAAM,8BAAa,CAAC,QAAQ,CAAC,yBAAyB,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;AACxF,CAAC;AA1CD,oGA0CC;AAEM,KAAK,UAAU,mDAAmD,CACvE,GAAsB;IAEtB,MAAM,YAAY,GAAG,MAAM,8BAAa,CAAC,KAAK,CAAC,uBAAuB,CACpE,GAAG,CAAC,2BAA2B,CAChC,CAAC;IACF,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE;QACxC,OAAO,IAAI,CAAC;KACb;IAED,MAAM,eAAe,GAAG,MAAM,8BAAa,CAAC,QAAQ,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;IAC5F,OAAO,8BAAa,CAAC,QAAQ,CAAC,+BAA+B,CAC3D,eAAe,EACf,mBAAmB,CAAC,eAAe,CACpC,CAAC;AACJ,CAAC;AAfD,kHAeC;AAEM,KAAK,UAAU,4CAA4C,CAChE,GAAsB;IAEtB,MAAM,YAAY,GAAG,MAAM,8BAAa,CAAC,KAAK,CAAC,uBAAuB,CACpE,GAAG,CAAC,2BAA2B,CAChC,CAAC;IACF,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE;QACxC,OAAO,IAAI,CAAC;KACb;IAED,MAAM,eAAe,GAAG,MAAM,8BAAa,CAAC,QAAQ,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;IAC5F,OAAO,8BAAa,CAAC,QAAQ,CAAC,+BAA+B,CAC3D,eAAe,EACf,mBAAmB,CAAC,eAAe,CACpC,CAAC;AACJ,CAAC;AAfD,oGAeC","sourcesContent":["import assert from 'assert';\n\nimport fs from 'fs-extra';\nimport { AndroidConfig, XML } from '@expo/config-plugins';\nimport { Job } from '@expo/eas-build-job';\n\nimport { BuildContext } from '../context';\n\nexport enum AndroidMetadataName {\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY',\n RELEASE_CHANNEL = 'expo.modules.updates.EXPO_RELEASE_CHANNEL',\n RUNTIME_VERSION = 'expo.modules.updates.EXPO_RUNTIME_VERSION',\n}\n\nexport async function androidSetRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.reactNativeProjectDirectory\n );\n\n if (!(await fs.pathExists(manifestPath))) {\n throw new Error(`Couldn't find Android manifest at ${manifestPath}`);\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const mainApp = AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);\n AndroidConfig.Manifest.addMetaDataItemToMainApplication(\n mainApp,\n AndroidMetadataName.RUNTIME_VERSION,\n runtimeVersion,\n 'value'\n );\n await AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);\n}\n\nexport async function androidSetChannelNativelyAsync(ctx: BuildContext<Job>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.reactNativeProjectDirectory\n );\n\n if (!(await fs.pathExists(manifestPath))) {\n throw new Error(`Couldn't find Android manifest at ${manifestPath}`);\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const mainApp = AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);\n const stringifiedUpdatesRequestHeaders = AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY\n );\n AndroidConfig.Manifest.addMetaDataItemToMainApplication(\n mainApp,\n AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY,\n JSON.stringify({\n ...JSON.parse(stringifiedUpdatesRequestHeaders ?? '{}'),\n 'expo-channel-name': ctx.job.updates.channel,\n }),\n 'value'\n );\n await AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);\n}\n\nexport async function androidSetClassicReleaseChannelNativelyAsync(\n ctx: BuildContext<Job>\n): Promise<void> {\n const { releaseChannel } = ctx.job;\n assert(releaseChannel, 'releaseChannel must be defined');\n const escapedReleaseChannel = XML.escapeAndroidString(releaseChannel);\n\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.reactNativeProjectDirectory\n );\n if (!(await fs.pathExists(manifestPath))) {\n throw new Error(`Couldn't find Android manifest at ${manifestPath}`);\n }\n\n // Store the release channel in a string resource to ensure it is interpreted as a string\n const stringResourcePath = await AndroidConfig.Strings.getProjectStringsXMLPathAsync(\n ctx.reactNativeProjectDirectory\n );\n const stringResourceObject = await AndroidConfig.Resources.readResourcesXMLAsync({\n path: stringResourcePath,\n });\n\n const resourceName = 'release_channel';\n const releaseChannelResourceItem = AndroidConfig.Resources.buildResourceItem({\n name: resourceName,\n value: escapedReleaseChannel,\n });\n const newStringResourceObject = AndroidConfig.Strings.setStringItem(\n [releaseChannelResourceItem],\n stringResourceObject\n );\n await XML.writeXMLAsync({ path: stringResourcePath, xml: newStringResourceObject });\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const mainApp = AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);\n AndroidConfig.Manifest.addMetaDataItemToMainApplication(\n mainApp,\n AndroidMetadataName.RELEASE_CHANNEL,\n `@string/${resourceName}`,\n 'value'\n );\n await AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);\n}\n\nexport async function androidGetNativelyDefinedClassicReleaseChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.reactNativeProjectDirectory\n );\n if (!(await fs.pathExists(manifestPath))) {\n return null;\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n return AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.RELEASE_CHANNEL\n );\n}\n\nexport async function androidGetNativelyDefinedRuntimeVersionAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.reactNativeProjectDirectory\n );\n if (!(await fs.pathExists(manifestPath))) {\n return null;\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n return AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.RUNTIME_VERSION\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/android/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,wDAA0B;AAC1B,yDAA0D;AAK1D,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,mIAA4G,CAAA;IAC5G,oFAA6D,CAAA;IAC7D,oFAA6D,CAAA;AAC/D,CAAC,EAJW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAI9B;AAEM,KAAK,UAAU,qCAAqC,CACzD,GAAsB,EACtB,cAAsB;IAEtB,MAAM,YAAY,GAAG,MAAM,8BAAa,CAAC,KAAK,CAAC,uBAAuB,CACpE,GAAG,CAAC,2BAA2B,CAChC,CAAC;IAEF,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE;QACxC,MAAM,IAAI,KAAK,CAAC,qCAAqC,YAAY,EAAE,CAAC,CAAC;KACtE;IAED,MAAM,eAAe,GAAG,MAAM,8BAAa,CAAC,QAAQ,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;IAC5F,MAAM,OAAO,GAAG,8BAAa,CAAC,QAAQ,CAAC,yBAAyB,CA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B,MAAM,YAAY,GAAG,MAAM,8BAAa,CAAC,KAAK,CAAC,uBAAuB,CACpE,GAAG,CAAC,2BAA2B,CAChC,CAAC;IACF,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE;QACxC,OAAO,IAAI,CAAC;KACb;IAED,MAAM,eAAe,GAAG,MAAM,8BAAa,CAAC,QAAQ,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;IAC5F,OAAO,8BAAa,CAAC,QAAQ,CAAC,+BAA+B,CAC3D,eAAe,EACf,mBAAmB,CAAC,eAAe,CACpC,CAAC;AACJ,CAAC;AAfD,kHAeC;AAEM,KAAK,UAAU,4CAA4C,CAChE,GAAsB;IAEtB,MAAM,YAAY,GAAG,MAAM,8BAAa,CAAC,KAAK,CAAC,uBAAuB,CACpE,GAAG,CAAC,2BAA2B,CAChC,CAAC;IACF,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE;QACxC,OAAO,IAAI,CAAC;KACb;IAED,MAAM,eAAe,GAAG,MAAM,8BAAa,CAAC,QAAQ,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;IAC5F,OAAO,8BAAa,CAAC,QAAQ,CAAC,+BAA+B,CAC3D,eAAe,EACf,mBAAmB,CAAC,eAAe,CACpC,CAAC;AACJ,CAAC;AAfD,oGAeC","sourcesContent":["import assert from 'assert';\n\nimport fs from 'fs-extra';\nimport { AndroidConfig, XML } from '@expo/config-plugins';\nimport { Job } from '@expo/eas-build-job';\n\nimport { BuildContext } from '../context';\n\nexport enum AndroidMetadataName {\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY',\n RELEASE_CHANNEL = 'expo.modules.updates.EXPO_RELEASE_CHANNEL',\n RUNTIME_VERSION = 'expo.modules.updates.EXPO_RUNTIME_VERSION',\n}\n\nexport async function androidSetRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.reactNativeProjectDirectory\n );\n\n if (!(await fs.pathExists(manifestPath))) {\n throw new Error(`Couldn't find Android manifest at ${manifestPath}`);\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const mainApp = AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);\n AndroidConfig.Manifest.addMetaDataItemToMainApplication(\n mainApp,\n AndroidMetadataName.RUNTIME_VERSION,\n runtimeVersion,\n 'value'\n );\n await AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);\n}\n\nexport async function androidSetChannelNativelyAsync(ctx: BuildContext<Job>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.reactNativeProjectDirectory\n );\n\n if (!(await fs.pathExists(manifestPath))) {\n throw new Error(`Couldn't find Android manifest at ${manifestPath}`);\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const mainApp = AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);\n const stringifiedUpdatesRequestHeaders = AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY\n );\n AndroidConfig.Manifest.addMetaDataItemToMainApplication(\n mainApp,\n AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY,\n JSON.stringify({\n ...JSON.parse(stringifiedUpdatesRequestHeaders ?? '{}'),\n 'expo-channel-name': ctx.job.updates.channel,\n }),\n 'value'\n );\n await AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);\n}\n\nexport async function androidGetNativelyDefinedChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.reactNativeProjectDirectory\n );\n\n if (!(await fs.pathExists(manifestPath))) {\n return null;\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const stringifiedUpdatesRequestHeaders = AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY\n );\n try {\n const updatesRequestHeaders = JSON.parse(stringifiedUpdatesRequestHeaders ?? '{}');\n return updatesRequestHeaders['expo-channel-name'] ?? null;\n } catch (err: any) {\n throw new Error(\n `Failed to parse ${AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY} from AndroidManifest.xml: ${err.message}`\n );\n }\n}\n\nexport async function androidSetClassicReleaseChannelNativelyAsync(\n ctx: BuildContext<Job>\n): Promise<void> {\n const { releaseChannel } = ctx.job;\n assert(releaseChannel, 'releaseChannel must be defined');\n const escapedReleaseChannel = XML.escapeAndroidString(releaseChannel);\n\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.reactNativeProjectDirectory\n );\n if (!(await fs.pathExists(manifestPath))) {\n throw new Error(`Couldn't find Android manifest at ${manifestPath}`);\n }\n\n // Store the release channel in a string resource to ensure it is interpreted as a string\n const stringResourcePath = await AndroidConfig.Strings.getProjectStringsXMLPathAsync(\n ctx.reactNativeProjectDirectory\n );\n const stringResourceObject = await AndroidConfig.Resources.readResourcesXMLAsync({\n path: stringResourcePath,\n });\n\n const resourceName = 'release_channel';\n const releaseChannelResourceItem = AndroidConfig.Resources.buildResourceItem({\n name: resourceName,\n value: escapedReleaseChannel,\n });\n const newStringResourceObject = AndroidConfig.Strings.setStringItem(\n [releaseChannelResourceItem],\n stringResourceObject\n );\n await XML.writeXMLAsync({ path: stringResourcePath, xml: newStringResourceObject });\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const mainApp = AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);\n AndroidConfig.Manifest.addMetaDataItemToMainApplication(\n mainApp,\n AndroidMetadataName.RELEASE_CHANNEL,\n `@string/${resourceName}`,\n 'value'\n );\n await AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);\n}\n\nexport async function androidGetNativelyDefinedClassicReleaseChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.reactNativeProjectDirectory\n );\n if (!(await fs.pathExists(manifestPath))) {\n return null;\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n return AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.RELEASE_CHANNEL\n );\n}\n\nexport async function androidGetNativelyDefinedRuntimeVersionAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.reactNativeProjectDirectory\n );\n if (!(await fs.pathExists(manifestPath))) {\n return null;\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n return AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.RUNTIME_VERSION\n );\n}\n"]}
|
|
@@ -7,6 +7,7 @@ export declare enum IosMetadataName {
|
|
|
7
7
|
}
|
|
8
8
|
export declare function iosSetRuntimeVersionNativelyAsync(ctx: BuildContext<Job>, runtimeVersion: string): Promise<void>;
|
|
9
9
|
export declare function iosSetChannelNativelyAsync(ctx: BuildContext<Job>): Promise<void>;
|
|
10
|
+
export declare function iosGetNativelyDefinedChannelAsync(ctx: BuildContext<Job>): Promise<string | null>;
|
|
10
11
|
export declare function iosSetClassicReleaseChannelNativelyAsync(ctx: BuildContext<Job>): Promise<void>;
|
|
11
12
|
export declare function iosGetNativelyDefinedClassicReleaseChannelAsync(ctx: BuildContext<Job>): Promise<string | null>;
|
|
12
13
|
export declare function iosGetNativelyDefinedRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null>;
|
package/dist/ios/expoUpdates.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.iosGetNativelyDefinedRuntimeVersionAsync = exports.iosGetNativelyDefinedClassicReleaseChannelAsync = exports.iosSetClassicReleaseChannelNativelyAsync = exports.iosSetChannelNativelyAsync = exports.iosSetRuntimeVersionNativelyAsync = exports.IosMetadataName = void 0;
|
|
6
|
+
exports.iosGetNativelyDefinedRuntimeVersionAsync = exports.iosGetNativelyDefinedClassicReleaseChannelAsync = exports.iosSetClassicReleaseChannelNativelyAsync = exports.iosGetNativelyDefinedChannelAsync = exports.iosSetChannelNativelyAsync = exports.iosSetRuntimeVersionNativelyAsync = exports.IosMetadataName = void 0;
|
|
7
7
|
const assert_1 = __importDefault(require("assert"));
|
|
8
8
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
9
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
@@ -40,6 +40,23 @@ async function iosSetChannelNativelyAsync(ctx) {
|
|
|
40
40
|
await fs_extra_1.default.writeFile(expoPlistPath, updatedExpoPlistContents);
|
|
41
41
|
}
|
|
42
42
|
exports.iosSetChannelNativelyAsync = iosSetChannelNativelyAsync;
|
|
43
|
+
async function iosGetNativelyDefinedChannelAsync(ctx) {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
const expoPlistPath = config_plugins_1.IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);
|
|
46
|
+
if (!(await fs_extra_1.default.pathExists(expoPlistPath))) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const expoPlistContents = await fs_extra_1.default.readFile(expoPlistPath, 'utf8');
|
|
50
|
+
try {
|
|
51
|
+
const items = plist_1.default.parse(expoPlistContents);
|
|
52
|
+
const updatesRequestHeaders = ((_a = items[IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY]) !== null && _a !== void 0 ? _a : {});
|
|
53
|
+
return (_b = updatesRequestHeaders['expo-channel-name']) !== null && _b !== void 0 ? _b : null;
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
throw new Error(`Failed to parse ${IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY} from Expo.plist: ${err.message}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.iosGetNativelyDefinedChannelAsync = iosGetNativelyDefinedChannelAsync;
|
|
43
60
|
async function iosSetClassicReleaseChannelNativelyAsync(ctx) {
|
|
44
61
|
(0, assert_1.default)(ctx.job.releaseChannel, 'releaseChannel must be defined');
|
|
45
62
|
const expoPlistPath = config_plugins_1.IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/ios/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,yDAAiD;AACjD,wDAA0B;AAC1B,wDAAgC;AAKhC,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,wFAAqE,CAAA;IACrE,8DAA2C,CAAA;IAC3C,8DAA2C,CAAA;AAC7C,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AAEM,KAAK,UAAU,iCAAiC,CACrD,GAAsB,EACtB,cAAsB;IAEtB,MAAM,aAAa,GAAG,0BAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAExF,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EAAE;QACzC,MAAM,IAAI,KAAK,CAAC,GAAG,aAAa,iBAAiB,CAAC,CA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CAAC,iBAAiB,CAAC,CAAC;IACnD,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,MAAA,WAAW,CAAC,eAAe,CAAC,eAAe,CAAC,mCAAI,IAAI,CAAC;AAC9D,CAAC;AAbD,0GAaC;AAEM,KAAK,UAAU,wCAAwC,CAC5D,GAAsB;;IAEtB,MAAM,aAAa,GAAG,0BAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACxF,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EAAE;QACzC,OAAO,IAAI,CAAC;KACb;IACD,MAAM,iBAAiB,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACnE,MAAM,WAAW,GAAG,eAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnD,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,MAAA,WAAW,CAAC,eAAe,CAAC,eAAe,CAAC,mCAAI,IAAI,CAAC;AAC9D,CAAC;AAbD,4FAaC","sourcesContent":["import assert from 'assert';\n\nimport { IOSConfig } from '@expo/config-plugins';\nimport fs from 'fs-extra';\nimport plist from '@expo/plist';\nimport { Job } from '@expo/eas-build-job';\n\nimport { BuildContext } from '../context';\n\nexport enum IosMetadataName {\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'EXUpdatesRequestHeaders',\n RELEASE_CHANNEL = 'EXUpdatesReleaseChannel',\n RUNTIME_VERSION = 'EXUpdatesRuntimeVersion',\n}\n\nexport async function iosSetRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);\n\n if (!(await fs.pathExists(expoPlistPath))) {\n throw new Error(`${expoPlistPath} does not exist`);\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const items = plist.parse(expoPlistContents);\n items[IosMetadataName.RUNTIME_VERSION] = runtimeVersion;\n const updatedExpoPlistContents = plist.build(items);\n\n await fs.writeFile(expoPlistPath, updatedExpoPlistContents);\n}\n\nexport async function iosSetChannelNativelyAsync(ctx: BuildContext<Job>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);\n\n if (!(await fs.pathExists(expoPlistPath))) {\n throw new Error(`${expoPlistPath} does not exist`);\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const items: Record<string, string | Record<string, string>> = plist.parse(expoPlistContents);\n items[IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] = {\n ...((items[IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] as Record<\n string,\n string\n >) ?? {}),\n 'expo-channel-name': ctx.job.updates.channel,\n };\n const updatedExpoPlistContents = plist.build(items);\n\n await fs.writeFile(expoPlistPath, updatedExpoPlistContents);\n}\n\nexport async function iosSetClassicReleaseChannelNativelyAsync(\n ctx: BuildContext<Job>\n): Promise<void> {\n assert(ctx.job.releaseChannel, 'releaseChannel must be defined');\n\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);\n\n if (!(await fs.pathExists(expoPlistPath))) {\n throw new Error(`${expoPlistPath} does not exist`);\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const items: Record<string, string | Record<string, string>> = plist.parse(expoPlistContents);\n items[IosMetadataName.RELEASE_CHANNEL] = ctx.job.releaseChannel;\n const updatedExpoPlistContents = plist.build(items);\n\n await fs.writeFile(expoPlistPath, updatedExpoPlistContents);\n}\n\nexport async function iosGetNativelyDefinedClassicReleaseChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);\n if (!(await fs.pathExists(expoPlistPath))) {\n return null;\n }\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const parsedPlist = plist.parse(expoPlistContents);\n if (!parsedPlist) {\n return null;\n }\n return parsedPlist[IosMetadataName.RELEASE_CHANNEL] ?? null;\n}\n\nexport async function iosGetNativelyDefinedRuntimeVersionAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);\n if (!(await fs.pathExists(expoPlistPath))) {\n return null;\n }\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const parsedPlist = plist.parse(expoPlistContents);\n if (!parsedPlist) {\n return null;\n }\n return parsedPlist[IosMetadataName.RUNTIME_VERSION] ?? null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/ios/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,yDAAiD;AACjD,wDAA0B;AAC1B,wDAAgC;AAKhC,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,wFAAqE,CAAA;IACrE,8DAA2C,CAAA;IAC3C,8DAA2C,CAAA;AAC7C,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AAEM,KAAK,UAAU,iCAAiC,CACrD,GAAsB,EACtB,cAAsB;IAEtB,MAAM,aAAa,GAAG,0BAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAExF,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EAAE;QACzC,MAAM,IAAI,KAAK,CAAC,GAAG,aAAa,iBAAiB,CAAC,CAAC;KACpD;IAED,MAAM,iBAAiB,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,aAAa,EAAE,MAA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CAAC,iBAAiB,CAAC,CAAC;IACnD,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,MAAA,WAAW,CAAC,eAAe,CAAC,eAAe,CAAC,mCAAI,IAAI,CAAC;AAC9D,CAAC;AAbD,4FAaC","sourcesContent":["import assert from 'assert';\n\nimport { IOSConfig } from '@expo/config-plugins';\nimport fs from 'fs-extra';\nimport plist from '@expo/plist';\nimport { Job } from '@expo/eas-build-job';\n\nimport { BuildContext } from '../context';\n\nexport enum IosMetadataName {\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'EXUpdatesRequestHeaders',\n RELEASE_CHANNEL = 'EXUpdatesReleaseChannel',\n RUNTIME_VERSION = 'EXUpdatesRuntimeVersion',\n}\n\nexport async function iosSetRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);\n\n if (!(await fs.pathExists(expoPlistPath))) {\n throw new Error(`${expoPlistPath} does not exist`);\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const items = plist.parse(expoPlistContents);\n items[IosMetadataName.RUNTIME_VERSION] = runtimeVersion;\n const updatedExpoPlistContents = plist.build(items);\n\n await fs.writeFile(expoPlistPath, updatedExpoPlistContents);\n}\n\nexport async function iosSetChannelNativelyAsync(ctx: BuildContext<Job>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);\n\n if (!(await fs.pathExists(expoPlistPath))) {\n throw new Error(`${expoPlistPath} does not exist`);\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const items: Record<string, string | Record<string, string>> = plist.parse(expoPlistContents);\n items[IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] = {\n ...((items[IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] as Record<\n string,\n string\n >) ?? {}),\n 'expo-channel-name': ctx.job.updates.channel,\n };\n const updatedExpoPlistContents = plist.build(items);\n\n await fs.writeFile(expoPlistPath, updatedExpoPlistContents);\n}\n\nexport async function iosGetNativelyDefinedChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);\n\n if (!(await fs.pathExists(expoPlistPath))) {\n return null;\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n try {\n const items: Record<string, string | Record<string, string>> = plist.parse(expoPlistContents);\n const updatesRequestHeaders = (items[\n IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY\n ] ?? {}) as Record<string, string>;\n return updatesRequestHeaders['expo-channel-name'] ?? null;\n } catch (err: any) {\n throw new Error(\n `Failed to parse ${IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY} from Expo.plist: ${err.message}`\n );\n }\n}\n\nexport async function iosSetClassicReleaseChannelNativelyAsync(\n ctx: BuildContext<Job>\n): Promise<void> {\n assert(ctx.job.releaseChannel, 'releaseChannel must be defined');\n\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);\n\n if (!(await fs.pathExists(expoPlistPath))) {\n throw new Error(`${expoPlistPath} does not exist`);\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const items: Record<string, string | Record<string, string>> = plist.parse(expoPlistContents);\n items[IosMetadataName.RELEASE_CHANNEL] = ctx.job.releaseChannel;\n const updatedExpoPlistContents = plist.build(items);\n\n await fs.writeFile(expoPlistPath, updatedExpoPlistContents);\n}\n\nexport async function iosGetNativelyDefinedClassicReleaseChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);\n if (!(await fs.pathExists(expoPlistPath))) {\n return null;\n }\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const parsedPlist = plist.parse(expoPlistContents);\n if (!parsedPlist) {\n return null;\n }\n return parsedPlist[IosMetadataName.RELEASE_CHANNEL] ?? null;\n}\n\nexport async function iosGetNativelyDefinedRuntimeVersionAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.reactNativeProjectDirectory);\n if (!(await fs.pathExists(expoPlistPath))) {\n return null;\n }\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const parsedPlist = plist.parse(expoPlistContents);\n if (!parsedPlist) {\n return null;\n }\n return parsedPlist[IosMetadataName.RUNTIME_VERSION] ?? null;\n}\n"]}
|
|
@@ -16,4 +16,6 @@ export declare function getNativelyDefinedClassicReleaseChannelAsync(ctx: BuildC
|
|
|
16
16
|
export declare function configureClassicExpoUpdatesAsync(ctx: BuildContext<Job>): Promise<void>;
|
|
17
17
|
export declare function configureEASExpoUpdatesAsync(ctx: BuildContext<Job>): Promise<void>;
|
|
18
18
|
export declare function configureExpoUpdatesIfInstalledAsync(ctx: BuildContext<Job>): Promise<void>;
|
|
19
|
+
export declare function getChannelAsync(ctx: BuildContext<Job>): Promise<string | null>;
|
|
19
20
|
export declare function getRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null>;
|
|
21
|
+
export declare function isEASUpdateConfigured(ctx: BuildContext<Job>): boolean;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getRuntimeVersionAsync = exports.configureExpoUpdatesIfInstalledAsync = exports.configureEASExpoUpdatesAsync = exports.configureClassicExpoUpdatesAsync = exports.getNativelyDefinedClassicReleaseChannelAsync = exports.setClassicReleaseChannelNativelyAsync = exports.setChannelNativelyAsync = exports.setRuntimeVersionNativelyAsync = void 0;
|
|
6
|
+
exports.isEASUpdateConfigured = exports.getRuntimeVersionAsync = exports.getChannelAsync = exports.configureExpoUpdatesIfInstalledAsync = exports.configureEASExpoUpdatesAsync = exports.configureClassicExpoUpdatesAsync = exports.getNativelyDefinedClassicReleaseChannelAsync = exports.setClassicReleaseChannelNativelyAsync = exports.setChannelNativelyAsync = exports.setRuntimeVersionNativelyAsync = void 0;
|
|
7
7
|
const assert_1 = __importDefault(require("assert"));
|
|
8
8
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
9
9
|
const Updates_1 = require("@expo/config-plugins/build/utils/Updates");
|
|
@@ -35,7 +35,7 @@ async function setChannelNativelyAsync(ctx) {
|
|
|
35
35
|
'expo-channel-name': ctx.job.updates.channel,
|
|
36
36
|
};
|
|
37
37
|
const configFile = ctx.job.platform === eas_build_job_1.Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';
|
|
38
|
-
ctx.logger.info(`Setting the update
|
|
38
|
+
ctx.logger.info(`Setting the update request headers in '${configFile}' to '${JSON.stringify(newUpdateRequestHeaders)}'`);
|
|
39
39
|
switch (ctx.job.platform) {
|
|
40
40
|
case eas_build_job_1.Platform.ANDROID: {
|
|
41
41
|
await (0, expoUpdates_1.androidSetChannelNativelyAsync)(ctx);
|
|
@@ -123,8 +123,26 @@ async function configureExpoUpdatesIfInstalledAsync(ctx) {
|
|
|
123
123
|
ctx.logger.warn(`Runtime version from the app config evaluated on your local machine (${ctx.metadata.runtimeVersion}) does not match the one resolved here (${appConfigRuntimeVersion}).`);
|
|
124
124
|
ctx.logger.warn("If you're using conditional app configs, e.g. depending on an environment variable, make sure to set the variable in eas.json or configure it with EAS Secret.");
|
|
125
125
|
}
|
|
126
|
-
if ((
|
|
127
|
-
|
|
126
|
+
if (isEASUpdateConfigured(ctx)) {
|
|
127
|
+
if (((_e = ctx.job.updates) === null || _e === void 0 ? void 0 : _e.channel) !== undefined) {
|
|
128
|
+
await configureEASExpoUpdatesAsync(ctx);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
const channel = await getChannelAsync(ctx);
|
|
132
|
+
if (channel !== null) {
|
|
133
|
+
const configFile = ctx.job.platform === eas_build_job_1.Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';
|
|
134
|
+
ctx.logger.info(`The channel name for EAS Update in ${configFile} is set to "${channel}"`);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
if (ctx.job.releaseChannel !== undefined) {
|
|
138
|
+
ctx.logger.warn(`This build is configured with EAS Update however has a Classic Updates releaseChannel set instead of having an EAS Update channel.`);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
ctx.logger.warn(`This build is configured to query EAS Update for updates, however no channel is set in eas.json.`);
|
|
142
|
+
}
|
|
143
|
+
ctx.markBuildPhaseHasWarnings();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
128
146
|
}
|
|
129
147
|
else {
|
|
130
148
|
await configureClassicExpoUpdatesAsync(ctx);
|
|
@@ -135,6 +153,19 @@ async function configureExpoUpdatesIfInstalledAsync(ctx) {
|
|
|
135
153
|
}
|
|
136
154
|
}
|
|
137
155
|
exports.configureExpoUpdatesIfInstalledAsync = configureExpoUpdatesIfInstalledAsync;
|
|
156
|
+
async function getChannelAsync(ctx) {
|
|
157
|
+
switch (ctx.job.platform) {
|
|
158
|
+
case eas_build_job_1.Platform.ANDROID: {
|
|
159
|
+
return await (0, expoUpdates_1.androidGetNativelyDefinedChannelAsync)(ctx);
|
|
160
|
+
}
|
|
161
|
+
case eas_build_job_1.Platform.IOS: {
|
|
162
|
+
return await (0, expoUpdates_2.iosGetNativelyDefinedChannelAsync)(ctx);
|
|
163
|
+
}
|
|
164
|
+
default:
|
|
165
|
+
throw new Error(`Platform is not supported.`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
exports.getChannelAsync = getChannelAsync;
|
|
138
169
|
async function getRuntimeVersionAsync(ctx) {
|
|
139
170
|
switch (ctx.job.platform) {
|
|
140
171
|
case eas_build_job_1.Platform.ANDROID: {
|
|
@@ -148,4 +179,21 @@ async function getRuntimeVersionAsync(ctx) {
|
|
|
148
179
|
}
|
|
149
180
|
}
|
|
150
181
|
exports.getRuntimeVersionAsync = getRuntimeVersionAsync;
|
|
182
|
+
function isEASUpdateConfigured(ctx) {
|
|
183
|
+
var _a;
|
|
184
|
+
const rawUrl = (_a = ctx.appConfig.updates) === null || _a === void 0 ? void 0 : _a.url;
|
|
185
|
+
if (!rawUrl) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
const url = new URL(rawUrl);
|
|
190
|
+
return ['u.expo.dev', 'staging-u.expo.dev'].includes(url.hostname);
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
ctx.logger.error({ err }, `Cannot parse expo.updates.url = ${rawUrl} as URL`);
|
|
194
|
+
ctx.logger.error(`Assuming EAS Update is not configured`);
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
exports.isEASUpdateConfigured = isEASUpdateConfigured;
|
|
151
199
|
//# sourceMappingURL=expoUpdates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/utils/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uDAAoD;AACpD,sEAAqF;AAErF,wDAMgC;AAChC,oDAM4B;AAG5B,sFAAmE;AAE5D,KAAK,UAAU,8BAA8B,CAClD,GAAsB,EACtB,cAAsB;IAEtB,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE;QACxB,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC;YACrB,MAAM,IAAA,mDAAqC,EAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YACjE,OAAO;SACR;QACD,KAAK,wBAAQ,CAAC,GAAG,CAAC,CAAC;YACjB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AG,CAAC,MAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;QACzD,MAAM,8BAA8B,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;KAC3E;AACH,CAAC;AA3BD,oFA2BC;AAEM,KAAK,UAAU,sBAAsB,CAAC,GAAsB;IACjE,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE;QACxB,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC;YACrB,OAAO,MAAM,IAAA,0DAA4C,EAAC,GAAG,CAAC,CAAC;SAChE;QACD,KAAK,wBAAQ,CAAC,GAAG,CAAC,CAAC;YACjB,OAAO,MAAM,IAAA,sDAAwC,EAAC,GAAG,CAAC,CAAC;SAC5D;QACD;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;KACjD;AACH,CAAC;AAXD,wDAWC","sourcesContent":["import assert from 'assert';\n\nimport { Platform, Job } from '@expo/eas-build-job';\nimport { getRuntimeVersionNullable } from '@expo/config-plugins/build/utils/Updates';\n\nimport {\n androidSetRuntimeVersionNativelyAsync,\n androidSetChannelNativelyAsync,\n androidSetClassicReleaseChannelNativelyAsync,\n androidGetNativelyDefinedClassicReleaseChannelAsync,\n androidGetNativelyDefinedRuntimeVersionAsync,\n} from '../android/expoUpdates';\nimport {\n iosSetRuntimeVersionNativelyAsync,\n iosSetChannelNativelyAsync,\n iosSetClassicReleaseChannelNativelyAsync,\n iosGetNativelyDefinedClassicReleaseChannelAsync,\n iosGetNativelyDefinedRuntimeVersionAsync,\n} from '../ios/expoUpdates';\nimport { BuildContext } from '../context';\n\nimport isExpoUpdatesInstalledAsync from './isExpoUpdatesInstalled';\n\nexport async function setRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetRuntimeVersionNativelyAsync(ctx, runtimeVersion);\n return;\n }\n case Platform.IOS: {\n await iosSetRuntimeVersionNativelyAsync(ctx, runtimeVersion);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\n/**\n * Used for when Expo Updates is pointed at an EAS server.\n */\nexport async function setChannelNativelyAsync(ctx: BuildContext<Job>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n const newUpdateRequestHeaders: Record<string, string> = {\n 'expo-channel-name': ctx.job.updates.channel,\n };\n\n const configFile = ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(\n `Setting the update response headers in '${configFile}' to '${JSON.stringify(\n newUpdateRequestHeaders\n )}'`\n );\n\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetChannelNativelyAsync(ctx);\n return;\n }\n case Platform.IOS: {\n await iosSetChannelNativelyAsync(ctx);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\n/**\n * Used for classic Expo Updates\n */\nexport async function setClassicReleaseChannelNativelyAsync(ctx: BuildContext<Job>): Promise<void> {\n assert(ctx.job.releaseChannel, 'releaseChannel must be defined');\n\n const configFile = ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(`Setting the release channel in '${configFile}' to '${ctx.job.releaseChannel}'`);\n\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetClassicReleaseChannelNativelyAsync(ctx);\n return;\n }\n case Platform.IOS: {\n await iosSetClassicReleaseChannelNativelyAsync(ctx);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\n/**\n * Used for classic Expo Updates\n */\nexport async function getNativelyDefinedClassicReleaseChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return androidGetNativelyDefinedClassicReleaseChannelAsync(ctx);\n }\n case Platform.IOS: {\n return iosGetNativelyDefinedClassicReleaseChannelAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport async function configureClassicExpoUpdatesAsync(ctx: BuildContext<Job>): Promise<void> {\n if (ctx.job.releaseChannel) {\n await setClassicReleaseChannelNativelyAsync(ctx);\n } else {\n /**\n * If releaseChannel is not defined:\n * 1. Try to infer it from the native value.\n * 2. If it is not set, fallback to 'default'.\n */\n const releaseChannel = await getNativelyDefinedClassicReleaseChannelAsync(ctx);\n if (releaseChannel) {\n ctx.logger.info(\n `Using the release channel pre-configured in native project (${releaseChannel})`\n );\n ctx.logger.warn('Please add the \"releaseChannel\" field to your build profile (eas.json)');\n } else {\n ctx.logger.info(`Using default release channel for 'expo-updates' (default)`);\n }\n }\n}\n\nexport async function configureEASExpoUpdatesAsync(ctx: BuildContext<Job>): Promise<void> {\n await setChannelNativelyAsync(ctx);\n}\n\nexport async function configureExpoUpdatesIfInstalledAsync(ctx: BuildContext<Job>): Promise<void> {\n if (!(await isExpoUpdatesInstalledAsync(ctx.reactNativeProjectDirectory))) {\n return;\n }\n\n const appConfigRuntimeVersion =\n ctx.job.version?.runtimeVersion ?? getRuntimeVersionNullable(ctx.appConfig, ctx.job.platform);\n if (ctx.metadata?.runtimeVersion && ctx.metadata?.runtimeVersion !== appConfigRuntimeVersion) {\n ctx.markBuildPhaseHasWarnings();\n ctx.logger.warn(\n `Runtime version from the app config evaluated on your local machine (${ctx.metadata.runtimeVersion}) does not match the one resolved here (${appConfigRuntimeVersion}).`\n );\n ctx.logger.warn(\n \"If you're using conditional app configs, e.g. depending on an environment variable, make sure to set the variable in eas.json or configure it with EAS Secret.\"\n );\n }\n\n if (ctx.job.updates?.channel) {\n await configureEASExpoUpdatesAsync(ctx);\n } else {\n await configureClassicExpoUpdatesAsync(ctx);\n }\n\n if (ctx.job.version?.runtimeVersion) {\n ctx.logger.info('Updating runtimeVersion in Expo.plist');\n await setRuntimeVersionNativelyAsync(ctx, ctx.job.version.runtimeVersion);\n }\n}\n\nexport async function getRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedRuntimeVersionAsync(ctx);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedRuntimeVersionAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/utils/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uDAAoD;AACpD,sEAAqF;AAErF,wDAOgC;AAChC,oDAO4B;AAG5B,sFAAmE;AAE5D,KAAK,UAAU,8BAA8B,CAClD,GAAsB,EACtB,cAAsB;IAEtB,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE;QACxB,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC;YACrB,MAAM,IAAA,mDAAqC,EAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YACjE,OAAO;SACR;QACD,KAAK,wBAAQ,CAAC,GAAG,CAAC,CAAC;YACjB,MAAM,IAAA,+CAAiC,EAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YAC7D,OAAO;SACR;QACD;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;KACjD;AACH,CAAC;AAhBD,wEAgBC;AAED;;GAEG;AACI,KAAK,UAAU,uBAAuB,CAAC,GAAsB;;IAClE,IAAA,gBAAM,EAAC,MAAA,GAAG,CAAC,GAAG,CAAC,OAAO,0CAAE,OAAO,EAAE,iCAAiC,CAAC,CAAC;IACpE,MAAM,uBAAuB,GAA2B;QACtD,mBAAmB,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO;KAC7C,CAAC;IAEF,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,YAAY,CAAC;IAChG,GAAG,CAAC,MAAM,CAAC,IA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GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5B,OAAO,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;KACpE;IAAC,OAAO,GAAG,EAAE;QACZ,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,mCAAmC,MAAM,SAAS,CAAC,CAAC;QAC9E,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC1D,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAbD,sDAaC","sourcesContent":["import assert from 'assert';\n\nimport { Platform, Job } from '@expo/eas-build-job';\nimport { getRuntimeVersionNullable } from '@expo/config-plugins/build/utils/Updates';\n\nimport {\n androidSetRuntimeVersionNativelyAsync,\n androidSetChannelNativelyAsync,\n androidSetClassicReleaseChannelNativelyAsync,\n androidGetNativelyDefinedClassicReleaseChannelAsync,\n androidGetNativelyDefinedRuntimeVersionAsync,\n androidGetNativelyDefinedChannelAsync,\n} from '../android/expoUpdates';\nimport {\n iosSetRuntimeVersionNativelyAsync,\n iosSetChannelNativelyAsync,\n iosSetClassicReleaseChannelNativelyAsync,\n iosGetNativelyDefinedClassicReleaseChannelAsync,\n iosGetNativelyDefinedRuntimeVersionAsync,\n iosGetNativelyDefinedChannelAsync,\n} from '../ios/expoUpdates';\nimport { BuildContext } from '../context';\n\nimport isExpoUpdatesInstalledAsync from './isExpoUpdatesInstalled';\n\nexport async function setRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetRuntimeVersionNativelyAsync(ctx, runtimeVersion);\n return;\n }\n case Platform.IOS: {\n await iosSetRuntimeVersionNativelyAsync(ctx, runtimeVersion);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\n/**\n * Used for when Expo Updates is pointed at an EAS server.\n */\nexport async function setChannelNativelyAsync(ctx: BuildContext<Job>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n const newUpdateRequestHeaders: Record<string, string> = {\n 'expo-channel-name': ctx.job.updates.channel,\n };\n\n const configFile = ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(\n `Setting the update request headers in '${configFile}' to '${JSON.stringify(\n newUpdateRequestHeaders\n )}'`\n );\n\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetChannelNativelyAsync(ctx);\n return;\n }\n case Platform.IOS: {\n await iosSetChannelNativelyAsync(ctx);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\n/**\n * Used for classic Expo Updates\n */\nexport async function setClassicReleaseChannelNativelyAsync(ctx: BuildContext<Job>): Promise<void> {\n assert(ctx.job.releaseChannel, 'releaseChannel must be defined');\n\n const configFile = ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(`Setting the release channel in '${configFile}' to '${ctx.job.releaseChannel}'`);\n\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetClassicReleaseChannelNativelyAsync(ctx);\n return;\n }\n case Platform.IOS: {\n await iosSetClassicReleaseChannelNativelyAsync(ctx);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\n/**\n * Used for classic Expo Updates\n */\nexport async function getNativelyDefinedClassicReleaseChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return androidGetNativelyDefinedClassicReleaseChannelAsync(ctx);\n }\n case Platform.IOS: {\n return iosGetNativelyDefinedClassicReleaseChannelAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport async function configureClassicExpoUpdatesAsync(ctx: BuildContext<Job>): Promise<void> {\n if (ctx.job.releaseChannel) {\n await setClassicReleaseChannelNativelyAsync(ctx);\n } else {\n /**\n * If releaseChannel is not defined:\n * 1. Try to infer it from the native value.\n * 2. If it is not set, fallback to 'default'.\n */\n const releaseChannel = await getNativelyDefinedClassicReleaseChannelAsync(ctx);\n if (releaseChannel) {\n ctx.logger.info(\n `Using the release channel pre-configured in native project (${releaseChannel})`\n );\n ctx.logger.warn('Please add the \"releaseChannel\" field to your build profile (eas.json)');\n } else {\n ctx.logger.info(`Using default release channel for 'expo-updates' (default)`);\n }\n }\n}\n\nexport async function configureEASExpoUpdatesAsync(ctx: BuildContext<Job>): Promise<void> {\n await setChannelNativelyAsync(ctx);\n}\n\nexport async function configureExpoUpdatesIfInstalledAsync(ctx: BuildContext<Job>): Promise<void> {\n if (!(await isExpoUpdatesInstalledAsync(ctx.reactNativeProjectDirectory))) {\n return;\n }\n\n const appConfigRuntimeVersion =\n ctx.job.version?.runtimeVersion ?? getRuntimeVersionNullable(ctx.appConfig, ctx.job.platform);\n if (ctx.metadata?.runtimeVersion && ctx.metadata?.runtimeVersion !== appConfigRuntimeVersion) {\n ctx.markBuildPhaseHasWarnings();\n ctx.logger.warn(\n `Runtime version from the app config evaluated on your local machine (${ctx.metadata.runtimeVersion}) does not match the one resolved here (${appConfigRuntimeVersion}).`\n );\n ctx.logger.warn(\n \"If you're using conditional app configs, e.g. depending on an environment variable, make sure to set the variable in eas.json or configure it with EAS Secret.\"\n );\n }\n\n if (isEASUpdateConfigured(ctx)) {\n if (ctx.job.updates?.channel !== undefined) {\n await configureEASExpoUpdatesAsync(ctx);\n } else {\n const channel = await getChannelAsync(ctx);\n if (channel !== null) {\n const configFile =\n ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(`The channel name for EAS Update in ${configFile} is set to \"${channel}\"`);\n } else {\n if (ctx.job.releaseChannel !== undefined) {\n ctx.logger.warn(\n `This build is configured with EAS Update however has a Classic Updates releaseChannel set instead of having an EAS Update channel.`\n );\n } else {\n ctx.logger.warn(\n `This build is configured to query EAS Update for updates, however no channel is set in eas.json.`\n );\n }\n ctx.markBuildPhaseHasWarnings();\n }\n }\n } else {\n await configureClassicExpoUpdatesAsync(ctx);\n }\n\n if (ctx.job.version?.runtimeVersion) {\n ctx.logger.info('Updating runtimeVersion in Expo.plist');\n await setRuntimeVersionNativelyAsync(ctx, ctx.job.version.runtimeVersion);\n }\n}\n\nexport async function getChannelAsync(ctx: BuildContext<Job>): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedChannelAsync(ctx);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedChannelAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport async function getRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedRuntimeVersionAsync(ctx);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedRuntimeVersionAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport function isEASUpdateConfigured(ctx: BuildContext<Job>): boolean {\n const rawUrl = ctx.appConfig.updates?.url;\n if (!rawUrl) {\n return false;\n }\n try {\n const url = new URL(rawUrl);\n return ['u.expo.dev', 'staging-u.expo.dev'].includes(url.hostname);\n } catch (err) {\n ctx.logger.error({ err }, `Cannot parse expo.updates.url = ${rawUrl} as URL`);\n ctx.logger.error(`Assuming EAS Update is not configured`);\n return false;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/build-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.169",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@expo/config": "7.0.1",
|
|
23
23
|
"@expo/config-plugins": "5.0.1",
|
|
24
24
|
"@expo/downloader": "0.0.21",
|
|
25
|
-
"@expo/eas-build-job": "0.2.
|
|
25
|
+
"@expo/eas-build-job": "0.2.101",
|
|
26
26
|
"@expo/logger": "0.0.25",
|
|
27
27
|
"@expo/package-manager": "0.0.54",
|
|
28
28
|
"@expo/plist": "^0.0.11",
|