Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('gulp-insert-tests', () => {
return gulp.src('*.js')
.pipe(insert.prepend('/* Inserted using gulp-insert prepend method */\n'))
.pipe(insert.prepend('\n/* Inserted using gulp-insert append method */'))
.pipe(insert.wrap(
'/* Inserted using gulp-insert wrap method */\n',
'\n/* Inserted using gulp-insert wrap method */'
))
.pipe(insert.transform((contents, file) => {
var comment = '/* Local file: ' + file.path + ' */\n';
return comment + contents;
}))
.pipe(gulp.dest('gulp-insert'));
});
gulp.task('license', function() {
return gulp.src(licenses)
.pipe(insert.transform(function(contents, file) {
return 'File: ' + file.path.replace(__dirname, '') + "\n" + contents;
}))
.pipe(concat('LICENSE.txt'))
.pipe(gulp.dest(''));
});
function baselineDelete(subfolder = "") {
return gulp.src(["tests/baselines/local/**/*.delete"])
.pipe(insert.transform((content, fileObj) => {
const target = path.join(refBaseline, fileObj.relative.substr(0, fileObj.relative.length - ".delete".length));
del.sync(target);
del.sync(fileObj.path);
return "";
}));
}
gulp.task('update-main-file-version', function(e){
return gulp.src('js/mojs.babel.js')
.pipe(plumber())
.pipe(insert.transform(function(contents) {
var newString = 'revision: \''+currentVersion+'\'';
return contents
.replace(/revision\:\s+?(\'|\")\d+\.\d+\.+\d+(\'|\")/i, newString);
}))
.pipe(gulp.dest('js/'))
});
gulp.task('attribute-lib', function() {
return gulp.src(libMainFile)
.pipe(plumber())
.pipe(insert.transform(function(contents) {
return credits + contents;
}))
.pipe(gulp.dest('./lib'))
});