Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function testsBuild() {
// Combine js files and append tests
return gulp.src(getPaths().map(function(f) { return 'site/public/' + f; })) // Get rid of prepend
.pipe(concat('tests/index.js'))
.pipe(gap.prependFile('tests/prepend.js'))
.pipe(gap.appendText('start();'))
.pipe(addsrc.append(getTestPaths().map(function (f) { return 'tests/public/' + f; })))
.pipe(concat('tests/index.js'))
.pipe(gulp.dest('.'));
}
gulp.task('vendorDraftJsCss', function () {
return gulp
.src([`${draftJsDist}/Draft.css`])
.pipe(gap.prependText('::ng-deep { '))
.pipe(gap.prependText('/* This file is automatically generated from Draft.css upstream */'))
.pipe(gap.prependText('/* Do not edit */'))
.pipe(gap.appendText(' }'))
.pipe(compileSass())
.pipe(rename('draft-js.component.css'))
.pipe(gulp.dest(`${src}/${lib}`));
});
const htmlInsert = stream => {
current.config.htmlInsert.start && stream.pipe(gap.prependText(current.config.htmlInsert.start));
current.config.htmlInsert.end && stream.pipe(gap.appendText(current.config.htmlInsert.end));
};
const buildJs = () =>
gulp.src('dna.js')
.pipe(replace(headerComments.js, ''))
.pipe(header(bannerJs))
.pipe(replace('[VERSION]', pkg.version))
.pipe(size({ showFiles: true }))
.pipe(gulp.dest('dist'))
.pipe(babel(babelMinifyJs))
.pipe(rename({ extname: '.min.js' }))
.pipe(header(bannerJs))
.pipe(gap.appendText('\n'))
.pipe(size({ showFiles: true }))
.pipe(gulp.dest('dist'));
return mergeStream(buildCss(), buildJs());
buildDistribution: () => {
return gulp.src('fetch-json.js')
.pipe(replace(headerComments, ''))
.pipe(header(bannerJs))
.pipe(replace('[VERSION]', pkg.version))
.pipe(size({ showFiles: true }))
.pipe(gulp.dest('dist'))
.pipe(babel(babelMinifyJs))
.pipe(rename({ extname: '.min.js' }))
.pipe(header(bannerJs))
.pipe(gap.appendText('\n'))
.pipe(size({ showFiles: true }))
.pipe(size({ showFiles: true, gzip: true }))
.pipe(gulp.dest('dist'));
}
};
function runSass() {
return gulp
.src('src/**/!(shared-styles).scss')
.pipe(sass())
.pipe(gap.prependText(scssFileHeader))
.pipe(gap.appendText(scssFileFooter))
.pipe(rename({ extname: '-css.ts' }))
.pipe(gulp.dest('src/'));
}
buildDistribution: () => {
return gulp.src('clabe.js')
.pipe(replace(headerComments, ''))
.pipe(header(bannerJs))
.pipe(replace('[VERSION]', pkg.version))
.pipe(size({ showFiles: true }))
.pipe(gulp.dest('dist'))
.pipe(babel(babelMinifyJs))
.pipe(rename({ extname: '.min.js' }))
.pipe(header(bannerJs))
.pipe(gap.appendText('\n'))
.pipe(size({ showFiles: true }))
.pipe(size({ showFiles: true, gzip: true }))
.pipe(gulp.dest('dist'));
}
};
gulp.task('js-webpack', function(){
gulp.src('./js/*.js')
.pipe(strip())
.pipe(rename({
suffix: '-webpack'
}))
.pipe(gap.appendText('export default Canvi;'))
.on('error', function (err) { gutil.log(gutil.colors.red('[Error]'), err.toString()); })
.pipe(gulp.dest('dist'));
});