Update files
This commit is contained in:
@@ -1,11 +1,26 @@
|
||||
// App name and package ID are controlled by Gradle product flavors (dev/production)
|
||||
// See plugins/with-android-product-flavors.js for flavor configuration
|
||||
|
||||
const pkg = require("./package.json");
|
||||
const appVariant = process.env.APP_VARIANT ?? "prod";
|
||||
|
||||
const variants = {
|
||||
prod: {
|
||||
name: "Paseo",
|
||||
packageId: "sh.paseo",
|
||||
},
|
||||
debug: {
|
||||
name: "Paseo Debug",
|
||||
packageId: "sh.paseo.debug",
|
||||
},
|
||||
fast: {
|
||||
name: "Paseo Dev",
|
||||
packageId: "sh.paseo.dev",
|
||||
},
|
||||
};
|
||||
|
||||
const variant = variants[appVariant] ?? variants.prod;
|
||||
|
||||
export default {
|
||||
expo: {
|
||||
name: "Paseo",
|
||||
name: variant.name,
|
||||
slug: "voice-mobile",
|
||||
version: pkg.version,
|
||||
orientation: "portrait",
|
||||
@@ -26,7 +41,7 @@ export default {
|
||||
"This app needs access to the microphone for voice commands.",
|
||||
ITSAppUsesNonExemptEncryption: false,
|
||||
},
|
||||
bundleIdentifier: "sh.paseo",
|
||||
bundleIdentifier: variant.packageId,
|
||||
},
|
||||
android: {
|
||||
adaptiveIcon: {
|
||||
@@ -45,8 +60,7 @@ export default {
|
||||
"CAMERA",
|
||||
"android.permission.CAMERA",
|
||||
],
|
||||
// Base package - Gradle product flavors override this per variant
|
||||
package: "sh.paseo",
|
||||
package: variant.packageId,
|
||||
},
|
||||
web: {
|
||||
output: "single",
|
||||
@@ -91,7 +105,6 @@ export default {
|
||||
},
|
||||
},
|
||||
],
|
||||
"./plugins/with-android-product-flavors",
|
||||
],
|
||||
experiments: {
|
||||
typedRoutes: true,
|
||||
|
||||
+23
-7
@@ -3,20 +3,36 @@
|
||||
"version": ">= 14.0.0"
|
||||
},
|
||||
"build": {
|
||||
"development": {
|
||||
"debug": {
|
||||
"developmentClient": true,
|
||||
"distribution": "internal",
|
||||
"channel": "development"
|
||||
"channel": "debug",
|
||||
"env": {
|
||||
"APP_VARIANT": "debug"
|
||||
},
|
||||
"android": {
|
||||
"gradleCommand": ":app:assembleDebug"
|
||||
}
|
||||
},
|
||||
"preview": {
|
||||
"fast": {
|
||||
"developmentClient": true,
|
||||
"distribution": "internal",
|
||||
"channel": "preview"
|
||||
"channel": "fast",
|
||||
"env": {
|
||||
"APP_VARIANT": "fast"
|
||||
},
|
||||
"android": {
|
||||
"gradleCommand": ":app:assembleDebugOptimized"
|
||||
}
|
||||
},
|
||||
"production": {
|
||||
"channel": "production"
|
||||
"prod": {
|
||||
"channel": "production",
|
||||
"env": {
|
||||
"APP_VARIANT": "prod"
|
||||
}
|
||||
}
|
||||
},
|
||||
"submit": {
|
||||
"production": {}
|
||||
"prod": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,11 @@
|
||||
"scripts": {
|
||||
"start": "expo start",
|
||||
"reset-project": "node ./scripts/reset-project.js",
|
||||
"android": "ANDROID_VARIANT=${ANDROID_VARIANT:-devDebug} expo run:android --variant=${ANDROID_VARIANT:-devDebug}",
|
||||
"android:release": "ANDROID_VARIANT=${ANDROID_VARIANT:-productionRelease} expo run:android --variant=${ANDROID_VARIANT:-productionRelease}",
|
||||
"android": "npm run android:fast",
|
||||
"android:fast": "APP_VARIANT=fast expo run:android --variant=debugOptimized",
|
||||
"android:debug": "APP_VARIANT=debug expo run:android --variant=debug",
|
||||
"android:prod": "APP_VARIANT=prod expo run:android --variant=release",
|
||||
"android:release": "npm run android:prod",
|
||||
"ios": "expo run:ios",
|
||||
"ios:release": "expo run:ios --configuration Release",
|
||||
"web": "expo start --web",
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
const { withAppBuildGradle } = require("expo/config-plugins");
|
||||
|
||||
/**
|
||||
* Expo config plugin to add Android product flavors (dev/production)
|
||||
* This allows building both dev and production variants without re-running prebuild
|
||||
*
|
||||
* Variants created:
|
||||
* - devDebug: Development build with dev tools
|
||||
* - devRelease: Development build optimized
|
||||
* - productionDebug: Production build with dev tools
|
||||
* - productionRelease: Production build optimized (for app store)
|
||||
*/
|
||||
function withAndroidProductFlavors(config) {
|
||||
return withAppBuildGradle(config, (config) => {
|
||||
let buildGradle = config.modResults.contents;
|
||||
|
||||
// Add debuggableVariants to the react block
|
||||
buildGradle = buildGradle.replace(
|
||||
'// debuggableVariants = ["liteDebug", "prodDebug"]',
|
||||
'debuggableVariants = ["devDebug", "productionDebug"]'
|
||||
);
|
||||
|
||||
// Add product flavors after signingConfigs block
|
||||
const signingConfigsEnd = buildGradle.indexOf(
|
||||
" }\n buildTypes {",
|
||||
buildGradle.indexOf("signingConfigs {")
|
||||
);
|
||||
|
||||
if (signingConfigsEnd === -1) {
|
||||
console.warn(
|
||||
"Could not find signingConfigs end in build.gradle, skipping product flavors"
|
||||
);
|
||||
return config;
|
||||
}
|
||||
|
||||
const productFlavorsBlock = ` }
|
||||
flavorDimensions "environment"
|
||||
productFlavors {
|
||||
dev {
|
||||
dimension "environment"
|
||||
applicationId "sh.paseo.dev"
|
||||
resValue "string", "app_name", "Paseo (Dev)"
|
||||
}
|
||||
production {
|
||||
dimension "environment"
|
||||
applicationId "sh.paseo"
|
||||
resValue "string", "app_name", "Paseo"
|
||||
}
|
||||
}
|
||||
buildTypes {`;
|
||||
|
||||
buildGradle = buildGradle.replace(
|
||||
" }\n buildTypes {",
|
||||
productFlavorsBlock
|
||||
);
|
||||
|
||||
// Remove applicationId from defaultConfig since flavors handle it
|
||||
buildGradle = buildGradle.replace(
|
||||
/applicationId ['"]com\.moboudra\.paseo['"]\n\s*/,
|
||||
""
|
||||
);
|
||||
|
||||
config.modResults.contents = buildGradle;
|
||||
return config;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = withAndroidProductFlavors;
|
||||
Reference in New Issue
Block a user