Skip to content

Commit

Permalink
Merge pull request #2132 from Tyriar/ts_wp
Browse files Browse the repository at this point in the history
Enable absolute imports and minify distributable
  • Loading branch information
Tyriar authored May 31, 2019
2 parents 0ed75dc + 5a6287c commit fad6e0f
Show file tree
Hide file tree
Showing 87 changed files with 703 additions and 3,456 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/
*.swp
.lock-wscript
lib/
out/
Makefile.gyp
*.Makefile
*.target.gyp.mk
Expand All @@ -16,10 +17,6 @@ build/
fixtures/typings-test/*.js
package-lock.json

# Directories needed for code coverage
coverage/
.nyc_output/

# Keep bundled code out of Git
dist/
demo/dist/
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,4 @@ docs/
bin/
build/
fixtures/
coverage/
demo/
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# [![xterm.js logo](logo-full.png)](https://xtermjs.org)

[![Build Status](https://dev.azure.com/xtermjs/xterm.js/_apis/build/status/xtermjs.xterm.js)](https://dev.azure.com/xtermjs/xterm.js/_build/latest?definitionId=3)
[![Coverage Status](https://coveralls.io/repos/github/xtermjs/xterm.js/badge.svg?branch=master)](https://coveralls.io/github/xtermjs/xterm.js?branch=master)

Xterm.js is a front-end component written in TypeScript that lets applications bring fully-featured terminals to their users in the browser. It's used by popular projects such as VS Code, Hyper and Theia.

Expand Down
13 changes: 4 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
yarn
displayName: 'Install dependencies and build'
- script: |
yarn mocha
yarn test-unit
displayName: 'Unit tests'
- script: |
yarn lint
Expand All @@ -38,16 +38,11 @@ jobs:
yarn
displayName: 'Install dependencies and build'
- script: |
yarn mocha
yarn test-unit
displayName: 'Unit tests'
- script: |
yarn lint
displayName: 'Lint'
- script: |
yarn test-coverage
export COVERALLS_GIT_BRANCH=$BUILD_SOURCEBRANCHNAME
yarn coveralls
displayName: 'Generate and publish coverage'
- job: Windows
pool:
Expand All @@ -61,12 +56,12 @@ jobs:
yarn
displayName: 'Install dependencies and build'
- script: |
yarn mocha
yarn test-unit
displayName: 'Unit tests'
- script: |
yarn lint
displayName: 'Lint'
- job: IntegrationTests
pool:
vmImage: 'ubuntu-16.04'
Expand Down
25 changes: 25 additions & 0 deletions bin/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/

const cp = require('child_process');
const path = require('path');

// Add `out` to the NODE_PATH so absolute paths can be resolved.
const env = { ...process.env };
env.NODE_PATH = path.resolve(__dirname, '../out');

const args = [
'./out/*test.js',
'./out/**/*test.js',
'./out/*integration.js',
'./out/**/*integration.js',
'./lib/**/*test.js'
];

cp.spawnSync(path.resolve(__dirname, '../node_modules/.bin/mocha'), args, {
cwd: path.resolve(__dirname, '..'),
env,
stdio: 'inherit'
});
File renamed without changes.
6 changes: 5 additions & 1 deletion demo/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

/// <reference path="../typings/xterm.d.ts"/>

import { Terminal } from '../lib/public/Terminal';
// Use tsc version (yarn watch)
import { Terminal } from '../out/public/Terminal';
// Use webpacked version (yarn package)
// import { Terminal } from '../lib/xterm';

import { AttachAddon } from 'xterm-addon-attach';
import { SearchAddon, ISearchOptions } from 'xterm-addon-search';
import { WebLinksAddon } from 'xterm-addon-web-links';
Expand Down
4 changes: 2 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<title>xterm.js demo</title>
<link rel="shortcut icon" type="image/png" href="/logo.png">
<link rel="stylesheet" href="/src/xterm.css" />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="/xterm.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/fetch/1.0.0/fetch.min.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion demo/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function startServer() {
var terminals = {},
logs = {};

app.use('/src', express.static(__dirname + '/../src'));
app.use('/xterm.css', express.static(__dirname + '/../css/xterm.css'));
app.get('/logo.png', (req, res) => res.sendFile(__dirname + '/logo.png'));

app.get('/', function(req, res){
Expand Down
21 changes: 19 additions & 2 deletions demo/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@ const startServer = require('./server.js');

startServer();

// Build/watch client source
/**
* This webpack config builds and watches the demo project. It works by taking the output from tsc
* (via `yarn watch`) which is put into `out/` and then webpacks it into `demo/dist/`. The aliases
* are used fix up the absolute paths output by tsc (because of `baseUrl` and `paths` in
* `tsconfig.json`.
*
* For production builds see `webpack.config.js` in the root directory. If that is built the demo
* can use that by switching out which `Terminal` is imported in `client.ts`, this is useful for
* validating that the packaged version works correctly.
*
* The addons are not webpacked right now and are built directly to `lib/` via `tsc` as they are
* the legacy format (`applyAddon`) and will be removed soon anyway.
*/
const clientConfig = {
entry: path.resolve(__dirname, 'client.ts'),
devtool: 'inline-source-map',
Expand All @@ -32,7 +44,12 @@ const clientConfig = {
},
resolve: {
modules: [path.resolve(__dirname, '..'), 'node_modules'],
extensions: [ '.tsx', '.ts', '.js' ]
extensions: [ '.tsx', '.ts', '.js' ],
alias: {
common: path.resolve('./out/common'),
core: path.resolve('./out/core'),
ui: path.resolve('./out/ui')
}
},
output: {
filename: 'client-bundle.js',
Expand Down
141 changes: 0 additions & 141 deletions gulpfile.js

This file was deleted.

40 changes: 12 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "xterm",
"description": "Full xterm terminal, in your browser",
"version": "3.14.0",
"main": "lib/public/Terminal.js",
"main": "lib/xterm.js",
"types": "typings/xterm.d.ts",
"repository": "https://github.com/xtermjs/xterm.js",
"license": "MIT",
Expand All @@ -15,59 +15,43 @@
"@types/puppeteer": "^1.12.4",
"@types/utf8": "^2.1.6",
"@types/webpack": "^4.4.11",
"browserify": "^13.3.0",
"chai": "3.5.0",
"coveralls": "^3.0.1",
"express": "4.13.4",
"express-ws": "2.0.0-rc.1",
"fs-extra": "^1.0.0",
"glob": "^7.0.5",
"gulp": "3.9.1",
"gulp-cli": "^1.2.2",
"gulp-concat": "^2.6.1",
"gulp-mocha": "^3.0.1",
"gulp-sourcemaps": "1.9.1",
"gulp-typescript": "^3.1.3",
"gulp-util": "3.0.8",
"jsdom": "^11.11.0",
"merge-stream": "^1.0.1",
"node-pty": "0.7.6",
"nodemon": "1.10.2",
"nyc": "^11.8.0",
"puppeteer": "^1.15.0",
"sorcery": "^0.10.0",
"source-map-loader": "^0.2.4",
"ts-loader": "^4.5.0",
"tslint": "^5.9.1",
"tslint-consistent-codestyle": "^1.13.0",
"typescript": "3.5",
"utf8": "^3.0.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0",
"xterm-addon-attach": "0.1.0-beta8",
"xterm-addon-search": "0.1.0-beta4",
"xterm-addon-web-links": "0.1.0-beta6",
"zmodem.js": "^0.1.5"
"xterm-addon-web-links": "0.1.0-beta6"
},
"scripts": {
"prepackage": "npm run build",
"package": "webpack",
"start": "node demo/start",
"start-debug": "node --inspect-brk demo/start",
"start-zmodem": "node demo/zmodem/app",
"lint": "tslint 'src/**/*.ts' './demo/**/*.ts'",
"test": "npm run mocha",
"test-unit": "node ./bin/test.js",
"test": "npm run test-unit",
"posttest": "npm run lint",
"test-debug": "node --inspect-brk node_modules/.bin/gulp test",
"test-suite": "gulp mocha-suite --test",
"test-coverage": "nyc -x gulpfile.js -x '**/*test*' npm run mocha",
"test-api": "mocha \"**/*.api.js\"",
"mocha": "gulp test",
"prebuild": "tsc -b ./src/tsconfig.all.json",
"build": "gulp build",
"prepare": "npm run prebuild",
"prepublishOnly": "npm run build",
"build": "tsc -b ./src/tsconfig.all.json",
"prepare": "npm run build",
"prepublishOnly": "npm run package",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"watch": "tsc -b -w ./src/tsconfig.all.json --preserveWatchOutput"
},
"dependencies": {
"mocha": "^6.1.4"
}
}
Loading

0 comments on commit fad6e0f

Please sign in to comment.