UNPKG

npm-git-version

Version:

NPM utility that gets next version of application according git branch and tags

19 lines (18 loc) 861 B
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var crossEnv = require("cross-env"); var index_1 = require("../index"); var args = index_1.processArguments(); var extractor = new index_1.VersionsExtractor(args); extractor.process() .then(function (extractor) { console.log("\nBranch name is '" + extractor.branchName + "'\nBranch prefix is '" + extractor.branchPrefix + "'\nBranch version is '" + extractor.branchVersion + "'\nLast matching version is '" + extractor.lastMatchingVersion + "'\nComputed version is '" + extractor.version + "'"); if (extractor.executeCommand) { crossEnv(["GIT_VERSION=" + extractor.version, extractor.executeCommand], { shell: true }); } }) .catch(function (reason) { console.error("Processing failed: '" + reason + "'!"); process.exit(-1); });