<commit_before>var fs = require('fs'),
	gulp = require('gulp'),
	size = require('gulp-sizereport'),
	jshint = require('gulp-jshint'),
	uglify = require('gulp-uglify'),
	resolve = require('resolve'),
	rename = require('gulp-rename'),
	replace = require('gulp-replace'),
	merge = require('merge2'),
	shell = require('gulp-shell'),
	browserify = require('browserify'),
	resolve = require('resolve'),
	through2 = require('through2'),
	_ = require('lodash');

// ======================================== gulp version

gulp.task('version', function() {

	var streams = merge(),
		version = fs.readFileSync('./src/qwest.js', {encoding: 'utf8'}).match(/^\/\*\! \w+ ([0-9.]+)/)[1];

	streams.add(
		gulp.src( './package.json' )
			.pipe( replace(/"version": "[0-9.]+",/, '"version": "'+version+'",') )
			.pipe( gulp.dest('.') )
	);

	streams.add(
		gulp.src( './README.md' )
			.pipe( replace(/^(\w+) [0-9.]+/, '$1 '+version) )
			.pipe( gulp.dest('.') )
	);

	return streams;

});

// ======================================== gulp lint

gulp.task('lint', function() {

	return gulp.src( './src/qwest.js' )
		.pipe( jshint() )
		.pipe( jshint.reporter('jshint-stylish') );

});

// ======================================== gulp build

gulp.task('build', ['version', 'lint'], function() {
	
	/*
		https://www.npmjs.com/package/derequire
		https://github.com/substack/webworkify
	*/
	
	return gulp.src( './src/qwest.js' )
				.pipe( size() )
				.pipe( through2.obj(function(file, enc, next) {
		
					var b = browserify(null, {standalone: 'qwest'});
		
					(_.keys(require('./package.json').dependencies) || []).forEach(function(name) {
						b.add(resolve.sync(name, {moduleDirectory: './node_modules/'}));
					});
		
					b.require('./src/qwest.js', {expose: 'qwest'});
		
					b.bundle(function(err, res) {
						file.contents = res;
						next(null, file);
					});
		
				}) )
				//.pipe( uglify() )
				.pipe( rename('qwest.min.js') )
				.pipe( gulp.dest('.') )
				.pipe( size({gzip:true}) );

});

// ======================================== gulp publish

gulp.task('publish', function() {

	return gulp.src('.', {read: false})
				.pipe(shell([
					'npm publish',
					'jam publish'
				]));

});

// ======================================== gulp

gulp.task('default', ['build']);<commit_msg>Update gulpfile<commit_after>var fs = require('fs'),
	gulp = require('gulp'),
	size = require('gulp-sizereport'),
	jshint = require('gulp-jshint'),
	uglify = require('gulp-uglify'),
	resolve = require('resolve'),
	rename = require('gulp-rename'),
	replace = require('gulp-replace'),
	merge = require('merge2'),
	shell = require('gulp-shell'),
	browserify = require('browserify'),
	resolve = require('resolve'),
	through2 = require('through2'),
	_ = require('lodash');

var name = 'imagine';

// ======================================== gulp version

gulp.task('version', function() {

	var streams = merge(),
		version = fs.readFileSync('./src/'+name+'.js', {encoding: 'utf8'}).match(/^\/\*\! \w+ ([0-9.]+)/)[1];

	streams.add(
		gulp.src( './package.json' )
			.pipe( replace(/"version": "[0-9.]+",/, '"version": "'+version+'",') )
			.pipe( gulp.dest('.') )
	);

	streams.add(
		gulp.src( './README.md' )
			.pipe( replace(/^(\w+) [0-9.]+/, '$1 '+version) )
			.pipe( gulp.dest('.') )
	);

	return streams;

});

// ======================================== gulp lint

gulp.task('lint', function() {

	return gulp.src( './src/'+name+'.js' )
		.pipe( jshint() )
		.pipe( jshint.reporter('jshint-stylish') );

});

// ======================================== gulp build

gulp.task('build', ['version', 'lint'], function() {
	
	return gulp.src( './src/'+name+'.js' )
				.pipe( size() )
				.pipe( through2.obj(function(file, enc, next) {
		
					var b = browserify(null, {standalone: name});
		
					(_.keys(require('./package.json').dependencies) || []).forEach(function(name) {
						b.add(resolve.sync(name, {moduleDirectory: './node_modules/'}));
					});
		
					b.require('./src/'+name+'.js', {expose: name});
		
					b.bundle(function(err, res) {
						file.contents = res;
						next(null, file);
					});
		
				}) )
				//.pipe( uglify() )
				.pipe( rename(name+'.min.js') )
				.pipe( gulp.dest('.') )
				.pipe( size({gzip:true}) );

});

// ======================================== gulp publish

gulp.task('publish', function() {

	return gulp.src('.', {read: false})
				.pipe(shell([
					'npm publish',
					'jam publish'
				]));

});

// ======================================== gulp

gulp.task('default', ['build']);
{'fraction_non_alphanumeric': 0.3146513680494263, 'fraction_numerical': 0.005736981465136805, 'mean_word_length': 3.569556451612903, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5642149', 'n_tokens_mistral': 1834, 'n_tokens_neox': 1589, 'n_words': 269}