Sync ExpoWidgetsTarget version and build number with the main app on prebuild.
Fixes App Store Connect warnings when the widget extension CFBundle version does not match the containing application. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -64,6 +64,7 @@
|
|||||||
"bundleIdentifier": "com.beenvoice.app.ExpoWidgetsTarget"
|
"bundleIdentifier": "com.beenvoice.app.ExpoWidgetsTarget"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"./plugins/withSyncWidgetVersions.js",
|
||||||
[
|
[
|
||||||
"expo-local-authentication",
|
"expo-local-authentication",
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
// @ts-check
|
||||||
|
const { withXcodeProject } = require("@expo/config-plugins");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* expo-widgets seeds ExpoWidgetsTarget with hardcoded MARKETING_VERSION/CURRENT_PROJECT_VERSION
|
||||||
|
* and does not update them on later prebuilds. App Store Connect warns when the extension
|
||||||
|
* does not match the containing app.
|
||||||
|
*/
|
||||||
|
/** @type {import('@expo/config-plugins').ConfigPlugin} */
|
||||||
|
function withSyncWidgetVersions(config) {
|
||||||
|
return withXcodeProject(config, (config) => {
|
||||||
|
const marketingVersion = config.version ?? "1.0.0";
|
||||||
|
const buildNumber = config.ios?.buildNumber ?? "1";
|
||||||
|
const project = config.modResults;
|
||||||
|
const configurations = project.pbxXCBuildConfigurationSection();
|
||||||
|
|
||||||
|
for (const key of Object.keys(configurations)) {
|
||||||
|
const buildConfig = configurations[key];
|
||||||
|
if (!buildConfig?.buildSettings) continue;
|
||||||
|
|
||||||
|
const bundleId = buildConfig.buildSettings.PRODUCT_BUNDLE_IDENTIFIER;
|
||||||
|
if (!bundleId || !String(bundleId).includes("ExpoWidgetsTarget")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
buildConfig.buildSettings.MARKETING_VERSION = marketingVersion;
|
||||||
|
buildConfig.buildSettings.CURRENT_PROJECT_VERSION = buildNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = withSyncWidgetVersions;
|
||||||
Reference in New Issue
Block a user