mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 06:47:55 +00:00
feat(mobile): Add semantic versioning with standard-version
- Add standard-version for automated version bumping - Create .versionrc with custom configuration for app.json - Add version-updater.cjs script for Expo version syncing - Add version bump scripts (release, release:patch, release:minor, release:major) - Initialize CHANGELOG.md with v1.0.0 release notes - Add iOS buildNumber and Android versionCode for app store releases - Update .gitignore to allow CHANGELOG.md This establishes proper engineering practices for version management.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Custom version updater for app.json
|
||||
* Used by standard-version to update Expo app.json version fields
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const APP_JSON_PATH = path.join(__dirname, '..', 'app.json');
|
||||
|
||||
module.exports.readVersion = function (contents) {
|
||||
const appJson = JSON.parse(contents);
|
||||
return appJson.expo.version;
|
||||
};
|
||||
|
||||
module.exports.writeVersion = function (contents, version) {
|
||||
const appJson = JSON.parse(contents);
|
||||
|
||||
// Update expo.version
|
||||
appJson.expo.version = version;
|
||||
|
||||
// Auto-increment build numbers for iOS and Android
|
||||
const versionParts = version.split('.');
|
||||
const buildNumber = parseInt(versionParts[0]) * 10000 +
|
||||
parseInt(versionParts[1]) * 100 +
|
||||
parseInt(versionParts[2]);
|
||||
|
||||
// Update iOS buildNumber
|
||||
if (appJson.expo.ios) {
|
||||
appJson.expo.ios.buildNumber = String(buildNumber);
|
||||
}
|
||||
|
||||
// Update Android versionCode
|
||||
if (appJson.expo.android) {
|
||||
appJson.expo.android.versionCode = buildNumber;
|
||||
}
|
||||
|
||||
return JSON.stringify(appJson, null, 2) + '\n';
|
||||
};
|
||||
Reference in New Issue
Block a user