Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
9b6609a2e5 | |||
943fcf8634 | |||
6de689a766 | |||
774269da57 | |||
6a884cda78 | |||
3e46c8c927 | |||
31d1fae5a2 | |||
95e874c8e8 | |||
6594932cbd | |||
9457f3ce8a | |||
eb636603ab | |||
6e2797cd65 | |||
8de47822e4 | |||
cd867e1d6c | |||
d0445361eb | |||
d580d486fa | |||
8053a34581 | |||
2b6a95a45a | |||
c4e8ce846d | |||
462d11da27 | |||
92ad03fc65 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,5 +5,6 @@ npm-debug.log
|
||||
|
||||
ts/*.js
|
||||
ts/*.js.map
|
||||
ts/typings/
|
||||
|
||||
test/result/
|
3
.npmignore
Normal file
3
.npmignore
Normal file
@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
test
|
||||
ts
|
@ -1,13 +1,13 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "4.1"
|
||||
- '4.1'
|
||||
before_install:
|
||||
- npm install -g tsd
|
||||
- npm install -g tsd
|
||||
deploy:
|
||||
provider: npm
|
||||
email: npm@smart-coordination.com
|
||||
email: npm@lossless.digital
|
||||
api_key:
|
||||
secure: G2kV5r0/ZYzNYRxq3eL9in2uuXlE3xj2OAL8q/Xa2GVczMn/hU1FZItfnCYH7wOD1CqeUX1W5J87Fw0iqkfl/6FsTO3h2UpUoTea0mCK/HYj0HlpIudOeXklYfo0HpYqKnhsbR0oB/AkeDldNwBlf3uzyEMu24Bb5VbtWZ8Qmjm7k2CT17ZNX0dJwQ8c1LdsNjYRCUIQrvSFVFypkIwx5WCsWbBzyZSR2e8r7BkuyfdHl7dEN41ULGcq5hTy/x1qKTIS9AY/JbWW/tdzARREsnqUxNiRmtM8BR85BYxRfgFdOO+0FcDBbJJyFC9NHn7FSpbc5kuX/vOEcbpGye7V6rM3D33emKhW8sAER4UaXZjSYJD5LHXrRFm0eexGnSRGmXPvuSt1oa0kuE2w1jTR6ixmL5M4kmcsUQt+OnOha/ImeE1Aa88JKgBBA7K5QIaiCLsJAulZeVvcqpbFD2SH/4L+lOdev9z6cR485x5eHi5ehIeKlRiWoy4ZMydSyMcYQJlvsc2zFgR4QKatz1/iryeti6taJG8FWx4+XWwxQm57sxDrXK3FTsy9uu3wg39iUQJRVhmU52Oyg3obmsa9B3OLVqZFkOEgqy1R9XeJTJHe7ka4MTynRlkjWK7KX9eNCC+tSPMtUf8/bmH+YNS7Y3dQvnNNvvxs3U8XCH/rQ0M=
|
||||
secure: MNBFCPscAm1+rY1qIHbye3Bwif9W/bPyHxvXyoKbi8G2URQjZKNYTpRT0bVShj6UBJihBrnXa40cxmU/F+rcQhPeY4uFIC5oBIyYkSrn0XvhJEqn/yQnBl0DrdImYSuYx480jLKvvNq3RIft2K+5y6+qb8QuumV/1p4QYbiM6Ibwz54SPfmJtzsMsei8bHzbDvOtKeoX8l3mGqyIVX1D/Nnnq9rH0UZnbqf7W5IH/QlCTpVAj5v/HRCSbCbJkbmwTYtx4PV0xS9vYgXklwFr0FcJXyZPmzqSRM/EYnhOg61uQCWM1JG12nDmdv8lkE+x5L6fV+YXTeBAKmnCBAZy8D7CYX0jDELrpKp4wKFofl/AkTDAlVsjEb4U+DVXuJOWt8KQzjYGLX6nXXOUzDD9OXNmB6010a2g3SQ4vCX3jHomycPZTgKPd4MN5xiJBfg/EXn1HlJdtO8jYFB2S87VVmFrJfwQ6x4iZxabmWPtasye3DP/OLX+8/8aWNGLMjP/Lr4muPS4B9OOlI3EvVo+DR3B381NPwzKaM9NLkeM3pHgMhm0K2mqOnbvhUhhkmmMkQI1T+RRf91zraPXAh7fMRDh2lDqKfrhtKobFBmONgXAtO7QPz2Bhp+kszwRo/Vx//H2VpUD45CNfMKnN99VYY/FHGYICBYH2mK/MX50HAA=
|
||||
on:
|
||||
tags: true
|
||||
repo: pushrocks/gulp-browser
|
||||
|
@ -29,3 +29,8 @@ gulp-browser is meant to be easy:
|
||||
### Dev Information:
|
||||
[](https://david-dm.org/pushrocks/gulp-browser#info=devDependencies)
|
||||
[](https://www.bithound.io/github/pushrocks/gulp-browser/master/dependencies/npm)
|
||||
|
||||
### About the authors:
|
||||
[](https://lossless.com/)
|
||||
|
||||
[](https://paypal.me/lossless)
|
12
index.d.ts
vendored
Normal file
12
index.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
/// <reference path="ts/typings/main.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;
|
22
index.js
22
index.js
@ -1,32 +1,36 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/// <reference path="./index.ts" />
|
||||
var GulpBrowserBrowserify;
|
||||
(function (GulpBrowserBrowserify) {
|
||||
function init() {
|
||||
return function () {
|
||||
return through.obj(function (file, enc, cb) {
|
||||
return plugins.through.obj(function (file, enc, cb) {
|
||||
var bundleCallback = function (err, bufferedContent) {
|
||||
if (Buffer.isBuffer(bufferedContent)) {
|
||||
file.contents = bufferedContent;
|
||||
}
|
||||
else {
|
||||
pr.beautylog.error("gulp-browser: .browserify() " + err.message);
|
||||
plugins.beautylog.error("gulp-browser: .browserify() " + err.message);
|
||||
}
|
||||
cb(null, file);
|
||||
};
|
||||
browserify(file)
|
||||
plugins.browserify(file, { basedir: file.base })
|
||||
.bundle(bundleCallback);
|
||||
});
|
||||
};
|
||||
}
|
||||
GulpBrowserBrowserify.init = init;
|
||||
})(GulpBrowserBrowserify || (GulpBrowserBrowserify = {}));
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
/// <reference path="./modulebrowserify.ts" />
|
||||
var through = require("through2");
|
||||
var gutil = require("gulp-util");
|
||||
var path = require("path");
|
||||
var browserify = require("browserify");
|
||||
var pr = require("pushrocks");
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
through: require("through2"),
|
||||
gutil: require("gulp-util"),
|
||||
path: require("path"),
|
||||
browserify: require("browserify")
|
||||
};
|
||||
//create the return object
|
||||
var gulpBrowser = {};
|
||||
gulpBrowser.browserify = GulpBrowserBrowserify.init();
|
||||
|
18
package.json
18
package.json
@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "gulp-browser",
|
||||
"version": "0.0.17",
|
||||
"version": "1.0.6",
|
||||
"description": "browserify and other goodies for gulp",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "(cd ts/compile && node compile.js) && (node test.js)",
|
||||
"test": "(npmts)",
|
||||
"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)",
|
||||
"update": "(git checkout master && git pull origin master && npm install)",
|
||||
@ -15,9 +15,8 @@
|
||||
"url": "https://github.com/pushrocks/gulp-browser.git"
|
||||
},
|
||||
"keywords": [
|
||||
"json",
|
||||
"jade",
|
||||
"template"
|
||||
"gulpplugin",
|
||||
"browserify"
|
||||
],
|
||||
"author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
|
||||
"license": "MIT",
|
||||
@ -26,15 +25,14 @@
|
||||
},
|
||||
"homepage": "https://github.com/pushrocks/gulp-browser",
|
||||
"dependencies": {
|
||||
"browserify": "12.0.1",
|
||||
"beautylog": "2.0.4",
|
||||
"browserify": "13.0.0",
|
||||
"gulp-util": "3.0.7",
|
||||
"pushrocks": "1.0.24",
|
||||
"through2": "2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"beautylog": "1.0.6",
|
||||
"gulp": "3.9.0",
|
||||
"gulp-callfunction": "0.0.10",
|
||||
"gulp-typescript": "2.10.0"
|
||||
"gulp-function": "0.0.12",
|
||||
"npmts": "^2.0.2"
|
||||
}
|
||||
}
|
||||
|
27
test.js
27
test.js
@ -1,27 +0,0 @@
|
||||
/// <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 () {
|
||||
pr.beautylog.info("Pipe didn't break! Ready for Primetime!");
|
||||
};
|
||||
pr.beautylog.log('Now trying to browserify a testfile...');
|
||||
gulp.task('gulpBrowserTest', function (cb) {
|
||||
var stream = gulp.src('./test/browserifyGulpTest.js')
|
||||
.pipe(gulpBrowser.browserify())
|
||||
.pipe(gulp.dest("./test/result/"))
|
||||
.pipe(gulpCallFunction(pipeWorked));
|
||||
return stream;
|
||||
});
|
||||
gulp.task('gulpBrowserTestError', function (cb) {
|
||||
var stream = gulp.src('./test/browserifyGulpTestError.js')
|
||||
.pipe(gulpBrowser.browserify())
|
||||
.pipe(gulp.dest("./test/result/"))
|
||||
.pipe(gulpCallFunction(pipeWorked));
|
||||
return stream;
|
||||
});
|
||||
gulp.task("default", ['gulpBrowserTest', 'gulpBrowserTestError'], function () {
|
||||
pr.beautylog.success("Test passed!");
|
||||
});
|
||||
gulp.start.apply(gulp, ['default']);
|
29
test/test.js
Normal file
29
test/test.js
Normal file
@ -0,0 +1,29 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
gulpBrowser: require("../index.js"),
|
||||
gulpFunction: require("gulp-function")
|
||||
};
|
||||
describe("gulpBrowser", function () {
|
||||
describe(".browserify", function () {
|
||||
it("should run through smoothly", function (done) {
|
||||
this.timeout(15000);
|
||||
plugins.gulp.task('gulpBrowserNormal', function (cb) {
|
||||
var stream = plugins.gulp.src('./test/browserifyGulpTest.js')
|
||||
.pipe(plugins.gulpBrowser.browserify())
|
||||
.pipe(plugins.gulp.dest("./test/result/"))
|
||||
.pipe(plugins.gulpFunction(done));
|
||||
return stream;
|
||||
});
|
||||
plugins.gulp.start.apply(plugins.gulp, ['gulpBrowserNormal']);
|
||||
});
|
||||
});
|
||||
});
|
||||
plugins.gulp.task('gulpBrowserTestError', function (cb) {
|
||||
plugins.beautylog.info("Expecting an error:");
|
||||
var stream = plugins.gulp.src('./test/browserifyGulpTestError.js')
|
||||
.pipe(plugins.gulpBrowser.browserify())
|
||||
.pipe(plugins.gulp.dest("./test/result/"));
|
||||
return stream;
|
||||
});
|
@ -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.
|
15
ts/index.ts
15
ts/index.ts
@ -1,11 +1,14 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
/// <reference path="./modulebrowserify.ts" />
|
||||
|
||||
var through = require("through2");
|
||||
var gutil = require("gulp-util");
|
||||
var path = require("path");
|
||||
var browserify = require("browserify");
|
||||
var pr = require("pushrocks");
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
through: require("through2"),
|
||||
gutil: require("gulp-util"),
|
||||
path: require("path"),
|
||||
browserify: require("browserify")
|
||||
};
|
||||
|
||||
|
||||
//create the return object
|
||||
var gulpBrowser:any = {};
|
||||
|
@ -2,16 +2,16 @@
|
||||
module GulpBrowserBrowserify {
|
||||
export function init() {
|
||||
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) {
|
||||
if (Buffer.isBuffer(bufferedContent)){
|
||||
file.contents = bufferedContent;
|
||||
} else {
|
||||
pr.beautylog.error("gulp-browser: .browserify() " + err.message);
|
||||
plugins.beautylog.error("gulp-browser: .browserify() " + err.message);
|
||||
}
|
||||
cb(null,file);
|
||||
};
|
||||
browserify(file)
|
||||
plugins.browserify(file, { basedir: file.base })
|
||||
.bundle(bundleCallback)
|
||||
});
|
||||
};
|
||||
|
52
ts/test.ts
52
ts/test.ts
@ -1,29 +1,31 @@
|
||||
/// <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() {
|
||||
pr.beautylog.info("Pipe didn't break! Ready for Primetime!");
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
gulpBrowser: require("../index.js"),
|
||||
gulpFunction: require("gulp-function")
|
||||
};
|
||||
|
||||
pr.beautylog.log('Now trying to browserify a testfile...');
|
||||
gulp.task('gulpBrowserTest',function(cb) {
|
||||
var stream =gulp.src('./test/browserifyGulpTest.js')
|
||||
.pipe(gulpBrowser.browserify())
|
||||
.pipe(gulp.dest("./test/result/"))
|
||||
.pipe(gulpCallFunction(pipeWorked));
|
||||
describe("gulpBrowser",function(){
|
||||
describe(".browserify",function(){
|
||||
it("should run through smoothly",function(done){
|
||||
this.timeout(15000);
|
||||
plugins.gulp.task('gulpBrowserNormal',function(cb) {
|
||||
var stream = plugins.gulp.src('./test/browserifyGulpTest.js')
|
||||
.pipe(plugins.gulpBrowser.browserify())
|
||||
.pipe(plugins.gulp.dest("./test/result/"))
|
||||
.pipe(plugins.gulpFunction(done));
|
||||
return stream;
|
||||
});
|
||||
plugins.gulp.start.apply(plugins.gulp, ['gulpBrowserNormal']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
plugins.gulp.task('gulpBrowserTestError',function(cb) {
|
||||
plugins.beautylog.info("Expecting an error:");
|
||||
var stream = plugins.gulp.src('./test/browserifyGulpTestError.js')
|
||||
.pipe(plugins.gulpBrowser.browserify())
|
||||
.pipe(plugins.gulp.dest("./test/result/"));
|
||||
return stream;
|
||||
});
|
||||
gulp.task('gulpBrowserTestError',function(cb) {
|
||||
var stream = gulp.src('./test/browserifyGulpTestError.js')
|
||||
.pipe(gulpBrowser.browserify())
|
||||
.pipe(gulp.dest("./test/result/"))
|
||||
.pipe(gulpCallFunction(pipeWorked));
|
||||
return stream;
|
||||
});
|
||||
gulp.task("default",['gulpBrowserTest','gulpBrowserTestError'],function(){
|
||||
pr.beautylog.success("Test passed!");
|
||||
});
|
||||
gulp.start.apply(gulp, ['default']);
|
7
ts/typings.json
Normal file
7
ts/typings.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"browserify": "github:DefinitelyTyped/DefinitelyTyped/browserify/browserify.d.ts",
|
||||
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts"
|
||||
}
|
||||
}
|
41
ts/typings/browserify/browserify.d.ts
vendored
41
ts/typings/browserify/browserify.d.ts
vendored
@ -1,41 +0,0 @@
|
||||
// Type definitions for Browserify
|
||||
// Project: http://browserify.org/
|
||||
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
interface BrowserifyObject extends NodeJS.EventEmitter {
|
||||
add(file:string, opts?:any): BrowserifyObject;
|
||||
require(file:string, opts?:{
|
||||
expose: string;
|
||||
}): BrowserifyObject;
|
||||
bundle(opts?:{
|
||||
insertGlobals?: boolean;
|
||||
detectGlobals?: boolean;
|
||||
debug?: boolean;
|
||||
standalone?: string;
|
||||
insertGlobalVars?: any;
|
||||
}, cb?:(err:any, src:any) => void): NodeJS.ReadableStream;
|
||||
|
||||
external(file:string, opts?:any): BrowserifyObject;
|
||||
ignore(file:string, opts?:any): BrowserifyObject;
|
||||
transform(tr:string, opts?:any): BrowserifyObject;
|
||||
transform(tr:Function, opts?:any): BrowserifyObject;
|
||||
plugin(plugin:string, opts?:any): BrowserifyObject;
|
||||
plugin(plugin:Function, opts?:any): BrowserifyObject;
|
||||
}
|
||||
|
||||
interface Browserify {
|
||||
(): BrowserifyObject;
|
||||
(files:string[]): BrowserifyObject;
|
||||
(opts:{
|
||||
entries?: string[];
|
||||
noParse?: string[];
|
||||
}): BrowserifyObject;
|
||||
}
|
||||
|
||||
declare module "browserify" {
|
||||
var browserify: Browserify;
|
||||
export = browserify;
|
||||
}
|
2092
ts/typings/node/node.d.ts
vendored
2092
ts/typings/node/node.d.ts
vendored
File diff suppressed because it is too large
Load Diff
2
ts/typings/tsd.d.ts
vendored
2
ts/typings/tsd.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
/// <reference path="node/node.d.ts" />
|
||||
/// <reference path="browserify/browserify.d.ts" />
|
Reference in New Issue
Block a user