Socket
Socket
Sign inDemoInstall

gulp-bump

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-bump - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

test/expected/version.json

10

index.js

@@ -13,10 +13,6 @@ var map = require('map-stream');

var regex = /([\'|\"]?version[\'|\"]?[ ]*:[ ]*[\'|\"]?)([\d||A-a|.|-]*)([\'|\"]?)/i;
var data = file.contents.toString();
var json = JSON.parse(file.contents.toString());
json.version = semver.valid(opts.version) || semver.inc(json.version, opts.type || 'patch');
file.contents = new Buffer(JSON.stringify(json, null, 2) + '\n');
data = data.replace(regex, function(match, prefix, version, suffix){
var newVersion = semver.inc(version, opts.type || 'patch');
return prefix + newVersion + suffix;
});
file.contents = new Buffer(data);
cb(null, file);

@@ -23,0 +19,0 @@ }

{
"name": "gulp-bump",
"description": "Bump npm versions with Gulp (gulpjs.com)",
"version": "0.1.3",
"version": "0.1.4",
"homepage": "http://github.com/stevelacy/gulp-bump",

@@ -6,0 +6,0 @@ "repository": "git://github.com/stevelacy/gulp-bump.git",

@@ -69,2 +69,12 @@ #gulp-bump

// Defined method of updating:
// Set a specific version
gulp.task('bump', function(){
gulp.src('./*.json')
.pipe(bump({version: '1.2.3'}))
.pipe(gulp.dest('./'));
});
// Update bower, component, npm at once:

@@ -95,4 +105,18 @@ gulp.task('bump', function(){

Default: `patch`
### options.version
Set a specific version.
Type: `String`
Default: `none`
Example:
```javascript
.pipe(bump({version: '1.2.3'}))
.pipe(bump({version: '1.0.0-alpha'}))
```
###Versioning Used: [Semantic](http://semver.org/)

@@ -99,0 +123,0 @@ ### String, lowercase

@@ -10,3 +10,3 @@ {

"dependencies": {
"semver":"*"
"semver": "*"
},

@@ -16,3 +16,3 @@ "devDependencies": {

"should": "*",
"gulp-util":"*"
"gulp-util": "*"
},

@@ -19,0 +19,0 @@ "scripts": {

@@ -10,3 +10,3 @@ {

"dependencies": {
"semver":"*"
"semver": "*"
},

@@ -16,3 +16,3 @@ "devDependencies": {

"should": "*",
"gulp-util":"*"
"gulp-util": "*"
},

@@ -19,0 +19,0 @@ "scripts": {

@@ -10,3 +10,3 @@ {

"dependencies": {
"semver":"*"
"semver": "*"
},

@@ -16,3 +16,3 @@ "devDependencies": {

"should": "*",
"gulp-util":"*"
"gulp-util": "*"
},

@@ -19,0 +19,0 @@ "scripts": {

@@ -8,3 +8,2 @@ var fs = require('fs');

describe('gulp-bump', function() {

@@ -46,2 +45,3 @@ it('should bump minor by default', function(done) {

});
it('should bump minor if options.bump = minor', function(done) {

@@ -65,3 +65,2 @@ var fakeFile = new gutil.File({

it('should ignore and pass "patch" if options.bump is not Semantic', function(done) {

@@ -85,3 +84,19 @@ var fakeFile = new gutil.File({

it('should set version to value specified by options.version', function (done) {
var fakeFile = new gutil.File({
base: "test/",
cwd: "test/",
path: "test/package.json",
contents: fs.readFileSync('test/package.json')
});
var bumpS = bump({version: '1.0.0'});
bumpS.once('data', function(newFile){
should.exist(newFile);
should.exist(newFile.path);
should.exist(newFile.contents);
String(newFile.contents).should.equal(fs.readFileSync('test/expected/version.json', 'utf8'));
done();
});
bumpS.write(fakeFile);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc