Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP gulp v5 #101

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions dumber/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const babel = require('gulp-babel');
const typescript = require('gulp-typescript');
// @endif
const plumber = require('gulp-plumber');
const merge2 = require('merge2');
const terser = require('gulp-terser');
const gulpif = require('gulp-if');
const del = require('del');
Expand All @@ -30,6 +29,20 @@ const postcssUrl = require('postcss-url');
// @if jasmine || mocha
const gulpRun = require('gulp-run');
// @endif
const { PassThrough } = require('stream');
const mergeStreams = (...streams) => {
const pass = new PassThrough({ objectMode: true });
const { length } = streams;
let ended = 0;
for (let stream of streams) {
stream.on('end', () => {
ended += 1;
if (ended === length) pass.end();
})
stream.pipe(pass, { end: false });
}
return pass;
}

const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
Expand Down Expand Up @@ -124,7 +137,7 @@ function buildJs(src) {
// @endif
return gulp.src(src, { sourcemaps: !isProduction })
.pipe(gulpif(!isProduction && !isTest, plumber()))
.pipe(au2())
.pipe(au2({ hmr: false }))
// @if babel
.pipe(babel());
// @endif
Expand Down Expand Up @@ -183,7 +196,7 @@ function build() {
// dumber knows nothing about .ts/.less/.scss/.md files,
// gulp-* plugins transpiled them into js/css/html before
// sending to dumber.
return merge2(
return mergeStreams(
gulp.src('src/**/*.json'),
// @if babel
// @if !jasmine && !mocha
Expand Down
10 changes: 1 addition & 9 deletions dumber/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"devDependencies": {
"@aurelia/plugin-gulp": /* @if latest */"latest"/* @endif *//* @if dev */"dev"/* @endif */,
"gulp": "^4.0.2",
"gulp": "^5.0.0",
"gulp-dumber": "^2.0.0",
// @if babel
"gulp-babel": "^8.0.0",
Expand All @@ -10,7 +10,6 @@
"gulp-typescript": "^5.0.1",
// @endif
"gulp-plumber": "^1.2.1",
"merge2": "^1.4.1",
"gulp-terser": "^2.1.0",
"gulp-if": "^3.0.0",
"del": "^6.1.1",
Expand Down Expand Up @@ -50,11 +49,4 @@
"test:watch": "gulp clean && cross-env NODE_ENV=test gulp watch-test"
// @endif
},
// npm v8 feature to bypass outdated gulp deps
"overrides": {
"chokidar": "^3.6.0",
"glob-stream": "^7.0.0",
"glob-parent": "^6.0.2",
"micromatch": "^4.0.5"
}
}
Loading