mirror of
https://git.proxmox.com/git/mirror_xterm.js
synced 2025-10-04 15:37:19 +00:00
Refactor TS build and fix testing
This change is largely just moving files with minor tweaks to them to fix, the rest of the commit is build process changes: - The addons/ and test/ dirs have been moved to src/ - The build directory has been removed - TypeScript builds are output in out/, this is where tests are run - The demo now relies on the dist/ build which is performed as part of ./bin/build - Addons are now shipped under the ./build directory
This commit is contained in:
parent
a995b610cf
commit
56ecc77dfc
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,5 @@
|
||||
node_modules/
|
||||
*.swp
|
||||
build/*
|
||||
.lock-wscript
|
||||
out/
|
||||
Makefile.gyp
|
||||
@ -12,3 +11,4 @@ docs/
|
||||
npm-debug.log
|
||||
/.idea/
|
||||
.env
|
||||
dist/*
|
||||
|
20
bin/build
20
bin/build
@ -1,5 +1,17 @@
|
||||
#! /usr/bin/env sh
|
||||
#! /usr/bin/env bash
|
||||
|
||||
mkdir -p build
|
||||
browserify src/xterm.js --standalone Terminal -p [ tsify ] --outfile build/xterm.js
|
||||
cp src/xterm.css build/xterm.css
|
||||
# Build all TypeScript files (including tests) to out/
|
||||
tsc
|
||||
|
||||
# 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
|
||||
|
||||
# Copy all CSS files from src/ to dist/
|
||||
cd src
|
||||
find . -name '*.css' | cpio -pdm ../dist
|
||||
cd ..
|
||||
|
||||
# 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');
|
||||
|
@ -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>
|
||||
|
@ -26,8 +26,8 @@
|
||||
"typescript": "^2.0.3"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "nodemon --watch src --watch addons --exec bash -c './bin/build && node demo/app'",
|
||||
"test": "./bin/build && mocha --recursive ./test/*test.js ./test/**/*test.js",
|
||||
"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
|
@ -1,5 +1,5 @@
|
||||
var assert = require('chai').assert;
|
||||
var Terminal = require('../../dist/xterm');
|
||||
var Terminal = require('../../xterm');
|
||||
var linkify = require('../../addons/linkify/linkify');
|
||||
|
||||
describe('linkify addon', function () {
|
@ -1,11 +1,10 @@
|
||||
var assert = require('chai').assert;
|
||||
var Terminal = require('../../src/xterm');
|
||||
var distTerminal = require('../../dist/xterm');
|
||||
var Terminal = require('../../xterm');
|
||||
|
||||
describe('xterm.js addons', function() {
|
||||
it('should load addons with Terminal.loadAddon', function () {
|
||||
Terminal.loadAddon('attach');
|
||||
// Test that addon was loaded successfully
|
||||
assert.equal(typeof distTerminal.prototype.attach, 'function');
|
||||
assert.equal(typeof Terminal.prototype.attach, 'function');
|
||||
});
|
||||
});
|
@ -1,6 +1,6 @@
|
||||
var assert = require('chai').assert;
|
||||
var Terminal = require('../src/xterm');
|
||||
var Clipboard = require('../src/handlers/Clipboard');
|
||||
var Terminal = require('../xterm');
|
||||
var Clipboard = require('../handlers/Clipboard');
|
||||
|
||||
|
||||
describe('evaluateCopiedTextProcessing', function () {
|
@ -1,5 +1,5 @@
|
||||
var assert = require('chai').assert;
|
||||
var Terminal = require('../build/xterm');
|
||||
var Terminal = require('../xterm');
|
||||
|
||||
describe('CompositionHelper', function () {
|
||||
var terminal;
|
@ -2,7 +2,7 @@ var glob = require('glob');
|
||||
var fs = require('fs');
|
||||
var pty = require('pty.js');
|
||||
var sleep = require('sleep');
|
||||
var Terminal = require('../build/xterm');
|
||||
var Terminal = require('../xterm');
|
||||
|
||||
var CONSOLE_LOG = console.log;
|
||||
|
||||
@ -80,9 +80,10 @@ describe('xterm output comparison', function() {
|
||||
|
||||
// omit stack trace for escape sequence files
|
||||
Error.stackTraceLimit = 0;
|
||||
var files = glob.sync('test/escape_sequence_files/*.in');
|
||||
var files = glob.sync('**/escape_sequence_files/*.in');
|
||||
// only successful tests for now
|
||||
var successful = [0, 2, 6, 12, 13, 18, 20, 22, 27, 28];
|
||||
console.log(files);
|
||||
for (var a in successful) {
|
||||
var i = successful[a];
|
||||
(function(filename){
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user