updated to use npmts, removed pushrocks dependency, bumped version major
This commit is contained in:
parent
92ad03fc65
commit
c4e8ce846d
3
.npmignore
Normal file
3
.npmignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
node_modules
|
||||||
|
test
|
||||||
|
ts
|
12
index.d.ts
vendored
Normal file
12
index.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/// <reference path="ts/typings/tsd.d.ts" />
|
||||||
|
declare module GulpBrowserBrowserify {
|
||||||
|
function init(): () => any;
|
||||||
|
}
|
||||||
|
declare var plugins: {
|
||||||
|
beautylog: any;
|
||||||
|
through: any;
|
||||||
|
gutil: any;
|
||||||
|
path: any;
|
||||||
|
browserify: any;
|
||||||
|
};
|
||||||
|
declare var gulpBrowser: any;
|
20
index.js
20
index.js
@ -1,19 +1,21 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
/// <reference path="./index.ts" />
|
/// <reference path="./index.ts" />
|
||||||
var GulpBrowserBrowserify;
|
var GulpBrowserBrowserify;
|
||||||
(function (GulpBrowserBrowserify) {
|
(function (GulpBrowserBrowserify) {
|
||||||
function init() {
|
function init() {
|
||||||
return function () {
|
return function () {
|
||||||
return through.obj(function (file, enc, cb) {
|
return plugins.through.obj(function (file, enc, cb) {
|
||||||
var bundleCallback = function (err, bufferedContent) {
|
var bundleCallback = function (err, bufferedContent) {
|
||||||
if (Buffer.isBuffer(bufferedContent)) {
|
if (Buffer.isBuffer(bufferedContent)) {
|
||||||
file.contents = bufferedContent;
|
file.contents = bufferedContent;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pr.beautylog.error("gulp-browser: .browserify() " + err.message);
|
plugins.beautylog.error("gulp-browser: .browserify() " + err.message);
|
||||||
}
|
}
|
||||||
cb(null, file);
|
cb(null, file);
|
||||||
};
|
};
|
||||||
browserify(file)
|
plugins.browserify(file)
|
||||||
.bundle(bundleCallback);
|
.bundle(bundleCallback);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -22,11 +24,13 @@ var GulpBrowserBrowserify;
|
|||||||
})(GulpBrowserBrowserify || (GulpBrowserBrowserify = {}));
|
})(GulpBrowserBrowserify || (GulpBrowserBrowserify = {}));
|
||||||
/// <reference path="./typings/tsd.d.ts" />
|
/// <reference path="./typings/tsd.d.ts" />
|
||||||
/// <reference path="./modulebrowserify.ts" />
|
/// <reference path="./modulebrowserify.ts" />
|
||||||
var through = require("through2");
|
var plugins = {
|
||||||
var gutil = require("gulp-util");
|
beautylog: require("beautylog"),
|
||||||
var path = require("path");
|
through: require("through2"),
|
||||||
var browserify = require("browserify");
|
gutil: require("gulp-util"),
|
||||||
var pr = require("pushrocks");
|
path: require("path"),
|
||||||
|
browserify: require("browserify")
|
||||||
|
};
|
||||||
//create the return object
|
//create the return object
|
||||||
var gulpBrowser = {};
|
var gulpBrowser = {};
|
||||||
gulpBrowser.browserify = GulpBrowserBrowserify.init();
|
gulpBrowser.browserify = GulpBrowserBrowserify.init();
|
||||||
|
10
package.json
10
package.json
@ -4,7 +4,7 @@
|
|||||||
"description": "browserify and other goodies for gulp",
|
"description": "browserify and other goodies for gulp",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(cd ts/compile && node compile.js) && (node test.js)",
|
"test": "(npmts) && (node test.js)",
|
||||||
"reinstall": "(rm -r node_modules && npm install)",
|
"reinstall": "(rm -r node_modules && npm install)",
|
||||||
"release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)",
|
"release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)",
|
||||||
"update": "(git checkout master && git pull origin master && npm install)",
|
"update": "(git checkout master && git pull origin master && npm install)",
|
||||||
@ -15,6 +15,7 @@
|
|||||||
"url": "https://github.com/pushrocks/gulp-browser.git"
|
"url": "https://github.com/pushrocks/gulp-browser.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
"gulpplugin",
|
||||||
"json",
|
"json",
|
||||||
"jade",
|
"jade",
|
||||||
"template"
|
"template"
|
||||||
@ -26,15 +27,14 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/gulp-browser",
|
"homepage": "https://github.com/pushrocks/gulp-browser",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"browserify": "12.0.1",
|
"browserify": "13.0.0",
|
||||||
"gulp-util": "3.0.7",
|
"gulp-util": "3.0.7",
|
||||||
"pushrocks": "1.0.24",
|
|
||||||
"through2": "2.0.0"
|
"through2": "2.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"beautylog": "1.0.6",
|
"beautylog": "2.0.2",
|
||||||
"gulp": "3.9.0",
|
"gulp": "3.9.0",
|
||||||
"gulp-callfunction": "0.0.10",
|
"gulp-callfunction": "0.0.10",
|
||||||
"gulp-typescript": "2.10.0"
|
"npmts": "^1.0.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
42
test.js
42
test.js
@ -1,27 +1,29 @@
|
|||||||
/// <reference path="./typings/tsd.d.ts" />
|
/// <reference path="./typings/tsd.d.ts" />
|
||||||
var gulp = require("gulp");
|
var plugins = {
|
||||||
var gulpBrowser = require("./index.js");
|
beautylog: require("beautylog"),
|
||||||
var pr = require("pushrocks");
|
gulp: require("gulp"),
|
||||||
var gulpCallFunction = require("gulp-callfunction");
|
gulpBrowser: require("./index.js"),
|
||||||
var pipeWorked = function () {
|
gulpCallFunction: require("gulp-callfunction")
|
||||||
pr.beautylog.info("Pipe didn't break! Ready for Primetime!");
|
|
||||||
};
|
};
|
||||||
pr.beautylog.log('Now trying to browserify a testfile...');
|
var pipeWorked = function () {
|
||||||
gulp.task('gulpBrowserTest', function (cb) {
|
plugins.beautylog.info("Pipe didn't break! Ready for Primetime!");
|
||||||
var stream = gulp.src('./test/browserifyGulpTest.js')
|
};
|
||||||
.pipe(gulpBrowser.browserify())
|
plugins.beautylog.log('Now trying to browserify a testfile...');
|
||||||
.pipe(gulp.dest("./test/result/"))
|
plugins.gulp.task('gulpBrowserTest', function (cb) {
|
||||||
.pipe(gulpCallFunction(pipeWorked));
|
var stream = plugins.gulp.src('./test/browserifyGulpTest.js')
|
||||||
|
.pipe(plugins.gulpBrowser.browserify())
|
||||||
|
.pipe(plugins.gulp.dest("./test/result/"))
|
||||||
|
.pipe(plugins.gulpCallFunction(pipeWorked));
|
||||||
return stream;
|
return stream;
|
||||||
});
|
});
|
||||||
gulp.task('gulpBrowserTestError', function (cb) {
|
plugins.gulp.task('gulpBrowserTestError', function (cb) {
|
||||||
var stream = gulp.src('./test/browserifyGulpTestError.js')
|
var stream = plugins.gulp.src('./test/browserifyGulpTestError.js')
|
||||||
.pipe(gulpBrowser.browserify())
|
.pipe(plugins.gulpBrowser.browserify())
|
||||||
.pipe(gulp.dest("./test/result/"))
|
.pipe(plugins.gulp.dest("./test/result/"))
|
||||||
.pipe(gulpCallFunction(pipeWorked));
|
.pipe(plugins.gulpCallFunction(pipeWorked));
|
||||||
return stream;
|
return stream;
|
||||||
});
|
});
|
||||||
gulp.task("default", ['gulpBrowserTest', 'gulpBrowserTestError'], function () {
|
plugins.gulp.task("default", ['gulpBrowserTest', 'gulpBrowserTestError'], function () {
|
||||||
pr.beautylog.success("Test passed!");
|
plugins.beautylog.success("Test passed!");
|
||||||
});
|
});
|
||||||
gulp.start.apply(gulp, ['default']);
|
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
// import gulp
|
|
||||||
var gulp = require("gulp")
|
|
||||||
var gulpTypescript = require("gulp-typescript");
|
|
||||||
var pr = require("pushrocks");
|
|
||||||
|
|
||||||
gulp.task('compileTS', function() {
|
|
||||||
var stream = gulp.src('../index.ts')
|
|
||||||
.pipe(gulpTypescript({
|
|
||||||
out: "index.js"
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest("../../"));
|
|
||||||
return stream;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('compileTestTS', function() {
|
|
||||||
var stream = gulp.src('../test.ts')
|
|
||||||
.pipe(gulpTypescript({
|
|
||||||
out: "test.js"
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest("../../"));
|
|
||||||
return stream;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('default',['compileTS','compileTestTS'], function() {
|
|
||||||
pr.beautylog.success('Typescript compiled');
|
|
||||||
});
|
|
||||||
gulp.start.apply(gulp, ['default']);
|
|
@ -1,2 +0,0 @@
|
|||||||
# How to compile.
|
|
||||||
Make sure gulp and gulp-taypescript from npm are available. Then run the gulpfile in this directory.
|
|
13
ts/index.ts
13
ts/index.ts
@ -1,11 +1,14 @@
|
|||||||
/// <reference path="./typings/tsd.d.ts" />
|
/// <reference path="./typings/tsd.d.ts" />
|
||||||
/// <reference path="./modulebrowserify.ts" />
|
/// <reference path="./modulebrowserify.ts" />
|
||||||
|
|
||||||
var through = require("through2");
|
var plugins = {
|
||||||
var gutil = require("gulp-util");
|
beautylog: require("beautylog"),
|
||||||
var path = require("path");
|
through: require("through2"),
|
||||||
var browserify = require("browserify");
|
gutil: require("gulp-util"),
|
||||||
var pr = require("pushrocks");
|
path: require("path"),
|
||||||
|
browserify: require("browserify")
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//create the return object
|
//create the return object
|
||||||
var gulpBrowser:any = {};
|
var gulpBrowser:any = {};
|
||||||
|
@ -2,16 +2,16 @@
|
|||||||
module GulpBrowserBrowserify {
|
module GulpBrowserBrowserify {
|
||||||
export function init() {
|
export function init() {
|
||||||
return function() {
|
return function() {
|
||||||
return through.obj((file, enc, cb) => { //this is the through object that gets returned by gulpBrowser.browserify();
|
return plugins.through.obj((file, enc, cb) => { //this is the through object that gets returned by gulpBrowser.browserify();
|
||||||
var bundleCallback = function(err, bufferedContent) {
|
var bundleCallback = function(err, bufferedContent) {
|
||||||
if (Buffer.isBuffer(bufferedContent)){
|
if (Buffer.isBuffer(bufferedContent)){
|
||||||
file.contents = bufferedContent;
|
file.contents = bufferedContent;
|
||||||
} else {
|
} else {
|
||||||
pr.beautylog.error("gulp-browser: .browserify() " + err.message);
|
plugins.beautylog.error("gulp-browser: .browserify() " + err.message);
|
||||||
}
|
}
|
||||||
cb(null,file);
|
cb(null,file);
|
||||||
};
|
};
|
||||||
browserify(file)
|
plugins.browserify(file)
|
||||||
.bundle(bundleCallback)
|
.bundle(bundleCallback)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
44
ts/test.ts
44
ts/test.ts
@ -1,29 +1,33 @@
|
|||||||
/// <reference path="./typings/tsd.d.ts" />
|
/// <reference path="./typings/tsd.d.ts" />
|
||||||
var gulp = require("gulp");
|
|
||||||
var gulpBrowser = require("./index.js");
|
|
||||||
var pr = require("pushrocks");
|
|
||||||
var gulpCallFunction = require("gulp-callfunction");
|
|
||||||
|
|
||||||
var pipeWorked = function() {
|
var plugins = {
|
||||||
pr.beautylog.info("Pipe didn't break! Ready for Primetime!");
|
beautylog: require("beautylog"),
|
||||||
|
gulp: require("gulp"),
|
||||||
|
gulpBrowser: require("./index.js"),
|
||||||
|
gulpCallFunction: require("gulp-callfunction")
|
||||||
};
|
};
|
||||||
|
|
||||||
pr.beautylog.log('Now trying to browserify a testfile...');
|
|
||||||
gulp.task('gulpBrowserTest',function(cb) {
|
var pipeWorked = function() {
|
||||||
var stream =gulp.src('./test/browserifyGulpTest.js')
|
plugins.beautylog.info("Pipe didn't break! Ready for Primetime!");
|
||||||
.pipe(gulpBrowser.browserify())
|
};
|
||||||
.pipe(gulp.dest("./test/result/"))
|
|
||||||
.pipe(gulpCallFunction(pipeWorked));
|
plugins.beautylog.log('Now trying to browserify a testfile...');
|
||||||
|
plugins.gulp.task('gulpBrowserTest',function(cb) {
|
||||||
|
var stream = plugins.gulp.src('./test/browserifyGulpTest.js')
|
||||||
|
.pipe(plugins.gulpBrowser.browserify())
|
||||||
|
.pipe(plugins.gulp.dest("./test/result/"))
|
||||||
|
.pipe(plugins.gulpCallFunction(pipeWorked));
|
||||||
return stream;
|
return stream;
|
||||||
});
|
});
|
||||||
gulp.task('gulpBrowserTestError',function(cb) {
|
plugins.gulp.task('gulpBrowserTestError',function(cb) {
|
||||||
var stream = gulp.src('./test/browserifyGulpTestError.js')
|
var stream = plugins.gulp.src('./test/browserifyGulpTestError.js')
|
||||||
.pipe(gulpBrowser.browserify())
|
.pipe(plugins.gulpBrowser.browserify())
|
||||||
.pipe(gulp.dest("./test/result/"))
|
.pipe(plugins.gulp.dest("./test/result/"))
|
||||||
.pipe(gulpCallFunction(pipeWorked));
|
.pipe(plugins.gulpCallFunction(pipeWorked));
|
||||||
return stream;
|
return stream;
|
||||||
});
|
});
|
||||||
gulp.task("default",['gulpBrowserTest','gulpBrowserTestError'],function(){
|
plugins.gulp.task("default",['gulpBrowserTest','gulpBrowserTestError'],function(){
|
||||||
pr.beautylog.success("Test passed!");
|
plugins.beautylog.success("Test passed!");
|
||||||
});
|
});
|
||||||
gulp.start.apply(gulp, ['default']);
|
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
Loading…
Reference in New Issue
Block a user