Skip to content

Commit

Permalink
Update to Gulp 4
Browse files Browse the repository at this point in the history
  • Loading branch information
TimvdLippe committed May 6, 2018
1 parent 030b15f commit 4e31768
Show file tree
Hide file tree
Showing 3 changed files with 1,294 additions and 8,169 deletions.
40 changes: 20 additions & 20 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,23 @@ class AddClosureTypeImport extends Transform {

gulp.task('clean', () => del([DIST_DIR, 'closure.log']));

gulp.task('closure', ['generate-externs'], () => {
gulp.task('generate-externs', gulp.series('clean', async () => {
let genClosure = require('@polymer/gen-closure-declarations').generateDeclarations;
const declarations = await genClosure();
await fs.writeFile('externs/closure-types.js', `${header}${declarations}`);
}));

gulp.task('generate-typescript', async () => {
let genTs = require('@polymer/gen-typescript-declarations').generateDeclarations;
await del(['types/**/*.d.ts', '!types/extra-types.d.ts']);
const config = await fs.readJson('gen-tsd.json');
const files = await genTs('.', config);
for (const [filePath, contents] of files) {
await fs.outputFile(path.join('types', filePath), contents);
}
});

gulp.task('closure', gulp.series('generate-externs', () => {

let entry, splitRx, joinRx, addClosureTypes;

Expand Down Expand Up @@ -203,14 +219,14 @@ gulp.task('closure', ['generate-externs'], () => {
.pipe(gulpif(joinRx, minimalDocument()))
.pipe(gulpif(joinRx, size({title: 'closure size', gzip: true, showTotal: false, showFiles: true})))
.pipe(gulp.dest(COMPILED_DIR));
});
}));

gulp.task('lint-closure', (done) => {
CLOSURE_LINT_ONLY = true;
runseq('closure', done);
});

gulp.task('estimate-size', ['clean'], () => {
gulp.task('estimate-size', gulp.series('clean', () => {

const babelPresets = {
presets: [['minify', {regexpConstructors: false, simplifyComparisons: false}]]
Expand Down Expand Up @@ -247,7 +263,7 @@ gulp.task('estimate-size', ['clean'], () => {
.pipe(gulpif(/polymer\.html$/, size({ title: 'bundled size', gzip: true, showTotal: false, showFiles: true })))
// write to the bundled folder
.pipe(gulp.dest(BUNDLED_DIR));
});
}));

gulp.task('lint-eslint', function() {
return gulp.src(['lib/**/*.js', 'test/unit/*.{html,js}', 'util/*.js'])
Expand All @@ -264,22 +280,6 @@ gulp.task('update-types', (done) => {
runseq('generate-externs', 'generate-typescript', done);
});

gulp.task('generate-externs', ['clean'], async () => {
let genClosure = require('@polymer/gen-closure-declarations').generateDeclarations;
const declarations = await genClosure();
await fs.writeFile('externs/closure-types.js', `${header}${declarations}`);
});

gulp.task('generate-typescript', async () => {
let genTs = require('@polymer/gen-typescript-declarations').generateDeclarations;
await del(['types/**/*.d.ts', '!types/extra-types.d.ts']);
const config = await fs.readJson('gen-tsd.json');
const files = await genTs('.', config);
for (const [filePath, contents] of files) {
await fs.outputFile(path.join('types', filePath), contents);
}
});

gulp.task('update-version', () => {
return gulp.src('lib/utils/boot.js')
.pipe(replace(/(window.Polymer.version = )'\d+\.\d+\.\d+'/, `$1'${require('./package.json').version}'`))
Expand Down
Loading

0 comments on commit 4e31768

Please sign in to comment.