Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browserify UMD #56

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 42 additions & 10 deletions gulpfile.js
Expand Up @@ -26,30 +26,45 @@ var git = require('gulp-git');

var binPath = path.resolve(__dirname, './node_modules/.bin/');
var browserifyPath = path.resolve(binPath, './browserify');
var derequirePath = path.resolve(binPath, './derequire');
var uglifyPath = path.resolve(binPath, './uglifyjs');
var indexPath = path.resolve(__dirname, './lib/bitauth-browserify');
var namePath = path.resolve(__dirname, './bitauth');
var bundlePath = namePath + '.js';
var minPath = namePath + '.min.js';
var standaloneBundlePath = namePath + '.standalone.js';
var standaloneMinPath = namePath + '.standalone.min.js';
var externsPath = namePath + '.ext.js';

var browserifyCommand = browserifyPath + ' -p bundle-collapser/plugin --require ' +
indexPath + ':bitauth -o ' + bundlePath;
var browserifyStandaloneCommand = [browserifyPath, indexPath, '--standalone', 'bitauth',
'|', derequirePath, '>', standaloneBundlePath].join(' ');
var uglifyCommand = uglifyPath + ' ' + bundlePath + ' --compress --mangle -o ' + minPath;
var uglifyStandaloneCommand = [uglifyPath, standaloneBundlePath, '--compress', '--mangle', '-o', standaloneMinPath].join(' ');

gulp.task('browser:uncompressed', shell.task([
browserifyCommand
]));

gulp.task('browser:standalone:uncompressed', shell.task([
browserifyStandaloneCommand
]));

gulp.task('browser:compressed', ['browser:uncompressed'], shell.task([
uglifyCommand
]));

gulp.task('browser:standalone:compressed', shell.task([
uglifyStandaloneCommand
]));

gulp.task('browser:maketests', shell.task([
'find test/ -type f -name "*.js" | xargs ' + browserifyPath + ' -o tests.js'
]));

gulp.task('browser', function(callback) {
runsequence(['browser:compressed'], callback);
runsequence(['browser:compressed', 'browser:standalone:compressed'], callback);
});


Expand Down Expand Up @@ -92,20 +107,37 @@ gulp.task('release:checkout-master', function(cb) {
}, cb);
});

gulp.task('release:sign-built-files', shell.task([
'gpg --yes --out ' + namePath + '.js.sig --detach-sig ' + namePath + '.js',
'gpg --yes --out ' + namePath + '.min.js.sig --detach-sig ' + namePath + '.min.js'
gulp.task('release:sign-built-files',
['browser:uncompressed',
'browser:compressed',
'browser:standalone:uncompressed',
'browser:standalone:compressed'],
shell.task([
'gpg --yes --out ' + bundlePath + '.sig --detach-sig ' + bundlePath,
'gpg --yes --out ' + minPath + '.sig --detach-sig ' + minPath,
'gpg --yes --out ' + standaloneBundlePath + '.sig --detach-sig ' + standaloneBundlePath,
'gpg --yes --out ' + standaloneMinPath + '.sig --detach-sig ' + standaloneMinPath,
'gpg --yes --out ' + externsPath + '.sig --detach-sig ' + externsPath,
]));

var buildFiles = ['./package.json'];
var signatureFiles = [];
buildFiles.push(namePath + '.js');
buildFiles.push(namePath + '.js.sig');
buildFiles.push(namePath + '.min.js');
buildFiles.push(namePath + '.min.js.sig');
buildFiles.push(bundlePath);
buildFiles.push(bundlePath + '.sig');
buildFiles.push(minPath);
buildFiles.push(minPath + '.sig');
buildFiles.push(standaloneBundlePath);
buildFiles.push(standaloneBundlePath + '.sig');
buildFiles.push(standaloneMinPath);
buildFiles.push(standaloneMinPath + '.sig');
buildFiles.push(externsPath);
buildFiles.push(externsPath + '.sig');
buildFiles.push('./bower.json');
signatureFiles.push(namePath + '.js.sig');
signatureFiles.push(namePath + '.min.js.sig');
signatureFiles.push(bundlePath + '.sig');
signatureFiles.push(minPath + '.sig');
signatureFiles.push(standaloneBundlePath + '.sig');
signatureFiles.push(standaloneMinPath + '.sig');
signatureFiles.push(externsPath + '.sig');

var addFiles = function() {
return gulp.src(buildFiles)
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -40,6 +40,7 @@
"browserify": "~11.2.0",
"bundle-collapser": "^1.2.1",
"chai": "=1.9.1",
"derequire": "^2.0.3",
"express": "^4.13.3",
"gulp": "^3.8.10",
"gulp-bump": "^0.1.11",
Expand Down