diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2019-10-06 21:37:45 +0200 |
---|---|---|
committer | Dimitri Staessens <dimitri@ouroboros.rocks> | 2019-10-06 21:37:45 +0200 |
commit | 3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 (patch) | |
tree | c7ccc8279b12c4f7bdbbb4270d617e48f51722e4 /node_modules/lodash/tag.js | |
parent | 412c104bebc507bea9c94fd53b5bdc4b64cbfe31 (diff) | |
download | website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.tar.gz website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.zip |
build: Add some required modules for node
Diffstat (limited to 'node_modules/lodash/tag.js')
-rw-r--r-- | node_modules/lodash/tag.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/node_modules/lodash/tag.js b/node_modules/lodash/tag.js new file mode 100644 index 0000000..acb2eea --- /dev/null +++ b/node_modules/lodash/tag.js @@ -0,0 +1,43 @@ +'use strict'; + +var _ = require('lodash'), + childProcess = require('child_process'), + execSync = childProcess.execSync, + semver = require('semver'), + spawn = childProcess.spawn; + +var branch = 'npm-packages'; + +var reLine = /^.*$/gm; + +var output = execSync('git log ' + branch + ' --pretty=format:"%s | %h"').toString(); + +var pairs = _.map(output.match(reLine), function(value) { + var pair = _.map(_.trim(value, '"\'').split('|'), _.trim); + pair[0] = _.result(/\d+(?:\.\d+)*/.exec(pair[0]), 0, ''); + return pair; +}); + +pairs = _.filter(pairs, '0'); + +pairs.sort(function(a, b) { + return semver.gt(a[0], b[0]) ? 1 : (semver.lt(a[0], b[0]) ? -1 : 0); +}); + +pairs = pairs.map(function(pair) { + var tag = pair[0] + (branch == 'master' ? '' : '-' + branch); + return [ + //'git checkout ' + tag + ' && git commit --amend --no-edit --date "`date`"', + 'git tag -f -a -m ' + tag + ' "' + tag + '" ' + pair[1], + 'git push -f origin ' + tag + ]; +}); + +_.each(pairs, function(pair, index) { + _.each(pair, function(command) { + _.delay(function() { + console.log(command) + execSync(command); + }, 1000 * index); + }); +}); |