From d675de0b93509d026e2a847893bf1c1dd740e604 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 26 May 2019 11:38:48 -0700 Subject: [PATCH] ui project absolute, tweak demo build --- .vscode/tasks.json | 2 +- demo/client.ts | 6 +++++- demo/start.js | 9 +++++---- src/core/tsconfig.json | 2 +- src/ui/ColorManager.test.ts | 2 +- src/ui/ColorManager.ts | 2 +- src/ui/Lifecycle.ts | 2 +- src/ui/RenderDebouncer.ts | 2 +- src/ui/ScreenDprMonitor.ts | 2 +- src/ui/tsconfig.json | 7 ++++++- webpack.config.js | 3 ++- 11 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 2f752faf0..b0a8a68c7 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -36,7 +36,7 @@ }, { "label": "Start demo", - "dependsOn": ["npm: watch", "npm: start"], + "dependsOn": ["npm: watch", "npm: package", "npm: start"], "group": { "kind": "build", "isDefault": true diff --git a/demo/client.ts b/demo/client.ts index 30cf16ffa..9e83e8bc5 100644 --- a/demo/client.ts +++ b/demo/client.ts @@ -7,7 +7,11 @@ /// -import { Terminal } from '../lib/xterm'; +// 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'; diff --git a/demo/start.js b/demo/start.js index 9b647e5be..9240c3c0d 100644 --- a/demo/start.js +++ b/demo/start.js @@ -33,10 +33,11 @@ const clientConfig = { resolve: { modules: [path.resolve(__dirname, '..'), 'node_modules'], extensions: [ '.tsx', '.ts', '.js' ], - // alias: { - // common: path.resolve(__dirname, '../lib/common'), - // core: path.resolve(__dirname, '../lib/core') - // } + alias: { + common: path.resolve('./out/common'), + core: path.resolve('./out/core'), + ui: path.resolve('./out/ui') + } }, output: { filename: 'client-bundle.js', diff --git a/src/core/tsconfig.json b/src/core/tsconfig.json index 91480e24e..f0ee3fbb7 100644 --- a/src/core/tsconfig.json +++ b/src/core/tsconfig.json @@ -9,7 +9,7 @@ "paths": { "common/*": [ "./common/*" ], "core/*": [ "./core/*" ] - }, + } }, "include": [ "./**/*" ], "references": [ diff --git a/src/ui/ColorManager.test.ts b/src/ui/ColorManager.test.ts index 26fb28950..e4d790926 100644 --- a/src/ui/ColorManager.test.ts +++ b/src/ui/ColorManager.test.ts @@ -5,7 +5,7 @@ import jsdom = require('jsdom'); import { assert } from 'chai'; -import { ColorManager } from './ColorManager'; +import { ColorManager } from 'ui/ColorManager'; describe('ColorManager', () => { let cm: ColorManager; diff --git a/src/ui/ColorManager.ts b/src/ui/ColorManager.ts index 923b28234..f1fe5842c 100644 --- a/src/ui/ColorManager.ts +++ b/src/ui/ColorManager.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { IColorManager, IColor, IColorSet, ITheme } from './Types'; +import { IColorManager, IColor, IColorSet, ITheme } from 'ui/Types'; const DEFAULT_FOREGROUND = fromHex('#ffffff'); const DEFAULT_BACKGROUND = fromHex('#000000'); diff --git a/src/ui/Lifecycle.ts b/src/ui/Lifecycle.ts index 4d36a1f12..1344ea9bc 100644 --- a/src/ui/Lifecycle.ts +++ b/src/ui/Lifecycle.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { IDisposable } from '../common/Types'; +import { IDisposable } from 'common/Types'; /** * Adds a disposable listener to a node in the DOM, returning the disposable. diff --git a/src/ui/RenderDebouncer.ts b/src/ui/RenderDebouncer.ts index ee2ab16e7..27c866dfd 100644 --- a/src/ui/RenderDebouncer.ts +++ b/src/ui/RenderDebouncer.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { IDisposable } from '../common/Types'; +import { IDisposable } from 'common/Types'; /** * Debounces calls to render terminal rows using animation frames. diff --git a/src/ui/ScreenDprMonitor.ts b/src/ui/ScreenDprMonitor.ts index 37c6a0dab..ec8c6d8a5 100644 --- a/src/ui/ScreenDprMonitor.ts +++ b/src/ui/ScreenDprMonitor.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Disposable } from '../common/Lifecycle'; +import { Disposable } from 'common/Lifecycle'; export type ScreenDprListener = (newDevicePixelRatio?: number, oldDevicePixelRatio?: number) => void; diff --git a/src/ui/tsconfig.json b/src/ui/tsconfig.json index 404d56976..4e7a2a946 100644 --- a/src/ui/tsconfig.json +++ b/src/ui/tsconfig.json @@ -8,7 +8,12 @@ "outDir": "../../out", "types": [ "../../node_modules/@types/mocha" - ] + ], + "baseUrl": "..", + "paths": { + "common/*": [ "./common/*" ], + "ui/*": [ "./ui/*" ] + } }, "include": [ "./**/*" ], "references": [ diff --git a/webpack.config.js b/webpack.config.js index 543323c15..a27bdcb20 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -23,7 +23,8 @@ module.exports = { extensions: [ '.js' ], alias: { common: path.resolve('./out/common'), - core: path.resolve('./out/core') + core: path.resolve('./out/core'), + ui: path.resolve('./out/ui') } }, output: {