build-url
Advanced tools
Comparing version 0.0.9 to 0.0.12
/** | ||
* A function that builds a URL based on the arguments it's given | ||
* @param {String} url The first part of the URL e.g. `http://example.com` | ||
* @param {Object} options A hash of options e.g. `{ path: '/about', hash: '#contact', queryParams: {}}` | ||
* @return {String} The complete URL e.g. `http://example.com/about?foo=bar#contact` | ||
* build-url - A small library that builds a URL given it's components | ||
* @version v0.0.11 | ||
* @link https://github.com/steverydz/build-url#readme | ||
* @license MIT | ||
*/ | ||
@@ -7,0 +7,0 @@ ;(function () { |
@@ -0,1 +1,7 @@ | ||
/** | ||
* build-url - A small library that builds a URL given it's components | ||
* @version v0.0.11 | ||
* @link https://github.com/steverydz/build-url#readme | ||
* @license MIT | ||
*/ | ||
(function(){"use strict";var r=this,e=r.buildUrl,t=function(r,e){var t,u=[],o=r;if(e){if(e.path&&(o+="/"+e.path),e.queryParams){for(t in e.queryParams)e.queryParams.hasOwnProperty(t)&&u.push(t+"="+e.queryParams[t]);o+="?"+u.join("&")}e.hash&&(o+="#"+e.hash)}return o};t.noConflict=function(){return r.buildUrl=e,t},"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=t),exports.buildUrl=t):r.buildUrl=t}).call(this); |
const gulp = require('gulp'); | ||
const uglify = require('gulp-uglify'); | ||
const rename = require('gulp-rename'); | ||
const git = require('gulp-git'); | ||
const bump = require('gulp-bump'); | ||
const filter = require('gulp-filter'); | ||
const tagVersion = require('gulp-tag-version'); | ||
const header = require('gulp-header'); | ||
const pkg = require('./package.json'); | ||
const banner = [ | ||
'/**', | ||
' * <%= pkg.name %> - <%= pkg.description %>', | ||
' * @version v<%= pkg.version %>', | ||
' * @link <%= pkg.homepage %>', | ||
' * @license <%= pkg.license %>', | ||
' */\n' | ||
].join('\n'); | ||
const inc = (importance) => { | ||
return gulp.src('./package.json') | ||
.pipe(bump({ type: importance })) | ||
.pipe(gulp.dest('.')) | ||
.pipe(git.commit('Bump version')) | ||
.pipe(filter('package.json')) | ||
.pipe(tagVersion()); | ||
}; | ||
gulp.task('uglify', () => { | ||
@@ -22,2 +20,3 @@ gulp.src('./src/build-url.js') | ||
.pipe(rename('build-url.min.js')) | ||
.pipe(header(banner, { pkg: pkg })) | ||
.pipe(gulp.dest('./dist')); | ||
@@ -28,2 +27,3 @@ }); | ||
gulp.src('./src/build-url.js') | ||
.pipe(header(banner, { pkg: pkg })) | ||
.pipe(gulp.dest('./dist')); | ||
@@ -36,27 +36,24 @@ }); | ||
gulp.task('patch', () => { | ||
return inc('patch'); | ||
gulp.task('bump-patch', () => { | ||
gulp.src('./package.json') | ||
.pipe(bump({ type: 'patch' })) | ||
.pipe(gulp.dest('./')); | ||
}); | ||
gulp.task('feature', () => { | ||
return inc('minor'); | ||
gulp.task('bump-minor', () => { | ||
gulp.src('./package.json') | ||
.pipe(bump({ type: 'minor' })) | ||
.pipe(gulp.dest('./')); | ||
}); | ||
gulp.task('release', () => { | ||
return inc('major'); | ||
gulp.task('bump-major', () => { | ||
gulp.src('./package.json') | ||
.pipe(bump({ type: 'major' })) | ||
.pipe(gulp.dest('./')); | ||
}); | ||
gulp.task('publish', () => { | ||
if (process.argv.indexOf('--patch') !== -1) { | ||
gulp.run('patch'); | ||
} | ||
if (process.argv.indexOf('--feature') !== -1) { | ||
gulp.run('minor'); | ||
} | ||
if (process.argv.indexOf('--release') !== -1) { | ||
gulp.run('release'); | ||
} | ||
}); | ||
gulp.task('build', ['uglify', 'copy']); | ||
gulp.task('release-patch', ['build', 'bump-patch']); | ||
gulp.task('release-minor', ['build', 'bump-minor']); | ||
gulp.task('release-major', ['build', 'bump-major']); | ||
gulp.task('default', ['build', 'watch']); |
{ | ||
"name": "build-url", | ||
"version": "0.0.9", | ||
"version": "0.0.12", | ||
"description": "A small library that builds a URL given it's components", | ||
@@ -28,6 +28,4 @@ "main": "./dist/build-url.js", | ||
"gulp-bump": "1.0.0", | ||
"gulp-filter": "3.0.1", | ||
"gulp-git": "1.6.0", | ||
"gulp-header": "1.7.1", | ||
"gulp-rename": "1.2.2", | ||
"gulp-tag-version": "1.3.0", | ||
"gulp-uglify": "1.5.1", | ||
@@ -34,0 +32,0 @@ "jasmine": "2.4.1" |
@@ -1,7 +0,1 @@ | ||
/** | ||
* A function that builds a URL based on the arguments it's given | ||
* @param {String} url The first part of the URL e.g. `http://example.com` | ||
* @param {Object} options A hash of options e.g. `{ path: '/about', hash: '#contact', queryParams: {}}` | ||
* @return {String} The complete URL e.g. `http://example.com/about?foo=bar#contact` | ||
*/ | ||
;(function () { | ||
@@ -8,0 +2,0 @@ 'use strict'; |
6
9422
214