Update dependencies and get rid of most of Gulp

redux
Sven Slootweg 4 years ago
parent 69dbe3a4e4
commit 30400240e3

@ -0,0 +1,3 @@
lib/parser.js
test/vendor/**/*
benchmark/vendor/**/*

@ -1,3 +1,3 @@
{
"extends": "dmajda"
"extends": "@joepie91/eslint-config"
}

@ -26,7 +26,7 @@ app.get("/bundle.js", (req, res) => {
});
browserify(files)
.transform(babelify, { presets: "es2015", compact: false })
.transform(babelify, { presets: "env", compact: false })
.bundle()
.pipe(res);
});

@ -1,52 +1,9 @@
"use strict";
/* eslint-env node */
let babelify = require("babelify");
let browserify = require("browserify");
let buffer = require("vinyl-buffer");
let del = require("del");
let eslint = require("gulp-eslint");
let gulp = require("gulp");
let header = require("gulp-header");
let mocha = require("gulp-mocha");
let package_ = require("./package");
let peg = require("./lib/peg");
let rename = require("gulp-rename");
let runSequence = require("run-sequence");
let source = require("vinyl-source-stream");
let spawn = require("child_process").spawn;
let transform = require("gulp-transform");
let uglify = require("gulp-uglify");
const HEADER = [
"// PEG.js " + package_.version,
"//",
"// https://pegjs.org/",
"//",
"// Copyright (c) 2010-2016 David Majda",
"// Licensed under the MIT License.",
""
].map(line => `${line}\n`).join("");
const JS_FILES = [
"lib/**/*.js",
"!lib/parser.js",
"test/**/*.js",
"test/server",
"!test/vendor/**/*",
"benchmark/**/*.js",
"benchmark/run",
"benchmark/server",
"!benchmark/vendor/**/*",
"bin/pegjs",
"gulpfile.js"
];
const TEST_FILES = [
"test/**/*.js",
"!test/vendor/**/*"
];
function generate(contents) {
return peg.generate(contents.toString(), {
@ -55,54 +12,10 @@ function generate(contents) {
});
}
// Run ESLint on all JavaScript files.
gulp.task("lint", () =>
gulp.src(JS_FILES)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
);
// Run tests.
gulp.task("test", () =>
gulp.src(TEST_FILES, { read: false })
.pipe(mocha())
);
// Run benchmarks.
gulp.task("benchmark", () =>
spawn("benchmark/run", { stdio: "inherit" })
);
// Create the browser build.
gulp.task("browser:build", () =>
browserify("lib/peg.js", { standalone: "peg" })
.transform(babelify, { presets: "es2015", compact: false })
.bundle()
.pipe(source("peg.js"))
.pipe(header(HEADER))
.pipe(gulp.dest("browser"))
.pipe(rename({ suffix: ".min" }))
.pipe(buffer())
.pipe(uglify())
.pipe(header(HEADER))
.pipe(gulp.dest("browser"))
);
// Delete the browser build.
gulp.task("browser:clean", () =>
del("browser")
);
// Generate the grammar parser.
gulp.task("parser", () =>
gulp.src("src/parser.pegjs")
.pipe(transform(generate))
.pipe(transform("utf8", generate))
.pipe(rename({ extname: ".js" }))
.pipe(gulp.dest("lib"))
);
// Default task.
gulp.task("default", cb =>
runSequence("lint", "test", cb)
);

@ -42,31 +42,29 @@
"bin": "bin/pegjs",
"repository": "pegjs/pegjs",
"scripts": {
"test": "gulp"
"test": "mocha 'test/**/*.js' '!test.vendor.**/*'",
"benchmark": "node benchmark/run",
"lint": "eslint ."
},
"devDependencies": {
"babel-preset-es2015": "6.14.0",
"babelify": "7.3.0",
"browserify": "13.1.0",
"@joepie91/eslint-config": "^1.1.0",
"babelify": "^10.0.0",
"browserify": "^17.0.0",
"chai": "3.5.0",
"del": "2.2.2",
"eslint-config-dmajda": "1.0.0",
"express": "4.14.0",
"glob": "7.0.6",
"gulp": "3.9.1",
"gulp-eslint": "3.0.1",
"gulp-header": "1.8.8",
"gulp-mocha": "3.0.1",
"express": "^4.17.1",
"glob": "^7.1.6",
"gulp": "^4.0.2",
"gulp-rename": "1.2.2",
"gulp-transform": "1.0.8",
"gulp-uglify": "2.0.0",
"gulp-transform": "^3.0.5",
"mocha": "^8.2.0",
"morgan": "1.7.0",
"run-sequence": "1.2.2",
"sinon": "1.17.6",
"vinyl-buffer": "1.0.0",
"vinyl-source-stream": "1.1.0"
"sinon": "1.17.6"
},
"engines": {
"node": ">=4"
},
"dependencies": {
"@babel/preset-env": "^7.12.1",
"eslint": "^7.12.0"
}
}

@ -25,7 +25,7 @@ app.get("/bundle.js", (req, res) => {
});
browserify(files)
.transform(babelify, { presets: "es2015", compact: false })
.transform(babelify, { presets: "env", compact: false })
.bundle()
.pipe(res);
});

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save