node.js - Automate Git commit + versioning + tag by npm node -


what have been trying is, work npm version update package.json , create tag , commit changes. in way, able have tags version, auto versioning , commit info.

the problem having is, when using npm version, it's doing tag + commit automatically , can not done if have changes, me, doesn't make sense increase version of project, before changes/implementation/fixes.

then, problem having first increase version 'patch', changes, add all, commit , publish, @ end, have 2 commits, 1 because of npm version patch, , other 1 one.

i saw in documentation here there parameter allow disable auto tag + commit, use command in console able update package console , version set tag.

by hand, not sure if saying make sense because far know, when create tag, can go in project point, how pretend work if disabling auto commit?

finally, want make clear goal, want reach handle node scripts semi-automated script able increase version of project, create tag new version, add changes, commit , push.

note: don't want use gulp-git think there way handle without it.

not sure if clear enough, if not, please ask , me :)

ok guys, got it! looking run simple command , automate boring tasks have in same order git.

so, here is, first run command:

$> npm run commit -- 'v.1.0.1: fixes' 

what happens firstly clean of folders/files , dont need/want, run:

$> npm version patch -no-git-tag-version --force 

that command increase package.json version, not commit & not tag, add changes normal, commit changes , after this, create tag tag:commit gulp task.

in gulp task (attached bellow), getting version of package require , treat object.

"scripts": {    "start": "gulp start",    "initialize": "npm install & typings install",    "clean": "gulp clean:folders",    "commit:example": "echo 'npm run commit -- 'v.1.0.1: fixes'",    "commit:patch": "npm version patch --no-git-tag-version --force",    "commit:minor": "npm version minor --no-git-tag-version --force",    "commit:major": "npm version major --no-git-tag-version --force",    "precommit": "npm run clean && npm run commit:patch && git add --all",    "postcommit": "gulp tag:commit && git push origin master && git status && gulp commit:done",    "commit": "git commit -m " }, 

and then, have in gulp file:

///// ***** git ***** /////   gulp.task('tag:commit', function () {     var version = pjson.version;     console.log(colors.bgwhite.black.bold(' \ntagging version ' + version + ' \n'));     return run('git tag ' + version).exec(); }); 

i didn't want use gulp-git knew there way that, if need merge, create brunch or whatever, run console , fix it, daily commits, it's painful remember tag, update package version, put in git commit....

i hope that's useful else!

cheers,


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -