diff --git a/demo/main.js b/demo/client.js similarity index 100% rename from demo/main.js rename to demo/client.js diff --git a/demo/index.html b/demo/index.html index fff77d09..62ddfcee 100644 --- a/demo/index.html +++ b/demo/index.html @@ -33,6 +33,6 @@

Attention: The demo is a barebones implementation and is designed for the development and evaluation of xterm.js only. Exposing the demo to the public as is would introduce security risks for the host.

- + diff --git a/demo/app.js b/demo/server.js similarity index 91% rename from demo/app.js rename to demo/server.js index 7604e9cd..0aa9deef 100644 --- a/demo/app.js +++ b/demo/server.js @@ -17,12 +17,8 @@ app.get('/style.css', function(req, res){ res.sendFile(__dirname + '/style.css'); }); -app.get('/dist/bundle.js', function(req, res){ - res.sendFile(__dirname + '/dist/bundle.js'); -}); - -app.get('/dist/bundle.js.map', function(req, res){ - res.sendFile(__dirname + '/dist/bundle.js.map'); +app.get('/dist/client-bundle.js', function(req, res){ + res.sendFile(__dirname + '/dist/client-bundle.js'); }); app.post('/terminals', function (req, res) { diff --git a/demo/start.js b/demo/start.js new file mode 100644 index 00000000..018eb985 --- /dev/null +++ b/demo/start.js @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2018 The xterm.js authors. All rights reserved. + * @license MIT + * + * This file is the entry point for browserify. + */ + +const cp = require('child_process'); +const path = require('path'); +const webpack = require('webpack'); + +// Launch server +cp.spawn('node', [path.resolve(__dirname, 'server.js')], { stdio: 'inherit' }); + +// Build/watch client source +const clientConfig = { + entry: path.resolve(__dirname, 'client.js'), + devtool: 'inline-source-map', + output: { + filename: 'client-bundle.js', + path: path.resolve(__dirname, 'dist') + }, + mode: 'development', + watch: true +}; +const compiler = webpack(clientConfig); + +compiler.watch({ + // Example watchOptions + aggregateTimeout: 300, + poll: undefined +}, (err, stats) => { + // Print watch/build result here... + console.log(stats.toString({ + colors: true + })); +}); diff --git a/demo/tsconfig.json b/demo/tsconfig.json new file mode 100644 index 00000000..8e72b6dd --- /dev/null +++ b/demo/tsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "rootDir": ".", + "sourceMap": true + }, +}