mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Merge pull request #296 from Tyriar/typescript_build_2
Move to TypeScript build
This commit is contained in:
+1
-1
@@ -1,6 +1,5 @@
|
||||
node_modules/
|
||||
*.swp
|
||||
build/*
|
||||
.lock-wscript
|
||||
out/
|
||||
Makefile.gyp
|
||||
@@ -12,3 +11,4 @@ docs/
|
||||
npm-debug.log
|
||||
/.idea/
|
||||
.env
|
||||
dist/*
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 4
|
||||
- 6
|
||||
env:
|
||||
- CXX=g++-4.8
|
||||
addons:
|
||||
|
||||
@@ -1,38 +1,17 @@
|
||||
#! /usr/bin/env node
|
||||
#! /usr/bin/env bash
|
||||
|
||||
var child_process = require('child_process');
|
||||
var fs = require('fs');
|
||||
# Build all TypeScript files (including tests) to out/
|
||||
tsc
|
||||
|
||||
var buildDir = process.env.BUILD_DIR || 'build';
|
||||
# Concat all xterm.js files into a single file and output as a UMD to dist/xterm.js
|
||||
browserify out/xterm.js --standalone Terminal -p [ tsify ] --outfile dist/xterm.js
|
||||
|
||||
if (!fs.existsSync(buildDir)){
|
||||
fs.mkdirSync(buildDir);
|
||||
}
|
||||
# Copy all CSS files from src/ to dist/
|
||||
cd src
|
||||
find . -name '*.css' | cpio -pdm ../dist
|
||||
cd ..
|
||||
|
||||
// Add `node_modules/.bin` to PATH
|
||||
process.env.PATH = process.cwd() + '/node_modules/.bin:' + process.env.PATH;
|
||||
|
||||
console.log('Building xterm.js into ' + buildDir);
|
||||
|
||||
// Build ES2015 modules into ES5 form, then concatenate them,
|
||||
// then remove unused require calls and save in output file with source map.
|
||||
console.log(' - Building ' + buildDir + '/xterm.js...');
|
||||
|
||||
var jsBuildCmd = 'browserify src/xterm.js -s Terminal -t [ babelify --presets [ es2015 ] ] --debug | ';
|
||||
jsBuildCmd += 'derequire | exorcist ' + buildDir + '/xterm.js.map > ' + buildDir + '/xterm.js';
|
||||
|
||||
var jsBuildProcess = child_process.execSync(jsBuildCmd);
|
||||
|
||||
if (jsBuildProcess.status) {
|
||||
console.log(jsBuildProcess.error);
|
||||
}
|
||||
|
||||
console.log(' OK.');
|
||||
|
||||
// Copy CSS into $BUILD_DIR
|
||||
console.log(' - Building ' + buildDir + '/xterm.css...');
|
||||
|
||||
fs.createReadStream('src/xterm.css').pipe(
|
||||
fs.createWriteStream(buildDir + '/xterm.css')
|
||||
);
|
||||
console.log(' OK.');
|
||||
# Copy addons from out/ to dist/
|
||||
cd out/addons
|
||||
find . -name '*.js' | cpio -pdm ../../dist/addons
|
||||
cd ../..
|
||||
|
||||
@@ -8,7 +8,6 @@ var terminals = {},
|
||||
logs = {};
|
||||
|
||||
app.use('/build', express.static(__dirname + '/../build'));
|
||||
app.use('/addons', express.static(__dirname + '/../addons'));
|
||||
|
||||
app.get('/', function(req, res){
|
||||
res.sendFile(__dirname + '/index.html');
|
||||
|
||||
+5
-5
@@ -3,13 +3,13 @@
|
||||
<head>
|
||||
<title>xterm.js demo</title>
|
||||
<link rel="stylesheet" href="../build/xterm.css" />
|
||||
<link rel="stylesheet" href="../addons/fullscreen/fullscreen.css" />
|
||||
<link rel="stylesheet" href="../build/addons/fullscreen/fullscreen.css" />
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script>
|
||||
<script src="../build/xterm.js" ></script>
|
||||
<script src="../addons/attach/attach.js" ></script>
|
||||
<script src="../addons/fit/fit.js" ></script>
|
||||
<script src="../addons/fullscreen/fullscreen.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>
|
||||
</head>
|
||||
<body>
|
||||
<h1>xterm.js: xterm, in the browser</h1>
|
||||
|
||||
+6
-8
@@ -10,14 +10,10 @@
|
||||
"repository": "https://github.com/sourcelair/xterm.js",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"babel-core": "6.14.0",
|
||||
"babel-preset-es2015": "6.14.0",
|
||||
"babelify": "^7.3.0",
|
||||
"@types/node": "^6.0.41",
|
||||
"browserify": "^13.1.0",
|
||||
"chai": "3.5.0",
|
||||
"derequire": "^2.0.3",
|
||||
"docdash": "0.4.0",
|
||||
"exorcist": "^0.4.0",
|
||||
"express": "4.13.4",
|
||||
"express-ws": "2.0.0-rc.1",
|
||||
"glob": "^7.0.5",
|
||||
@@ -25,11 +21,13 @@
|
||||
"mocha": "2.5.3",
|
||||
"nodemon": "1.10.2",
|
||||
"pty.js": "0.3.1",
|
||||
"sleep": "^3.0.1"
|
||||
"sleep": "^3.0.1",
|
||||
"tsify": "^1.0.7",
|
||||
"typescript": "^2.0.3"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "nodemon --watch src --watch addons --exec bash -c './bin/build && node demo/app'",
|
||||
"test": "mocha --recursive --compilers js:babel-core/register",
|
||||
"start": "nodemon --watch src --watch addons --watch demo --exec bash -c './bin/build && node demo/app'",
|
||||
"test": "./bin/build && mocha --recursive ./out",
|
||||
"build:docs": "jsdoc -c jsdoc.json",
|
||||
"build": "./bin/build"
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
/*
|
||||
* CommonJS environment
|
||||
*/
|
||||
module.exports = attach(require('../../dist/xterm'));
|
||||
module.exports = attach(require('../../xterm'));
|
||||
} else if (typeof define == 'function') {
|
||||
/*
|
||||
* Require.js is available
|
||||
*/
|
||||
define(['../../dist/xterm'], attach);
|
||||
define(['../../xterm'], attach);
|
||||
} else {
|
||||
/*
|
||||
* Plain browser environment
|
||||
@@ -16,12 +16,12 @@
|
||||
/*
|
||||
* CommonJS environment
|
||||
*/
|
||||
module.exports = fit(require('../../dist/xterm'));
|
||||
module.exports = fit(require('../../xterm'));
|
||||
} else if (typeof define == 'function') {
|
||||
/*
|
||||
* Require.js is available
|
||||
*/
|
||||
define(['../../dist/xterm'], fit);
|
||||
define(['../../xterm'], fit);
|
||||
} else {
|
||||
/*
|
||||
* Plain browser environment
|
||||
@@ -15,12 +15,12 @@
|
||||
/*
|
||||
* CommonJS environment
|
||||
*/
|
||||
module.exports = fullscreen(require('../../dist/xterm'));
|
||||
module.exports = fullscreen(require('../../xterm'));
|
||||
} else if (typeof define == 'function') {
|
||||
/*
|
||||
* Require.js is available
|
||||
*/
|
||||
define(['../../dist/xterm'], fullscreen);
|
||||
define(['../../xterm'], fullscreen);
|
||||
} else {
|
||||
/*
|
||||
* Plain browser environment
|
||||
@@ -3,12 +3,12 @@
|
||||
/*
|
||||
* CommonJS environment
|
||||
*/
|
||||
module.exports = linkify(require('../../dist/xterm'));
|
||||
module.exports = linkify(require('../../xterm'));
|
||||
} else if (typeof define == 'function') {
|
||||
/*
|
||||
* Require.js is available
|
||||
*/
|
||||
define(['../../dist/xterm'], linkify);
|
||||
define(['../../xterm'], linkify);
|
||||
} else {
|
||||
/*
|
||||
* Plain browser environment
|
||||
@@ -11,12 +11,12 @@
|
||||
/*
|
||||
* CommonJS environment
|
||||
*/
|
||||
module.exports = attach(require('../../src/xterm'));
|
||||
module.exports = attach(require('../../xterm'));
|
||||
} else if (typeof define == 'function') {
|
||||
/*
|
||||
* Require.js is available
|
||||
*/
|
||||
define(['../../src/xterm'], attach);
|
||||
define(['../../xterm'], attach);
|
||||
} else {
|
||||
/*
|
||||
* Plain browser environment
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user