Skip to content

Commit

Permalink
fix vulnerabilities (gulp, gulp-mocha, gulp-mustache, gulp-if, del) (#…
Browse files Browse the repository at this point in the history
…1642)

* fix vulnerabilities

* update publish-please

* restore publish-please

* gulp-ll-next

* update gulp-ll-next

* update gulp-ll-next

* requested changes
  • Loading branch information
Farfurix committed Jun 9, 2018
1 parent 0bb81c9 commit b0c978e
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 42 deletions.
102 changes: 66 additions & 36 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const del = require('del');
const eslint = require('gulp-eslint');
const fs = require('fs');
const gulp = require('gulp');
const gulpStep = require('gulp-step');
const qunitHarness = require('gulp-qunit-harness');
const mocha = require('gulp-mocha');
const mustache = require('gulp-mustache');
Expand All @@ -12,13 +13,16 @@ const webmake = require('gulp-webmake');
const uglify = require('gulp-uglify');
const gulpif = require('gulp-if');
const util = require('gulp-util');
const ll = require('gulp-ll');
const ll = require('gulp-ll-next');
const gulpRunCommand = require('gulp-run-command').default;
const path = require('path');

const selfSignedCertificate = require('openssl-self-signed-certificate');

gulpStep.install();

ll
.install()
.tasks('lint')
.onlyInDebug([
'server-scripts',
Expand Down Expand Up @@ -105,25 +109,11 @@ function hang () {
}

// Build
gulp.task('clean', cb => {
del(['./lib'], cb);
});

gulp.task('templates', ['clean'], () => {
return gulp
.src('./src/client/task.js.mustache', { silent: false })
.pipe(gulp.dest('./lib/client'));
gulp.task('clean', () => {
return del(['./lib']);
});

gulp.task('client-scripts', ['client-scripts-bundle'], () => {
return gulp.src('./src/client/index.js.wrapper.mustache')
.pipe(mustache({ source: fs.readFileSync('./lib/client/hammerhead.js').toString() }))
.pipe(rename('hammerhead.js'))
.pipe(gulpif(!util.env.dev, uglify()))
.pipe(gulp.dest('./lib/client'));
});

gulp.task('client-scripts-bundle', ['clean'], () => {
gulp.step('client-scripts-bundle', () => {
return gulp.src('./src/client/index.js')
.pipe(webmake({
sourceMap: false,
Expand All @@ -148,12 +138,28 @@ gulp.task('client-scripts-bundle', ['clean'], () => {
.pipe(gulp.dest('./lib/client'));
});

gulp.task('server-scripts', ['clean'], () => {
gulp.step('client-scripts-processing', () => {
return gulp.src('./src/client/index.js.wrapper.mustache')
.pipe(mustache({ source: fs.readFileSync('./lib/client/hammerhead.js').toString() }))
.pipe(rename('hammerhead.js'))
.pipe(gulpif(!util.env.dev, uglify()))
.pipe(gulp.dest('./lib/client'));
});

gulp.step('client-scripts', gulp.series('client-scripts-bundle', 'client-scripts-processing'));

gulp.step('server-scripts', () => {
return gulp.src(['./src/**/*.js', '!./src/client/**/*.js'])
.pipe(gulpBabel())
.pipe(gulp.dest('lib/'));
});

gulp.step('templates', () => {
return gulp
.src('./src/client/task.js.mustache', { silent: false })
.pipe(gulp.dest('./lib/client'));
});

gulp.task('lint', () => {
return gulp
.src([
Expand All @@ -167,10 +173,20 @@ gulp.task('lint', () => {
.pipe(eslint.failAfterError());
});

gulp.task('build', ['client-scripts', 'server-scripts', 'templates', 'lint']);
gulp.task('build',
gulp.series(
'clean',
gulp.parallel(
'client-scripts',
'server-scripts',
'templates',
'lint'
)
)
);

// Test
gulp.task('test-server', ['build'], () => {
gulp.step('mocha', () => {
return gulp.src('./test/server/*-test.js', { read: false })
.pipe(mocha({
// NOTE: Disable timeouts in debug mode.
Expand All @@ -179,29 +195,42 @@ gulp.task('test-server', ['build'], () => {
}));
});

gulp.task('test-client', ['build'], () => {
gulp.watch('./src/**', ['build']);
gulp.task('test-server', gulp.series('build', 'mocha'));

gulp.step('qunit', () => {
gulp.watch('./src/**', gulp.series('build'));

return gulp
.src('./test/client/fixtures/**/*-test.js')
.pipe(qunitHarness(CLIENT_TESTS_SETTINGS));
});

gulp.task('test-client-dev', ['set-dev-mode', 'test-client']);
gulp.task('test-client', gulp.series('build', 'qunit'));

gulp.step('set-dev-mode', done => {
util.env.dev = true;
done();
});

gulp.task('test-client-dev', gulp.series('set-dev-mode', 'test-client'));

gulp.task('test-client-travis', ['build'], () => {
gulp.step('travis-saucelabs-qunit', () => {
return gulp
.src('./test/client/fixtures/**/*-test.js')
.pipe(qunitHarness(CLIENT_TESTS_SETTINGS, SAUCELABS_SETTINGS));
});

gulp.task('http-playground', ['set-dev-mode', 'build'], () => {
gulp.task('test-client-travis', gulp.series('build', 'travis-saucelabs-qunit'));

gulp.step('http-playground-server', () => {
require('./test/playground/server.js').start();

return hang();
});

gulp.task('https-playground', ['set-dev-mode', 'build'], () => {
gulp.task('http-playground', gulp.series('set-dev-mode', 'build', 'http-playground-server'));

gulp.step('https-playground-server', () => {
require('./test/playground/server.js').start({
key: selfSignedCertificate.key,
cert: selfSignedCertificate.cert
Expand All @@ -210,14 +239,15 @@ gulp.task('https-playground', ['set-dev-mode', 'build'], () => {
return hang();
});

gulp.task('https-playground', gulp.series('set-dev-mode', 'build', 'https-playground-server'));

gulp.task('test-functional-testcafe-travis', ['build'], gulpRunCommand([
'chmod +x ./test/functional/run-testcafe-functional-tests.sh',
'./test/functional/run-testcafe-functional-tests.sh'
]));

gulp.task('travis', [process.env.GULP_TASK || '']);
gulp.task('test-functional-testcafe-travis',
gulp.series('build',
gulpRunCommand([
'chmod +x ./test/functional/run-testcafe-functional-tests.sh',
'./test/functional/run-testcafe-functional-tests.sh'
])
)
);

gulp.task('set-dev-mode', function () {
util.env.dev = true;
});
gulp.task('travis', process.env.GULP_TASK ? gulp.series(process.env.GULP_TASK) : () => {});
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,22 @@
"basic-auth": "1.0.4",
"body-parser": "^1.18.3",
"chai": "^2.3.0",
"del": "^0.1.2",
"del": "^3.0.0",
"endpoint-utils": "^1.0.1",
"eslint": "4.17.0",
"eslint-plugin-hammerhead": "0.1.10",
"express": "4.16.3",
"express-ntlm": "2.1.5",
"gulp": "^3.8.7",
"gulp": "^4.0.0",
"gulp-babel": "^6.1.1",
"gulp-eslint": "4.0.2",
"gulp-if": "1.2.5",
"gulp-ll": "^1.0.1",
"gulp-mocha": "^3.0.0",
"gulp-mustache": "^1.1.1",
"gulp-if": "^2.0.2",
"gulp-ll-next": "^2.1.0",
"gulp-mocha": "^6.0.0",
"gulp-mustache": "^3.0.1",
"gulp-qunit-harness": "^1.0.1",
"gulp-rename": "^1.2.2",
"gulp-step": "^1.0.1",
"gulp-uglify": "^1.0.0",
"gulp-util": "3.0.6",
"gulp-webmake": "0.0.4",
Expand Down

0 comments on commit b0c978e

Please sign in to comment.