Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert(entries);
assert.strictEqual(entries.length, 1, 'Expected `browserifyObj` to only have "1" entry ' +
'but got "' + entries.length + '" entries. Otherwise, we can\'t determine its output name');
// /home/todd/.../public/js/articles/develop-faster.js -> articles/develop-faster.js
var jsFilepath = path.relative(__dirname + '/public/js', entries[0]);
jsStream = jsStream
.pipe(vinylSourceStream(jsFilepath))
.pipe(gulpBuffer());
// Return our JS stream
return jsStream;
});
// Join our files into 1 stream
// DEV: We use 1 stream so size reports are in the same file
var jsStream = mergeStream.apply(this, jsStreams);
// Extract browserify inline sourcemaps into in-memory file
jsStream = jsStream.pipe(gulpSourcemaps.init({loadMaps: true}));
// If we are minifying assets, then minify them
if (config.minifyAssets) {
jsStream = jsStream
.pipe(gulpUglify())
.pipe(gulpSizereport({gzip: true}));
}
// Output sourcemaps in-memory to Vinyl file
jsStream = jsStream.pipe(gulpSourcemaps.write('./'));
// Return our stream
return jsStream
copyAssets: function copyAssets() {
return merge.apply(merge, ASSETS_TO_COPY.map(function (asset) {
var fqSourcePath = path.join.apply(path, [SOURCE_DIR].concat(asset.src.split("/")));
var fqTargetPath = path.join.apply(path, [BUILD_DIR].concat(asset.dest.split("/")));
return gulp.src([fqSourcePath])
.pipe(gulp.dest(fqTargetPath));
}).concat(projectTasks.copyConfig()))
.pipe(browserSync.stream());
//
// return merge(
// gulp.src(["./build.json"])
// .pipe(gulp.dest(path.join(BUILD_DIR))),
// gulp.src(["./src/www/*.*"])
// .pipe(gulp.dest(path.join(BUILD_DIR, "www"))),
// gulp.src(["./src/www/html/**/*"])
// .pipe(gulp.dest(path.join(BUILD_DIR, "www", "html"))),
// gulp.src(["./src/www/img/**/*"])
// .pipe(gulp.dest(path.join(BUILD_DIR, "www", "img"))),
b.on('update', bundle);
bundleLogger.watch(bundleConfig.outputName);
} else {
// Sort out shared dependencies.
// b.require exposes modules externally
if(bundleConfig.require) b.require(bundleConfig.require);
// b.external excludes modules from the bundle, and expects
// they'll be available externally
if(bundleConfig.external) b.external(bundleConfig.external);
}
return bundle();
};
// Start bundling with Browserify for each bundleConfig specified
return mergeStream.apply(gulp, _.map(config.bundleConfigs, browserifyThis));
};
if (bundle.styles) {
streams.push(gulp.src(bundle.styles, {base: '.'})
.pipe(using(key, 'css'))
.pipe(concat(key + '-bundle.css')) // todo src maps
.pipe(gulp.dest(config.dest)));
}
if (bundle.resources) {
streams.push(gulp.src(bundle.resources, {base: '.'})
.pipe(using(key))
.pipe(gulp.dest(config.dest)));
}
});
return merge.apply(merge, streams);
}
return () => {
return merge.apply(merge, [
gulp.src([
'./LICENSE',
], {base: './'})
.pipe(gulp.dest($.distDir)),
// Copy static files like images, locales, etc...
gulp.src([
'./src/images/**/*.+(png|jpg|gif|ico|icns)',
'./src/docs/**',
'./src/locales/**/*.json',
'./src/.htaccess',
'./src/*.+(xml|ico|txt|webapp)',
'./src/styles/**/*.+(eot|svg|ttf|woff)',
], {base: './src'})
.pipe(gulp.dest($.distDir)),
gulp.task('devbuild',['jsbeautify:src'], function(){
del([paths.dirs.dist], function () {
console.log('Cleaning old built assets.');
});
var modelStreams = createBundlerStreams(paths.files.modelsSrc, 'dist/models/');
var effectsStreams = createBundlerStreams(paths.files.effectsSrc, 'dist/effects/');
var coreStream = createBundlerStreams(paths.files.coreSrc, 'dist/core/');
var indexStream = gulp.src(paths.files.releaseIndexSrc).pipe(gulp.dest(paths.dirs.dist));
var combinedStreams = modelStreams.concat(effectsStreams).concat(coreStream).concat(indexStream);
return merge.apply(this,combinedStreams);
});
gulp.task(taskPrefix + 'api:layouts', function() {
var streams = _.map(options.apiConfig.project.refs, function(ref) {
return gulp.src(path.join(options.pathSrc, 'layouts/*.soy'))
.pipe(baseInject(options))
.pipe(gulp.dest(path.join(TEMP_DIR, ref, 'layouts')));
});
return mergeStream.apply(this, streams);
});
gulp.task(task, function() {
var collection = config.collections['concatenate'+task];
return merge.apply(this, collection.map(mergeFiles));
});
};
gulp.task('browserify', ['clean'], function() {
const sites = {
github: 'src/js/sites/GitHub/index.js',
bitbucket: 'src/js/sites/BitBucket/index.js',
};
const streams = Object.keys(sites).forEach(site => (
browserifyPipe(site, sites[site], 'dist/chrome')
));
return mergeStream.apply(this, streams);
});