Update demo to use Webpack
This commit is contained in:
@@ -23,3 +23,6 @@ fixtures/typings-test/*.js
|
|||||||
dist/
|
dist/
|
||||||
src/utils/TestUtils.ts
|
src/utils/TestUtils.ts
|
||||||
src/xterm.js
|
src/xterm.js
|
||||||
|
|
||||||
|
# Keep the demo builds out of Git
|
||||||
|
demo/dist/
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
FROM node:6.9
|
FROM node:6
|
||||||
MAINTAINER Paris Kasidiaris <paris@sourcelair.com>
|
MAINTAINER Paris Kasidiaris <paris@sourcelair.com>
|
||||||
|
|
||||||
# Set the working directory
|
# Set the working directory
|
||||||
@@ -6,7 +6,7 @@ WORKDIR /usr/src/app
|
|||||||
|
|
||||||
# Set an entrypoint, to automatically install node modules
|
# Set an entrypoint, to automatically install node modules
|
||||||
ENTRYPOINT ["/bin/bash", "-c", "if [[ ! -d node_modules ]]; then npm install; fi; exec \"${@:0}\";"]
|
ENTRYPOINT ["/bin/bash", "-c", "if [[ ! -d node_modules ]]; then npm install; fi; exec \"${@:0}\";"]
|
||||||
CMD ["npm", "run", "dev"]
|
CMD ["npm", "run", "start"]
|
||||||
|
|
||||||
# First, install dependencies to improve layer caching
|
# First, install dependencies to improve layer caching
|
||||||
COPY package.json /usr/src/app/
|
COPY package.json /usr/src/app/
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
web: npm run dev
|
|
||||||
+6
-2
@@ -17,8 +17,12 @@ app.get('/style.css', function(req, res){
|
|||||||
res.sendFile(__dirname + '/style.css');
|
res.sendFile(__dirname + '/style.css');
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/main.js', function(req, res){
|
app.get('/dist/bundle.js', function(req, res){
|
||||||
res.sendFile(__dirname + '/main.js');
|
res.sendFile(__dirname + '/dist/bundle.js');
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/dist/bundle.js.map', function(req, res){
|
||||||
|
res.sendFile(__dirname + '/dist/bundle.js.map');
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/terminals', function (req, res) {
|
app.post('/terminals', function (req, res) {
|
||||||
|
|||||||
+1
-7
@@ -7,12 +7,6 @@
|
|||||||
<link rel="stylesheet" href="style.css" />
|
<link rel="stylesheet" href="style.css" />
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.auto.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.auto.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script>
|
||||||
<script src="/build/xterm.js" ></script>
|
|
||||||
<script src="/build/addons/attach/attach.js" ></script>
|
|
||||||
<script src="/build/addons/fit/fit.js" ></script>
|
|
||||||
<script src="/build/addons/fullscreen/fullscreen.js" ></script>
|
|
||||||
<script src="/build/addons/search/search.js" ></script>
|
|
||||||
<script src="/build/addons/winptyCompat/winptyCompat.js" ></script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>xterm.js: xterm, in the browser</h1>
|
<h1>xterm.js: xterm, in the browser</h1>
|
||||||
@@ -71,6 +65,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p><strong>Attention:</strong> The demo is a barebones implementation and is designed for xterm.js evaluation purposes only. Exposing the demo to the public as is would introduce security risks for the host.</p>
|
<p><strong>Attention:</strong> The demo is a barebones implementation and is designed for xterm.js evaluation purposes only. Exposing the demo to the public as is would introduce security risks for the host.</p>
|
||||||
<script src="main.js" defer ></script>
|
<script src="dist/bundle.js" defer ></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
import * as Terminal from '../build/xterm';
|
||||||
|
import * as attach from '../build/addons/attach/attach';
|
||||||
|
import * as fit from '../build/addons/fit/fit';
|
||||||
|
import * as fullscreen from '../build/addons/fullscreen/fullscreen';
|
||||||
|
import * as search from '../build/addons/search/search';
|
||||||
|
import * as winptyCompat from '../build/addons/winptyCompat/winptyCompat';
|
||||||
|
|
||||||
|
|
||||||
|
Terminal.applyAddon(attach);
|
||||||
|
Terminal.applyAddon(fit);
|
||||||
|
Terminal.applyAddon(fullscreen);
|
||||||
|
Terminal.applyAddon(search);
|
||||||
|
Terminal.applyAddon(winptyCompat);
|
||||||
|
|
||||||
|
|
||||||
var term,
|
var term,
|
||||||
protocol,
|
protocol,
|
||||||
socketURL,
|
socketURL,
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
version: '2'
|
|
||||||
|
|
||||||
services:
|
|
||||||
web:
|
|
||||||
build: ./
|
|
||||||
volumes:
|
|
||||||
- ./:/usr/src/app
|
|
||||||
ports:
|
|
||||||
- 3000:3000
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
volumes:
|
||||||
|
- ./:/usr/src/app
|
||||||
|
ports:
|
||||||
|
- ${XTERMJS_PORT:3000}:3000
|
||||||
+8
-4
@@ -16,6 +16,7 @@ const source = require('vinyl-source-stream');
|
|||||||
const sourcemaps = require('gulp-sourcemaps');
|
const sourcemaps = require('gulp-sourcemaps');
|
||||||
const ts = require('gulp-typescript');
|
const ts = require('gulp-typescript');
|
||||||
const util = require('gulp-util');
|
const util = require('gulp-util');
|
||||||
|
const webpack = require('webpack-stream');
|
||||||
|
|
||||||
let buildDir = process.env.BUILD_DIR || 'build';
|
let buildDir = process.env.BUILD_DIR || 'build';
|
||||||
let tsProject = ts.createProject('tsconfig.json');
|
let tsProject = ts.createProject('tsconfig.json');
|
||||||
@@ -137,10 +138,7 @@ gulp.task('browserify-addons', ['tsc'], function() {
|
|||||||
// Copy all add-ons from outDir to buildDir
|
// Copy all add-ons from outDir to buildDir
|
||||||
let copyAddons = gulp.src([
|
let copyAddons = gulp.src([
|
||||||
// Copy JS addons
|
// Copy JS addons
|
||||||
`${outDir}/addons/**/*`,
|
`${outDir}/addons/**/*`
|
||||||
// Exclude TS addons from copy as they are being built via browserify
|
|
||||||
`!${outDir}/addons/search`,
|
|
||||||
`!${outDir}/addons/search/**`,
|
|
||||||
]).pipe(gulp.dest(`${buildDir}/addons`));
|
]).pipe(gulp.dest(`${buildDir}/addons`));
|
||||||
|
|
||||||
return merge(searchBundle, winptyCompatBundle, copyAddons);
|
return merge(searchBundle, winptyCompatBundle, copyAddons);
|
||||||
@@ -196,6 +194,12 @@ gulp.task('sorcery-addons', ['browserify-addons'], function () {
|
|||||||
chain.writeSync();
|
chain.writeSync();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('webpack', ['build'], function() {
|
||||||
|
return gulp.src('demo/main.js')
|
||||||
|
.pipe(webpack())
|
||||||
|
.pipe(gulp.dest('demo/dist/'));
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit coverage results to coveralls.io
|
* Submit coverage results to coveralls.io
|
||||||
*/
|
*/
|
||||||
|
|||||||
+5
-3
@@ -69,20 +69,22 @@
|
|||||||
"typescript": "~2.4.0",
|
"typescript": "~2.4.0",
|
||||||
"vinyl-buffer": "^1.0.0",
|
"vinyl-buffer": "^1.0.0",
|
||||||
"vinyl-source-stream": "^1.1.0",
|
"vinyl-source-stream": "^1.1.0",
|
||||||
|
"webpack": "^3.10.0",
|
||||||
|
"webpack-stream": "^4.0.0",
|
||||||
"zmodem.js": "^0.1.5"
|
"zmodem.js": "^0.1.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prestart": "npm run build",
|
"prestart": "gulp webpack",
|
||||||
"start": "node demo/app",
|
"start": "node demo/app",
|
||||||
"prestart-zmodem": "npm run build",
|
"prestart-zmodem": "npm run build",
|
||||||
"start-zmodem": "node build/addons/zmodem/demo/app",
|
"start-zmodem": "node build/addons/zmodem/demo/app",
|
||||||
"dev": "nodemon -e js,ts,css --watch src --watch demo --exec npm start",
|
|
||||||
"lint": "tslint src/*.ts src/**/*.ts",
|
"lint": "tslint src/*.ts src/**/*.ts",
|
||||||
"test": "gulp test",
|
"test": "gulp test",
|
||||||
"build:docs": "jsdoc -c jsdoc.json",
|
"build:docs": "jsdoc -c jsdoc.json",
|
||||||
"build": "gulp build",
|
"build": "gulp build",
|
||||||
"prepublish": "npm run build",
|
"prepublish": "npm run build",
|
||||||
"coveralls": "gulp coveralls"
|
"coveralls": "gulp coveralls",
|
||||||
|
"webpack": "webpack"
|
||||||
},
|
},
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { SearchHelper } from './SearchHelper';
|
|||||||
* @param term Tne search term.
|
* @param term Tne search term.
|
||||||
* @return Whether a result was found.
|
* @return Whether a result was found.
|
||||||
*/
|
*/
|
||||||
function findNext(terminal: any, term: string): boolean {
|
export function findNext(terminal: any, term: string): boolean {
|
||||||
if (!terminal._searchHelper) {
|
if (!terminal._searchHelper) {
|
||||||
terminal.searchHelper = new SearchHelper(terminal);
|
terminal.searchHelper = new SearchHelper(terminal);
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,7 @@ function findNext(terminal: any, term: string): boolean {
|
|||||||
* @param term Tne search term.
|
* @param term Tne search term.
|
||||||
* @return Whether a result was found.
|
* @return Whether a result was found.
|
||||||
*/
|
*/
|
||||||
function findPrevious(terminal: any, term: string): boolean {
|
export function findPrevious(terminal: any, term: string): boolean {
|
||||||
if (!terminal._searchHelper) {
|
if (!terminal._searchHelper) {
|
||||||
terminal.searchHelper = new SearchHelper(terminal);
|
terminal.searchHelper = new SearchHelper(terminal);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: './demo/main.js',
|
||||||
|
output: {
|
||||||
|
path: path.resolve(__dirname, 'demo/dist'),
|
||||||
|
filename: 'bundle.js'
|
||||||
|
},
|
||||||
|
devtool: 'source-map'
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user