mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(gulp) release: add --major, --minor, --patch
This commit is contained in:
parent
813da6a0f7
commit
de30cfd10a
2 changed files with 15 additions and 4 deletions
18
gulp/cl.js
18
gulp/cl.js
|
|
@ -1,16 +1,26 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
var DIR = '../',
|
||||
minor = require('minor'),
|
||||
Info = require(DIR + 'package');
|
||||
|
||||
exports.getVersion = function() {
|
||||
var versionNew,
|
||||
argv = process.argv,
|
||||
length = argv.length - 1,
|
||||
last = process.argv[length],
|
||||
regExp = new RegExp('^--'),
|
||||
isMatch = last.match(regExp);
|
||||
regExp = /^--(major|minor|patch)?/,
|
||||
match = last.match(regExp);
|
||||
|
||||
if (isMatch)
|
||||
versionNew = last.substr(3);
|
||||
if (regExp.test(last)) {
|
||||
if (match[1])
|
||||
versionNew = minor(match[1], Info.version);
|
||||
else
|
||||
versionNew = last.substr(3);
|
||||
|
||||
console.log(versionNew);
|
||||
}
|
||||
|
||||
return versionNew;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
"gulp-jshint": "~1.8.4",
|
||||
"gulp-mocha": "~1.1.0",
|
||||
"gulp-recess": "~1.0.0",
|
||||
"minor": "~1.2.2",
|
||||
"morgan": "~1.5.0",
|
||||
"should": "~4.2.1",
|
||||
"version-io": "~1.0.3"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue