upd : build version

Deskripsi;
- build version otomatis

No Issues
This commit is contained in:
2025-09-03 16:49:40 +08:00
parent 1122e51047
commit 270001aa4f
4 changed files with 53 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ export default {
expo: { expo: {
name: "mobile-darmasaba", name: "mobile-darmasaba",
slug: "mobile-darmasaba", slug: "mobile-darmasaba",
version: "1.0.1", version: "1.0.2",
jsEngine: "jsc", jsEngine: "jsc",
orientation: "portrait", orientation: "portrait",
icon: "./assets/images/icon.png", icon: "./assets/images/icon.png",
@@ -21,12 +21,19 @@ export default {
}, },
android: { android: {
package: "mobiledarmasaba.app", package: "mobiledarmasaba.app",
versionCode: 2, versionCode: 6,
adaptiveIcon: { adaptiveIcon: {
foregroundImage: "./assets/images/splash-icon.png", foregroundImage: "./assets/images/splash-icon.png",
backgroundColor: "#ffffff" backgroundColor: "#ffffff"
}, },
googleServicesFile: "./google-services.json" googleServicesFile: "./google-services.json",
permissions: [
"READ_EXTERNAL_STORAGE",
"WRITE_EXTERNAL_STORAGE",
"READ_MEDIA_IMAGES", // Android 13+
"READ_MEDIA_VIDEO", // Android 13+
"READ_MEDIA_AUDIO" // Android 13+
]
}, },
web: { web: {
bundler: "metro", bundler: "metro",

38
bump-version.js Normal file
View File

@@ -0,0 +1,38 @@
const fs = require("fs");
const path = require("path");
const configPath = path.join(__dirname, "app.config.js");
let configFile = fs.readFileSync(configPath, "utf8");
// --- Update versionCode ---
const codeRegex = /versionCode:\s*(\d+)/;
const codeMatch = configFile.match(codeRegex);
if (!codeMatch) {
console.error("❌ Tidak menemukan versionCode di app.config.js");
process.exit(1);
}
const currentCode = parseInt(codeMatch[1], 10);
const newCode = currentCode + 1;
configFile = configFile.replace(codeRegex, `versionCode: ${newCode}`);
// --- Update versionName ---
const nameRegex = /version:\s*"(.*?)"/;
const nameMatch = configFile.match(nameRegex);
if (!nameMatch) {
console.error("❌ Tidak menemukan version di app.config.js");
process.exit(1);
}
let [major, minor, patch] = nameMatch[1].split(".").map(Number);
patch += 1; // bump patch version
const newName = `${major}.${minor}.${patch}`;
configFile = configFile.replace(nameRegex, `version: "${newName}"`);
// --- Simpan file ---
fs.writeFileSync(configPath, configFile, "utf8");
console.log(`✅ versionCode: ${currentCode}${newCode}`);
console.log(`✅ versionName: ${nameMatch[1]}${newName}`);

View File

@@ -1,7 +1,7 @@
{ {
"cli": { "cli": {
"version": ">= 16.10.0", "version": ">= 16.10.0",
"appVersionSource": "remote" "appVersionSource": "local"
}, },
"build": { "build": {
"development": { "development": {

View File

@@ -9,7 +9,9 @@
"ios": "expo run:ios", "ios": "expo run:ios",
"web": "expo start --web", "web": "expo start --web",
"test": "jest --watchAll", "test": "jest --watchAll",
"lint": "expo lint" "lint": "expo lint",
"bump": "node bump-version.js",
"build:android": "npm run bump && eas build -p android --profile production"
}, },
"jest": { "jest": {
"preset": "jest-expo" "preset": "jest-expo"