You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
855 B

#!/usr/bin/env node
"use strict";
const babelify = require( "babelify" );
const browserify = require( "browserify" );
const express = require( "express" );
const glob = require( "glob" );
const logger = require( "morgan" );
const 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: "env",
compact: false
} )
.bundle()
.pipe( res );
} );
app.listen( 8000, () => {
console.log( "Test server running at: http://localhost:8000/" );
} );