From 39fe1a2daac13902e213c8d93454bca20c7b5472 Mon Sep 17 00:00:00 2001 From: Martin Stovicek Date: Wed, 6 Jun 2018 01:22:02 +0200 Subject: [PATCH 1/2] Fix #53 Mirror npm-version's functionality for Git tag creation --- index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/index.js b/index.js index c9ff1a2..fbda6c3 100644 --- a/index.js +++ b/index.js @@ -76,6 +76,19 @@ function isExpoProject(projPath) { return !!isExpoApp; } +/** + * Determines whether the project has a .git/ directory + * @param {string} projectPath Path to your project + * @return {Boolean} true if the project has a .git/ directory + */ +function isGitProject(projectPath) { + try { + return !!fs.statSync(path.join(projectPath, ".git")); + } catch (err) {} + + return false; +} + /** * Versions your app * @param {Object} program commander/CLI-style options, camelCased @@ -505,6 +518,7 @@ function version(program, projectPath) { .toString() .trim() ) && + isGitProject(projPath) && child .execSync("git describe --exact-match HEAD", gitCmdOpts) .toString() From cf3ebadb81aa9dbbc3e3e4d43d9f550641b11518 Mon Sep 17 00:00:00 2001 From: Martin Stovicek Date: Wed, 6 Jun 2018 08:07:37 +0200 Subject: [PATCH 2/2] 2.6.3-0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index effd386..3730581 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "bugs": { "url": "https://github.com/stovmascript/react-native-version/issues" }, - "version": "2.6.2", + "version": "2.6.3-0", "main": "index.js", "bin": { "react-native-version": "cli.js"