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

Comparing version 0.1.5 to 0.1.6

examples/build/key.json

12

examples/gulpfile.js

@@ -10,8 +10,12 @@ var gulp = require('gulp');

.pipe(bump(options))
.pipe(gulp.dest('./'));
.pipe(gulp.dest('./build'));
});
gulp.task('key', function(){
gulp.src('./key.json')
.pipe(bump({key: "appversion"}))
.pipe(gulp.dest('./build'));
});
gulp.task('default', function(){
gulp.run('bump');
});
gulp.task('default', ['bump']);

@@ -8,5 +8,6 @@ var map = require('map-stream');

if(!opts.indent) opts.indent = 2;
// Map each file to this function
if(!opts.key) opts.key = 'version';
function modifyContents(file, cb) {
// Remember that contents is ALWAYS a buffer
if(file.isNull()) return cb(null, file);

@@ -16,3 +17,3 @@ if(file.isStream()) return cb(new Error('gulp-bump: streams not supported'));

var json = JSON.parse(file.contents.toString());
json.version = semver.valid(opts.version) || semver.inc(json.version, opts.type || 'patch');
json[opts.key] = semver.valid(opts[opts.key]) || semver.inc(json[opts.key], opts.type || 'patch');
file.contents = new Buffer(JSON.stringify(json, null, opts.indent) + '\n');

@@ -23,4 +24,4 @@

// Return a stream
return map(modifyContents);
};
{
"name": "gulp-bump",
"description": "Bump npm versions with Gulp (gulpjs.com)",
"version": "0.1.5",
"version": "0.1.6",
"homepage": "http://github.com/stevelacy/gulp-bump",

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

@@ -40,3 +40,3 @@ #gulp-bump

```javascript
```js
var gulp = require('gulp');

@@ -95,5 +95,12 @@ var bump = require('gulp-bump');

// Define the key for versioning off
gulp.task('bump', function(){
gulp.src('./package.json')
.pipe(bump({key: "appversion"}))
.pipe(gulp.dest('./'));
});
// Run the gulp tasks

@@ -115,2 +122,19 @@ gulp.task('default', function(){

### options.key
Set the versioning key
Type: `String`
Default: `version`
Example:
```js
.pipe(bump({key: 'appversion'}))
.pipe(bump({key: 'build-version'}))
.pipe(bump({key: 'dev-version", type: 'major'}))
```
### options.version

@@ -123,3 +147,3 @@ Set a specific version.

Example:
```javascript
```js

@@ -126,0 +150,0 @@ .pipe(bump({version: '1.2.3'}))

@@ -13,4 +13,4 @@ var fs = require('fs');

cwd: "test/",
path: "test/package.json",
contents: fs.readFileSync('test/package.json')
path: "test/fixtures/package.json",
contents: fs.readFileSync('test/fixtures/package.json')
});

@@ -32,4 +32,4 @@ var bumpS = bump();

cwd: "test/",
path: "test/package.json",
contents: fs.readFileSync('test/package.json')
path: "test/fixtures/package.json",
contents: fs.readFileSync('test/fixtures/package.json')
});

@@ -51,4 +51,4 @@ var bumpS = bump({type: 'major'});

cwd: "test/",
path: "test/package.json",
contents: fs.readFileSync('test/package.json')
path: "test/fixtures/package.json",
contents: fs.readFileSync('test/fixtures/package.json')
});

@@ -70,4 +70,4 @@ var bumpS = bump({type: 'minor'});

cwd: "test/",
path: "test/package.json",
contents: fs.readFileSync('test/package.json')
path: "test/fixtures/package.json",
contents: fs.readFileSync('test/fixtures/package.json')
});

@@ -89,4 +89,4 @@ var bumpS = bump({type: 'invalid'});

cwd: "test/",
path: "test/package.json",
contents: fs.readFileSync('test/package.json')
path: "test/fixtures/package.json",
contents: fs.readFileSync('test/fixtures/package.json')
});

@@ -103,2 +103,20 @@ var bumpS = bump({version: '1.0.0'});

});
it('should set the key to a custom version', function (done) {
var fakeFile = new gutil.File({
base: "test/",
cwd: "test/",
path: "test/fixtures/key.json",
contents: fs.readFileSync('test/fixtures/key.json')
});
var bumpS = bump({key: "appversion"});
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/key.json', 'utf8'));
done();
});
bumpS.write(fakeFile);
});
});
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc