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:
2026-06-23 01:12:19 -04:00
parent 355b14faef
commit e17c4c6854
2 changed files with 35 additions and 0 deletions
+1
View File
@@ -64,6 +64,7 @@
"bundleIdentifier": "com.beenvoice.app.ExpoWidgetsTarget"
}
],
"./plugins/withSyncWidgetVersions.js",
[
"expo-local-authentication",
{
+34
View File
@@ -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;