@brettdh/standard-version-expo
Version:
Automatic Expo versioning with Standard Version
22 lines (21 loc) • 829 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const expo_1 = require("../expo");
const helpers_1 = require("../helpers");
const versions_1 = require("../versions");
/**
* Read the manifest version from the `expo.ios.buildNumber` property.
*/
exports.readVersion = helpers_1.iosVersionReader;
/**
* Write the manifest version to the `expo.ios.buildNumber` property.
* This uses the Android version code approach of Maxi Rosson.
*
* @see https://medium.com/@maxirosson/versioning-android-apps-d6ec171cfd82
*/
exports.writeVersion = (contents, version) => {
const manifest = expo_1.parse(contents);
manifest.expo.ios = manifest.expo.ios || {};
manifest.expo.ios.buildNumber = String(versions_1.getVersionCode(manifest, version));
return expo_1.serialize(manifest, contents);
};