pegjs/gulpfile.js

57 lines
1.1 KiB
JavaScript
Raw Normal View History

"use strict";
2018-10-05 21:32:11 +02:00
const { run } = require( "@futagoza/child-process" );
const { series, src, task } = require( "@futagoza/gulpx" );
const eslint = require( "gulp-eslint" );
const del = require( "del" );
// Run ESLint on all JavaScript files.
2018-10-05 21:32:11 +02:00
task( "lint", () => [
2018-03-23 03:00:03 +01:00
src( [
"**/.*rc.js",
"packages/**/*.js",
"test/benchmark/**/*.js",
"test/benchmark/run",
"test/impact",
"test/spec/**/*.js",
"src/*.js",
2018-09-10 05:57:12 +02:00
"rollup.config.js",
2018-09-06 06:52:02 +02:00
"gulpfile.js",
"server.js",
2018-03-23 03:00:03 +01:00
] ),
eslint( { dotfiles: true } ),
eslint.format(),
2018-10-05 21:32:11 +02:00
eslint.failAfterError(),
2018-03-23 03:00:03 +01:00
2018-10-05 21:32:11 +02:00
] );
// Run tests.
2018-10-05 21:32:11 +02:00
task( "test", () =>
2018-03-23 03:00:03 +01:00
2018-10-05 21:32:11 +02:00
run( "node node_modules/mocha/bin/mocha test/spec/**/*.spec.js" )
2018-03-23 03:00:03 +01:00
2018-10-05 21:32:11 +02:00
);
// Run benchmarks.
2018-10-05 21:32:11 +02:00
task( "benchmark", () =>
2018-10-05 21:32:11 +02:00
run( "node test/benchmark/run" )
2018-10-05 21:32:11 +02:00
);
// Generate the grammar parser.
2018-10-05 21:32:11 +02:00
task( "build:parser", () =>
2018-10-05 21:32:11 +02:00
run( "node packages/pegjs/bin/peg -c src/pegjs.config.js" )
2018-10-05 21:32:11 +02:00
);
// Delete the generated files.
task( "clean", () =>
2018-09-10 05:57:12 +02:00
del( [ "packages/pegjs/dist", "website/js/*-bundle.js", "examples/*.js" ] )
);
// Default task.
2018-03-23 03:00:03 +01:00
task( "default", series( "lint", "test" ) );