react-native-version-setter
Advanced tools
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { | ||
| value: true | ||
| }); | ||
| exports.readConfig = void 0; | ||
| var _process = require("./process"); | ||
| var fs = require('fs'); | ||
| var readConfig = function readConfig(commandLineFlags) { | ||
| var config; | ||
| try { | ||
| config = String(fs.readFileSync('.rnvs.json')); | ||
| } catch (e) { | ||
| return {}; | ||
| } | ||
| try { | ||
| config = JSON.parse(config); | ||
| commandLineFlags.debugLog.set && (0, _process.out)("Using config file."); | ||
| return config; | ||
| } catch (e) { | ||
| (0, _process.die)('Error reading .rnvs.json file.'); | ||
| } | ||
| }; | ||
| exports.readConfig = readConfig; |
@@ -15,2 +15,3 @@ "use strict"; | ||
| * @param platform | ||
| * @param config | ||
| * @returns Array | ||
@@ -20,2 +21,4 @@ */ | ||
| var platform = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
| var config = arguments.length > 3 ? arguments[3] : undefined; | ||
| var iosProjectName = config.iosProjectName || packageJson.name; | ||
| var allLocations = [{ | ||
@@ -27,3 +30,3 @@ files: './android/app/build.gradle', | ||
| }, { | ||
| files: "./ios/".concat(packageJson.name, ".xcodeproj/project.pbxproj"), | ||
| files: "./ios/".concat(iosProjectName, ".xcodeproj/project.pbxproj"), | ||
| from: new RegExp('MARKETING_VERSION = [0-9, .]+', 'g'), | ||
@@ -30,0 +33,0 @@ to: "MARKETING_VERSION = ".concat(version.core), |
@@ -18,7 +18,11 @@ #!/usr/bin/env node | ||
| var _readConfig = require("./readConfig"); | ||
| // Read package.json | ||
| var packageJson = (0, _readPackageJson.readPackageJson)() || (0, _process.die)('Could not read package.json.'); // Create and check for all CLI flags | ||
| var commandLineFlags = (0, _createCliFlags.createCliFlags)(); // Create the version object | ||
| var commandLineFlags = (0, _createCliFlags.createCliFlags)(); // Read config file | ||
| var config = (0, _readConfig.readConfig)(commandLineFlags); // Create the version object | ||
| var version = (0, _createVersion.createVersion)(process.argv[2]); // Use CLI args to determine the correct platform constant | ||
@@ -28,3 +32,3 @@ | ||
| var locations = (0, _createLocations.createLocations)(version, packageJson, platform); // If dryRun is set, just print versions | ||
| var locations = (0, _createLocations.createLocations)(version, packageJson, platform, config); // If dryRun is set, just print versions | ||
@@ -31,0 +35,0 @@ commandLineFlags.dryRun.set && (0, _process.logDie)(version, 'No changes applied.'); // Make the file mutations |
+1
-1
| { | ||
| "name": "react-native-version-setter", | ||
| "version": "2.1.0", | ||
| "version": "2.2.0", | ||
| "description": "Update your app version with a single command.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://www.github.com/tj-mc/react-native-version-setter", |
+18
-2
@@ -46,3 +46,3 @@ # react-native-version-setter | ||
| From version 2, RNVS has full support for extended semVer syntax, like `1.2.3-alpha`. These symbols are not supported on iOS, | ||
| so they are stripped out automatically. They will be inserted normal into android files and `package.json`. | ||
| so they are stripped out automatically. They will be inserted as normal into android files and `package.json`. | ||
@@ -54,2 +54,18 @@ ## β³ Flags | ||
| `-android`: Set version for android only | ||
| `-ios`: Set version for iOS only | ||
| ## βοΈ Config | ||
| In most cases you won't need any config at all, but creating a `.rnvs.json` file in your project root will expose some extra options. Below are all accepted properties with example values. | ||
| ``` | ||
| { | ||
| // RNVS uses the project name | ||
| // in package.json by default, | ||
| // But your ios project name might differ. | ||
| "iosProjectName": "MyApp" | ||
| } | ||
| ``` | ||
| ## π» Compatibility | ||
@@ -60,3 +76,3 @@ - Compatible with iOS projects using Xcode 11+ | ||
| - getVersion command | ||
| - setVersion per-platform | ||
| - setVersion per-platform β v2.1.0 | ||
@@ -63,0 +79,0 @@ ## π Troubleshooting |
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
139305
0.96%25
4.17%523
5.44%83
23.88%0
-100%6
20%