08bbd6d5b6
It seem's kind of pointless setting the comment "/* eslint-env node */" at the top of only some JavaScript files when nearly all of them are Node.js releated, so I moved this option to the root level config, only leaving the 'lib' folder as "/* eslint-env commonjs */"
33 lines
756 B
JavaScript
33 lines
756 B
JavaScript
#!/usr/bin/env node
|
|
|
|
"use strict";
|
|
|
|
let babelify = require("babelify");
|
|
let browserify = require("browserify");
|
|
let express = require("express");
|
|
let glob = require("glob");
|
|
let logger = require("morgan");
|
|
|
|
let app = express();
|
|
|
|
app.use(logger("dev"));
|
|
app.use(express.static(__dirname));
|
|
app.use("/benchmark", express.static(`${__dirname}/../benchmark`));
|
|
app.use("/examples", express.static(`${__dirname}/../../examples`));
|
|
|
|
app.get("/:dir/bundle.js", (req, res) => {
|
|
browserify(glob.sync(
|
|
`${__dirname}/../${req.params.dir}/**/*.js`
|
|
))
|
|
.transform(babelify, {
|
|
presets: "es2015",
|
|
compact: false
|
|
})
|
|
.bundle()
|
|
.pipe(res);
|
|
});
|
|
|
|
app.listen(8000, () => {
|
|
console.log("Test server running at: http://localhost:8000/");
|
|
});
|