Created
May 4, 2015 14:25
-
-
Save roblabla/dff5ef5eeca07d6059d5 to your computer and use it in GitHub Desktop.
Gulp modifying package version in prepublish script - Doesn't work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var jsonTransform = require("gulp-json-transform"); | |
gulp.task('removeGH', function() { | |
gulp | |
.src('package.json') | |
.pipe(jsonTransform(function(data) { | |
if (data.version.indexOf("-GH") === data.version.length - 3) | |
data.version = data.version.substring(0, data.version.length - 3); | |
return data; | |
}, 4)) | |
.pipe(gulp.dest('.')); | |
}); | |
gulp.task('prepublish', ['removeGH']); | |
gulp.task('default', []); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "some_test_npm_package", | |
"version": "1.0.0-GH", | |
"description": "Just trying to find out some stuff about npm", | |
"main": "index.js", | |
"scripts": { | |
"prepublish": "gulp prepublish", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "roblabla", | |
"license": "MIT", | |
"devDependencies": { | |
"gulp": "^3.8.11", | |
"gulp-json-transform": "^0.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment