pegjs/spec/server
David Majda c134e06229 Move "use strict" directives up
Move "use strict" directives to the first line of each file. In
particular, move them above any ESLint comments, which are far less
important.

There are few exceptions:

  Executable files

    In these, the "use strict" directive must give way to the shebang.

  lib/parser.js

    Here, the "Generated by..." comment comes first. Also, ESLint
    comments are prepended in post-processing.
2016-09-22 16:43:42 +02:00

38 lines
862 B
JavaScript
Executable file

#!/usr/bin/env node
"use strict";
/* eslint-env node */
/* eslint no-console: 0 */
// Small server whose main purpose is to ensure that both the specced code and
// the specs get passed through Babel & Browserify before they are served to the
// browser.
let express = require("express");
let logger = require("morgan");
let glob = require("glob");
let browserify = require("browserify");
let babelify = require("babelify");
let app = express();
app.use(logger("dev"));
app.use(express.static(__dirname));
app.get("/bundle.js", (req, res) => {
let files = glob.sync(__dirname + "/**/*.js", {
ignore: __dirname + "/vendor/**/*"
});
browserify(files)
.transform(babelify, { presets: "es2015", compact: false })
.bundle()
.pipe(res);
});
app.listen(8000, () => {
console.log("Spec server running at http://localhost:8000...");
});