From afb6174890cbe607e4049712d58dcda524fb6562 Mon Sep 17 00:00:00 2001 From: mtumiati Date: Wed, 20 Nov 2019 12:45:39 +0100 Subject: [PATCH] Added detection for properties managed by enviromental variables --- index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index e2dbb66..69dc479 100644 --- a/index.js +++ b/index.js @@ -111,6 +111,15 @@ function isExpoProject(projPath) { } } +/** + * Determine if the given property is managed by an enviromental variable + * @param {String} text + * @return {Boolean} true if the given property is managed by an enviromental variable + */ +function isManagedByEnvVariable(propertyText) { + return propertyText ? !!/\$\(\S+\)/g.exec(propertyText) : false; +} + /** * Versions your app * @param {Object} program commander/CLI-style options, camelCased @@ -431,7 +440,8 @@ function version(program, projectPath) { CFBundleShortVersionString: appPkg.version } : {}, - !programOpts.neverIncrementBuild + !programOpts.neverIncrementBuild && + !isManagedByEnvVariable(json.CFBundleVersion) ? { CFBundleVersion: getNewVersionCode( programOpts,