From 39bbe549920170b94a7df8d99a773008c960726a Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Thu, 6 Jun 2019 13:45:15 +0200 Subject: [PATCH] refactoring, build fix --- .gitignore | 2 + .travis.yml | 1 + appveyor.yml | 1 + package.json | 1 + terminus-community-color-schemes/package.json | 2 +- .../tsconfig.json | 3 +- terminus-core/package.json | 2 +- .../src/components/baseTab.component.ts | 2 +- terminus-core/src/services/app.service.ts | 2 +- terminus-core/tsconfig.json | 1 - terminus-core/tsconfig.typings.json | 14 +++ terminus-plugin-manager/package.json | 2 +- terminus-plugin-manager/tsconfig.json | 1 - terminus-plugin-manager/tsconfig.typings.json | 14 +++ terminus-settings/package.json | 2 +- terminus-settings/tsconfig.json | 1 - terminus-settings/tsconfig.typings.json | 14 +++ terminus-ssh/package.json | 2 +- .../src/components/sshTab.component.ts | 2 +- terminus-ssh/tsconfig.json | 9 +- terminus-ssh/tsconfig.typings.json | 15 +++ terminus-terminal/package.json | 2 +- terminus-terminal/src/api.ts | 93 ------------------- .../baseTerminalTab.component.ts | 28 +++--- .../src/api/colorSchemeProvider.ts | 8 ++ .../src/api/contextMenuProvider.ts | 10 ++ terminus-terminal/src/api/decorator.ts | 16 ++++ terminus-terminal/src/api/interfaces.ts | 54 +++++++++++ terminus-terminal/src/api/shellProvider.ts | 8 ++ terminus-terminal/src/colorSchemes.ts | 3 +- .../appearanceSettingsTab.component.ts | 3 +- .../components/editProfileModal.component.ts | 2 +- .../components/shellSettingsTab.component.ts | 2 +- .../src/components/terminalTab.component.ts | 4 +- terminus-terminal/src/contextMenu.ts | 4 +- terminus-terminal/src/frontends/frontend.ts | 2 +- terminus-terminal/src/index.ts | 11 ++- terminus-terminal/src/pathDrop.ts | 2 +- .../src/services/sessions.service.ts | 2 +- .../src/services/terminal.service.ts | 3 +- terminus-terminal/src/services/uac.service.ts | 2 +- terminus-terminal/src/shells/cmder.ts | 3 +- terminus-terminal/src/shells/custom.ts | 3 +- terminus-terminal/src/shells/cygwin32.ts | 3 +- terminus-terminal/src/shells/cygwin64.ts | 3 +- terminus-terminal/src/shells/gitBash.ts | 3 +- terminus-terminal/src/shells/linuxDefault.ts | 3 +- terminus-terminal/src/shells/macDefault.ts | 3 +- terminus-terminal/src/shells/posix.ts | 3 +- .../src/shells/powershellCore.ts | 3 +- terminus-terminal/src/shells/winDefault.ts | 3 +- terminus-terminal/src/shells/windowsStock.ts | 3 +- terminus-terminal/src/shells/wsl.ts | 3 +- terminus-terminal/tsconfig.json | 9 +- terminus-terminal/tsconfig.typings.json | 14 +++ tsconfig.json | 1 - 56 files changed, 247 insertions(+), 165 deletions(-) create mode 100644 terminus-core/tsconfig.typings.json create mode 100644 terminus-plugin-manager/tsconfig.typings.json create mode 100644 terminus-settings/tsconfig.typings.json create mode 100644 terminus-ssh/tsconfig.typings.json delete mode 100644 terminus-terminal/src/api.ts rename terminus-terminal/src/{components => api}/baseTerminalTab.component.ts (94%) create mode 100644 terminus-terminal/src/api/colorSchemeProvider.ts create mode 100644 terminus-terminal/src/api/contextMenuProvider.ts create mode 100644 terminus-terminal/src/api/decorator.ts create mode 100644 terminus-terminal/src/api/interfaces.ts create mode 100644 terminus-terminal/src/api/shellProvider.ts create mode 100644 terminus-terminal/tsconfig.typings.json diff --git a/.gitignore b/.gitignore index 22e79656..a6d60b7c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ node_modules build/files.wxs dist */dist +*/typings +*.tsbuildinfo *.xcworkspacedata *.xcuserstate diff --git a/.travis.yml b/.travis.yml index 3d48bcbf..40981405 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ jobs: - scripts/install-deps.js script: - scripts/build-native.js + - yarn run build:typings - yarn run build - scripts/prepackage-plugins.js - scripts/build-linux.js diff --git a/appveyor.yml b/appveyor.yml index 9747549c..495cdb5b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,6 +18,7 @@ install: - node scripts/build-native.js build_script: + - yarn run build:typings - yarn run build - node scripts/prepackage-plugins.js - node scripts/build-windows.js diff --git a/package.json b/package.json index 2bd9fdc8..500bcc95 100644 --- a/package.json +++ b/package.json @@ -126,6 +126,7 @@ }, "scripts": { "build": "webpack --color --config app/webpack.main.config.js && webpack --color --config app/webpack.config.js && webpack --color --config terminus-core/webpack.config.js && webpack --color --config terminus-settings/webpack.config.js && webpack --color --config terminus-terminal/webpack.config.js && webpack --color --config terminus-settings/webpack.config.js && webpack --color --config terminus-plugin-manager/webpack.config.js && webpack --color --config terminus-community-color-schemes/webpack.config.js && webpack --color --config terminus-ssh/webpack.config.js", + "build:typings": "tsc --project terminus-core/tsconfig.typings.json && tsc --project terminus-settings/tsconfig.typings.json && tsc --project terminus-terminal/tsconfig.typings.json && tsc --project terminus-plugin-manager/tsconfig.typings.json && tsc --project terminus-ssh/tsconfig.typings.json", "watch": "cross-env TERMINUS_DEV=1 webpack --progress --color --watch", "start": "cross-env TERMINUS_DEV=1 electron app --debug", "prod": "cross-env TERMINUS_DEV=1 electron app", diff --git a/terminus-community-color-schemes/package.json b/terminus-community-color-schemes/package.json index 15813fb1..3eee21a4 100644 --- a/terminus-community-color-schemes/package.json +++ b/terminus-community-color-schemes/package.json @@ -6,7 +6,7 @@ "terminus-builtin-plugin" ], "main": "dist/index.js", - "typings": "dist/index.d.ts", + "typings": "typings/index.d.ts", "scripts": { "build": "webpack --progress --color", "watch": "webpack --progress --color --watch" diff --git a/terminus-community-color-schemes/tsconfig.json b/terminus-community-color-schemes/tsconfig.json index 1d6cfcbf..286cc9cd 100644 --- a/terminus-community-color-schemes/tsconfig.json +++ b/terminus-community-color-schemes/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../tsconfig.json", "exclude": ["node_modules", "dist"], "compilerOptions": { - "baseUrl": "src", - "declarationDir": "dist" + "baseUrl": "src" } } diff --git a/terminus-core/package.json b/terminus-core/package.json index 04eee325..4a637bf1 100644 --- a/terminus-core/package.json +++ b/terminus-core/package.json @@ -6,7 +6,7 @@ "terminus-builtin-plugin" ], "main": "dist/index.js", - "typings": "dist/index.d.ts", + "typings": "typings/index.d.ts", "scripts": { "build": "webpack --progress --color --display-modules", "watch": "webpack --progress --color --watch" diff --git a/terminus-core/src/components/baseTab.component.ts b/terminus-core/src/components/baseTab.component.ts index d291f014..982e88a1 100644 --- a/terminus-core/src/components/baseTab.component.ts +++ b/terminus-core/src/components/baseTab.component.ts @@ -91,7 +91,7 @@ export abstract class BaseTabComponent { } this.progressClearTimeout = setTimeout(() => { this.setProgress(null) - }, 5000) + }, 5000) as any } } diff --git a/terminus-core/src/services/app.service.ts b/terminus-core/src/services/app.service.ts index 6c9eef84..b1a21164 100644 --- a/terminus-core/src/services/app.service.ts +++ b/terminus-core/src/services/app.service.ts @@ -16,7 +16,7 @@ class CompletionObserver { private interval: number constructor (private tab: BaseTabComponent) { - this.interval = setInterval(() => this.tick(), 1000) + this.interval = setInterval(() => this.tick(), 1000) as any this.tab.destroyed$.pipe(takeUntil(this.destroyed$)).subscribe(() => this.stop()) } diff --git a/terminus-core/tsconfig.json b/terminus-core/tsconfig.json index 1d6cfcbf..e0611107 100644 --- a/terminus-core/tsconfig.json +++ b/terminus-core/tsconfig.json @@ -3,6 +3,5 @@ "exclude": ["node_modules", "dist"], "compilerOptions": { "baseUrl": "src", - "declarationDir": "dist" } } diff --git a/terminus-core/tsconfig.typings.json b/terminus-core/tsconfig.typings.json new file mode 100644 index 00000000..c0d2273c --- /dev/null +++ b/terminus-core/tsconfig.typings.json @@ -0,0 +1,14 @@ +{ + "extends": "../tsconfig.json", + "exclude": ["node_modules", "dist", "typings"], + "compilerOptions": { + "baseUrl": "src", + "emitDeclarationOnly": true, + "declaration": true, + "declarationDir": "./typings", + "paths": { + "terminus-*": ["../../terminus-*"], + "*": ["../../app/node_modules/*"] + } + } +} diff --git a/terminus-plugin-manager/package.json b/terminus-plugin-manager/package.json index 4053f215..2ea91974 100644 --- a/terminus-plugin-manager/package.json +++ b/terminus-plugin-manager/package.json @@ -6,7 +6,7 @@ "terminus-builtin-plugin" ], "main": "dist/index.js", - "typings": "dist/index.d.ts", + "typings": "typings/index.d.ts", "scripts": { "build": "webpack --progress --color --display-modules", "watch": "webpack --progress --color --watch" diff --git a/terminus-plugin-manager/tsconfig.json b/terminus-plugin-manager/tsconfig.json index 1d6cfcbf..e0611107 100644 --- a/terminus-plugin-manager/tsconfig.json +++ b/terminus-plugin-manager/tsconfig.json @@ -3,6 +3,5 @@ "exclude": ["node_modules", "dist"], "compilerOptions": { "baseUrl": "src", - "declarationDir": "dist" } } diff --git a/terminus-plugin-manager/tsconfig.typings.json b/terminus-plugin-manager/tsconfig.typings.json new file mode 100644 index 00000000..c0d2273c --- /dev/null +++ b/terminus-plugin-manager/tsconfig.typings.json @@ -0,0 +1,14 @@ +{ + "extends": "../tsconfig.json", + "exclude": ["node_modules", "dist", "typings"], + "compilerOptions": { + "baseUrl": "src", + "emitDeclarationOnly": true, + "declaration": true, + "declarationDir": "./typings", + "paths": { + "terminus-*": ["../../terminus-*"], + "*": ["../../app/node_modules/*"] + } + } +} diff --git a/terminus-settings/package.json b/terminus-settings/package.json index 4a2396cf..397baf2d 100644 --- a/terminus-settings/package.json +++ b/terminus-settings/package.json @@ -6,7 +6,7 @@ "terminus-builtin-plugin" ], "main": "dist/index.js", - "typings": "dist/src/index.d.ts", + "typings": "typings/index.d.ts", "scripts": { "build": "webpack --progress --color --display-modules", "watch": "webpack --progress --color --watch" diff --git a/terminus-settings/tsconfig.json b/terminus-settings/tsconfig.json index 1d6cfcbf..e0611107 100644 --- a/terminus-settings/tsconfig.json +++ b/terminus-settings/tsconfig.json @@ -3,6 +3,5 @@ "exclude": ["node_modules", "dist"], "compilerOptions": { "baseUrl": "src", - "declarationDir": "dist" } } diff --git a/terminus-settings/tsconfig.typings.json b/terminus-settings/tsconfig.typings.json new file mode 100644 index 00000000..c0d2273c --- /dev/null +++ b/terminus-settings/tsconfig.typings.json @@ -0,0 +1,14 @@ +{ + "extends": "../tsconfig.json", + "exclude": ["node_modules", "dist", "typings"], + "compilerOptions": { + "baseUrl": "src", + "emitDeclarationOnly": true, + "declaration": true, + "declarationDir": "./typings", + "paths": { + "terminus-*": ["../../terminus-*"], + "*": ["../../app/node_modules/*"] + } + } +} diff --git a/terminus-ssh/package.json b/terminus-ssh/package.json index af8120cc..71c29e7f 100644 --- a/terminus-ssh/package.json +++ b/terminus-ssh/package.json @@ -6,7 +6,7 @@ "terminus-builtin-plugin" ], "main": "dist/index.js", - "typings": "dist/index.d.ts", + "typings": "typings/index.d.ts", "scripts": { "build": "webpack --progress --color", "watch": "webpack --progress --color --watch" diff --git a/terminus-ssh/src/components/sshTab.component.ts b/terminus-ssh/src/components/sshTab.component.ts index 73604e98..6c2760d4 100644 --- a/terminus-ssh/src/components/sshTab.component.ts +++ b/terminus-ssh/src/components/sshTab.component.ts @@ -12,7 +12,7 @@ import { SSHConnection, SSHSession } from '../api' class="content" > `, - styles: [require('./sshTab.component.scss')], + styles: [require('./sshTab.component.scss'), ...BaseTerminalTabComponent.styles], animations: BaseTerminalTabComponent.animations, }) export class SSHTabComponent extends BaseTerminalTabComponent { diff --git a/terminus-ssh/tsconfig.json b/terminus-ssh/tsconfig.json index d2383e0e..a863b98a 100644 --- a/terminus-ssh/tsconfig.json +++ b/terminus-ssh/tsconfig.json @@ -1,12 +1,7 @@ { "extends": "../tsconfig.json", - "exclude": ["node_modules", "dist"], + "exclude": ["node_modules", "dist", "typings"], "compilerOptions": { - "baseUrl": "src", - "declarationDir": "dist", - "paths": { - "terminus-*": ["terminus-*"], - "*": ["app/node_modules/*"] - } + "baseUrl": "src" } } diff --git a/terminus-ssh/tsconfig.typings.json b/terminus-ssh/tsconfig.typings.json new file mode 100644 index 00000000..95da756c --- /dev/null +++ b/terminus-ssh/tsconfig.typings.json @@ -0,0 +1,15 @@ +{ + "extends": "../tsconfig.json", + "exclude": ["node_modules", "dist", "typings"], + "include": ["src"], + "compilerOptions": { + "baseUrl": "src", + "emitDeclarationOnly": true, + "declaration": true, + "declarationDir": "./typings", + "paths": { + "terminus-*": ["../../terminus-*"], + "*": ["../../app/node_modules/*"] + } + } +} diff --git a/terminus-terminal/package.json b/terminus-terminal/package.json index ab9cb8d3..2902ac1c 100644 --- a/terminus-terminal/package.json +++ b/terminus-terminal/package.json @@ -6,7 +6,7 @@ "terminus-builtin-plugin" ], "main": "dist/index.js", - "typings": "dist/src/index.d.ts", + "typings": "typings/index.d.ts", "scripts": { "build": "webpack --progress --color --display-modules", "watch": "webpack --progress --color --watch" diff --git a/terminus-terminal/src/api.ts b/terminus-terminal/src/api.ts deleted file mode 100644 index 6f1f4bbb..00000000 --- a/terminus-terminal/src/api.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { SafeHtml } from '@angular/platform-browser' -import { BaseTerminalTabComponent } from './components/baseTerminalTab.component' - -/** - * Extend to automatically run actions on new terminals - */ -export abstract class TerminalDecorator { - /** - * Called when a new terminal tab starts - */ - attach (terminal: BaseTerminalTabComponent): void { } // tslint:disable-line no-empty - - /** - * Called before a terminal tab is destroyed - */ - detach (terminal: BaseTerminalTabComponent): void { } // tslint:disable-line no-empty -} - -export interface ResizeEvent { - columns: number - rows: number -} - -export interface SessionOptions { - name?: string - command: string - args: string[] - cwd?: string - env?: {[id: string]: string} - width?: number - height?: number - pauseAfterExit?: boolean - runAsAdministrator?: boolean -} - -export interface Profile { - name: string, - sessionOptions: SessionOptions, - isBuiltin?: boolean - icon?: SafeHtml -} - -export interface ITerminalColorScheme { - name: string - foreground: string - background: string - cursor: string - colors: string[] -} - -/** - * Extend to add more terminal color schemes - */ -export abstract class TerminalColorSchemeProvider { - abstract async getSchemes (): Promise -} - -/** - * Extend to add more terminal context menu items - */ -export abstract class TerminalContextMenuItemProvider { - weight: number - - abstract async getItems (tab: BaseTerminalTabComponent): Promise -} - -export interface IShell { - id: string - name?: string - command: string - args?: string[] - env: {[id: string]: string} - - /** - * Base path to which shell's internal FS is relative - * Currently used for WSL only - */ - fsBase?: string - - /** - * SVG icon - */ - icon?: SafeHtml - - hidden?: boolean -} - -/** - * Extend to add support for more shells - */ -export abstract class ShellProvider { - abstract async provide (): Promise -} diff --git a/terminus-terminal/src/components/baseTerminalTab.component.ts b/terminus-terminal/src/api/baseTerminalTab.component.ts similarity index 94% rename from terminus-terminal/src/components/baseTerminalTab.component.ts rename to terminus-terminal/src/api/baseTerminalTab.component.ts index 917a182a..92d3b6ac 100644 --- a/terminus-terminal/src/components/baseTerminalTab.component.ts +++ b/terminus-terminal/src/api/baseTerminalTab.component.ts @@ -2,32 +2,32 @@ import { Observable, Subject, Subscription } from 'rxjs' import { first } from 'rxjs/operators' import { ToastrService } from 'ngx-toastr' import { NgZone, OnInit, OnDestroy, Inject, Injector, Optional, ViewChild, HostBinding, Input, ElementRef } from '@angular/core' -import { trigger, transition, style, animate } from '@angular/animations' +import { trigger, transition, style, animate, AnimationTriggerMetadata } from '@angular/animations' import { AppService, ConfigService, BaseTabComponent, ElectronService, HostAppService, HotkeysService, Platform, LogService, Logger } from 'terminus-core' import { BaseSession, SessionsService } from '../services/sessions.service' import { TerminalFrontendService } from '../services/terminalFrontend.service' -import { TerminalDecorator, ResizeEvent, TerminalContextMenuItemProvider } from '../api' import { Frontend } from '../frontends/frontend' +import { ResizeEvent } from './interfaces' +import { TerminalDecorator } from './decorator' +import { TerminalContextMenuItemProvider } from './contextMenuProvider' /** * A class to base your custom terminal tabs on */ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit, OnDestroy { - static template = require('./baseTerminalTab.component.pug') - static styles = [require('./terminalTab.component.scss')] - static animations = [ - trigger('slideInOut', [ - transition(':enter', [ - style({ transform: 'translateY(-25%)' }), - animate('100ms ease-in-out', style({ transform: 'translateY(0%)' })) - ]), - transition(':leave', [ - animate('100ms ease-in-out', style({ transform: 'translateY(-25%)' })) - ]) + static template = require('../components/baseTerminalTab.component.pug') + static styles = [require('../components/terminalTab.component.scss')] + static animations: AnimationTriggerMetadata[] = [trigger('slideInOut', [ + transition(':enter', [ + style({ transform: 'translateY(-25%)' }), + animate('100ms ease-in-out', style({ transform: 'translateY(0%)' })) + ]), + transition(':leave', [ + animate('100ms ease-in-out', style({ transform: 'translateY(-25%)' })) ]) - ] + ])] session: BaseSession @Input() zoom = 0 diff --git a/terminus-terminal/src/api/colorSchemeProvider.ts b/terminus-terminal/src/api/colorSchemeProvider.ts new file mode 100644 index 00000000..7c365049 --- /dev/null +++ b/terminus-terminal/src/api/colorSchemeProvider.ts @@ -0,0 +1,8 @@ +import { ITerminalColorScheme } from './interfaces' + +/** + * Extend to add more terminal color schemes + */ +export abstract class TerminalColorSchemeProvider { + abstract async getSchemes (): Promise +} diff --git a/terminus-terminal/src/api/contextMenuProvider.ts b/terminus-terminal/src/api/contextMenuProvider.ts new file mode 100644 index 00000000..f76e7d6a --- /dev/null +++ b/terminus-terminal/src/api/contextMenuProvider.ts @@ -0,0 +1,10 @@ +import { BaseTerminalTabComponent } from './baseTerminalTab.component' + +/** + * Extend to add more terminal context menu items + */ +export abstract class TerminalContextMenuItemProvider { + weight: number + + abstract async getItems (tab: BaseTerminalTabComponent): Promise +} diff --git a/terminus-terminal/src/api/decorator.ts b/terminus-terminal/src/api/decorator.ts new file mode 100644 index 00000000..08bfac9f --- /dev/null +++ b/terminus-terminal/src/api/decorator.ts @@ -0,0 +1,16 @@ +import { BaseTerminalTabComponent } from './baseTerminalTab.component' + +/** + * Extend to automatically run actions on new terminals + */ +export abstract class TerminalDecorator { + /** + * Called when a new terminal tab starts + */ + attach (terminal: BaseTerminalTabComponent): void { } // tslint:disable-line no-empty + + /** + * Called before a terminal tab is destroyed + */ + detach (terminal: BaseTerminalTabComponent): void { } // tslint:disable-line no-empty +} diff --git a/terminus-terminal/src/api/interfaces.ts b/terminus-terminal/src/api/interfaces.ts new file mode 100644 index 00000000..2c277ec3 --- /dev/null +++ b/terminus-terminal/src/api/interfaces.ts @@ -0,0 +1,54 @@ +import { SafeHtml } from '@angular/platform-browser' + +export interface ResizeEvent { + columns: number + rows: number +} + +export interface SessionOptions { + name?: string + command: string + args: string[] + cwd?: string + env?: {[id: string]: string} + width?: number + height?: number + pauseAfterExit?: boolean + runAsAdministrator?: boolean +} + +export interface Profile { + name: string, + sessionOptions: SessionOptions, + isBuiltin?: boolean + icon?: SafeHtml +} + +export interface ITerminalColorScheme { + name: string + foreground: string + background: string + cursor: string + colors: string[] +} + +export interface IShell { + id: string + name?: string + command: string + args?: string[] + env: {[id: string]: string} + + /** + * Base path to which shell's internal FS is relative + * Currently used for WSL only + */ + fsBase?: string + + /** + * SVG icon + */ + icon?: SafeHtml + + hidden?: boolean +} diff --git a/terminus-terminal/src/api/shellProvider.ts b/terminus-terminal/src/api/shellProvider.ts new file mode 100644 index 00000000..5601e19b --- /dev/null +++ b/terminus-terminal/src/api/shellProvider.ts @@ -0,0 +1,8 @@ +import { IShell } from './interfaces' + +/** + * Extend to add support for more shells + */ +export abstract class ShellProvider { + abstract async provide (): Promise +} diff --git a/terminus-terminal/src/colorSchemes.ts b/terminus-terminal/src/colorSchemes.ts index 15f1c89b..f990cbe2 100644 --- a/terminus-terminal/src/colorSchemes.ts +++ b/terminus-terminal/src/colorSchemes.ts @@ -1,7 +1,8 @@ import * as fs from 'mz/fs' import * as path from 'path' import { Injectable } from '@angular/core' -import { TerminalColorSchemeProvider, ITerminalColorScheme } from './api' +import { TerminalColorSchemeProvider } from './api/colorSchemeProvider' +import { ITerminalColorScheme } from './api/interfaces' /** @hidden */ @Injectable() diff --git a/terminus-terminal/src/components/appearanceSettingsTab.component.ts b/terminus-terminal/src/components/appearanceSettingsTab.component.ts index 9201d10c..6ce42bbf 100644 --- a/terminus-terminal/src/components/appearanceSettingsTab.component.ts +++ b/terminus-terminal/src/components/appearanceSettingsTab.component.ts @@ -6,7 +6,8 @@ const fontManager = require('fontmanager-redux') import { Component, Inject } from '@angular/core' import { ConfigService, HostAppService, Platform, ElectronService } from 'terminus-core' -import { TerminalColorSchemeProvider, ITerminalColorScheme } from '../api' +import { TerminalColorSchemeProvider } from '../api/colorSchemeProvider' +import { ITerminalColorScheme } from '../api/interfaces' /** @hidden */ @Component({ diff --git a/terminus-terminal/src/components/editProfileModal.component.ts b/terminus-terminal/src/components/editProfileModal.component.ts index eaa64bc8..f395772f 100644 --- a/terminus-terminal/src/components/editProfileModal.component.ts +++ b/terminus-terminal/src/components/editProfileModal.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { UACService } from '../services/uac.service' -import { Profile } from '../api' +import { Profile } from '../api/interfaces' /** @hidden */ @Component({ diff --git a/terminus-terminal/src/components/shellSettingsTab.component.ts b/terminus-terminal/src/components/shellSettingsTab.component.ts index b2a22491..a5a73d08 100644 --- a/terminus-terminal/src/components/shellSettingsTab.component.ts +++ b/terminus-terminal/src/components/shellSettingsTab.component.ts @@ -4,7 +4,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { Subscription } from 'rxjs' import { ConfigService, ElectronService, HostAppService, Platform } from 'terminus-core' import { EditProfileModalComponent } from './editProfileModal.component' -import { IShell, Profile } from '../api' +import { IShell, Profile } from '../api/interfaces' import { TerminalService } from '../services/terminal.service' import { WIN_BUILD_CONPTY_SUPPORTED, WIN_BUILD_CONPTY_STABLE, isWindowsBuild } from '../utils' diff --git a/terminus-terminal/src/components/terminalTab.component.ts b/terminus-terminal/src/components/terminalTab.component.ts index 49ef2ab5..6c6efa2d 100644 --- a/terminus-terminal/src/components/terminalTab.component.ts +++ b/terminus-terminal/src/components/terminalTab.component.ts @@ -2,8 +2,8 @@ import { Component, Input } from '@angular/core' import { Subscription } from 'rxjs' import { first } from 'rxjs/operators' import { BaseTabProcess } from 'terminus-core' -import { BaseTerminalTabComponent } from './baseTerminalTab.component' -import { SessionOptions } from '../api' +import { BaseTerminalTabComponent } from '../api/baseTerminalTab.component' +import { SessionOptions } from '../api/interfaces' import { Session } from '../services/sessions.service' import { WIN_BUILD_CONPTY_SUPPORTED, isWindowsBuild } from '../utils' diff --git a/terminus-terminal/src/contextMenu.ts b/terminus-terminal/src/contextMenu.ts index 645c19a4..eca4ec43 100644 --- a/terminus-terminal/src/contextMenu.ts +++ b/terminus-terminal/src/contextMenu.ts @@ -3,8 +3,8 @@ import { ToastrService } from 'ngx-toastr' import { ConfigService } from 'terminus-core' import { UACService } from './services/uac.service' import { TerminalService } from './services/terminal.service' -import { BaseTerminalTabComponent } from './components/baseTerminalTab.component' -import { TerminalContextMenuItemProvider } from './api' +import { TerminalContextMenuItemProvider } from './api/contextMenuProvider' +import { BaseTerminalTabComponent } from './api/baseTerminalTab.component' /** @hidden */ @Injectable() diff --git a/terminus-terminal/src/frontends/frontend.ts b/terminus-terminal/src/frontends/frontend.ts index 8f38e109..29ddc53b 100644 --- a/terminus-terminal/src/frontends/frontend.ts +++ b/terminus-terminal/src/frontends/frontend.ts @@ -1,5 +1,5 @@ import { Observable, Subject, AsyncSubject, ReplaySubject, BehaviorSubject } from 'rxjs' -import { ResizeEvent } from '../api' +import { ResizeEvent } from '../api/interfaces' import { ConfigService, ThemesService, HotkeysService } from 'terminus-core' export interface ISearchOptions { diff --git a/terminus-terminal/src/index.ts b/terminus-terminal/src/index.ts index 9fabbe4c..33823b22 100644 --- a/terminus-terminal/src/index.ts +++ b/terminus-terminal/src/index.ts @@ -17,7 +17,6 @@ import { TerminalSettingsTabComponent } from './components/terminalSettingsTab.c import { ColorPickerComponent } from './components/colorPicker.component' import { EditProfileModalComponent } from './components/editProfileModal.component' import { EnvironmentEditorComponent } from './components/environmentEditor.component' -import { BaseTerminalTabComponent } from './components/baseTerminalTab.component' import { SearchPanelComponent } from './components/searchPanel.component' import { BaseSession } from './services/sessions.service' @@ -27,7 +26,10 @@ import { DockMenuService } from './services/dockMenu.service' import { ButtonProvider } from './buttonProvider' import { RecoveryProvider } from './recoveryProvider' -import { TerminalColorSchemeProvider, TerminalDecorator, ShellProvider, TerminalContextMenuItemProvider } from './api' +import { TerminalDecorator } from './api/decorator' +import { TerminalContextMenuItemProvider } from './api/contextMenuProvider' +import { TerminalColorSchemeProvider } from './api/colorSchemeProvider' +import { ShellProvider } from './api/shellProvider' import { TerminalSettingsTabProvider, AppearanceSettingsTabProvider, ShellSettingsTabProvider } from './settings' import { PathDropDecorator } from './pathDrop' import { TerminalConfigProvider } from './config' @@ -216,6 +218,7 @@ export default class TerminalModule { } } -export { TerminalService, BaseSession, TerminalTabComponent, TerminalFrontendService, BaseTerminalTabComponent } +export { TerminalService, BaseSession, TerminalTabComponent, TerminalFrontendService, TerminalDecorator, TerminalContextMenuItemProvider, TerminalColorSchemeProvider } export { Frontend, XTermFrontend, XTermWebGLFrontend, HTermFrontend } -export * from './api' +export { BaseTerminalTabComponent } from './api/baseTerminalTab.component' +export * from './api/interfaces' diff --git a/terminus-terminal/src/pathDrop.ts b/terminus-terminal/src/pathDrop.ts index 5d4ba9cd..1cd35d32 100644 --- a/terminus-terminal/src/pathDrop.ts +++ b/terminus-terminal/src/pathDrop.ts @@ -1,6 +1,6 @@ import { Subscription } from 'rxjs' import { Injectable } from '@angular/core' -import { TerminalDecorator } from './api' +import { TerminalDecorator } from './api/decorator' import { TerminalTabComponent } from './components/terminalTab.component' /** @hidden */ diff --git a/terminus-terminal/src/services/sessions.service.ts b/terminus-terminal/src/services/sessions.service.ts index a1db9e20..f3758d02 100644 --- a/terminus-terminal/src/services/sessions.service.ts +++ b/terminus-terminal/src/services/sessions.service.ts @@ -8,7 +8,7 @@ import { first } from 'rxjs/operators' import { Injectable } from '@angular/core' import { Logger, LogService, ConfigService } from 'terminus-core' import { exec } from 'mz/child_process' -import { SessionOptions } from '../api' +import { SessionOptions } from '../api/interfaces' import { WIN_BUILD_CONPTY_SUPPORTED, isWindowsBuild } from '../utils' try { diff --git a/terminus-terminal/src/services/terminal.service.ts b/terminus-terminal/src/services/terminal.service.ts index 818335f8..f90c1166 100644 --- a/terminus-terminal/src/services/terminal.service.ts +++ b/terminus-terminal/src/services/terminal.service.ts @@ -3,7 +3,8 @@ import slug from 'slug' import { Observable, AsyncSubject } from 'rxjs' import { Injectable, Inject } from '@angular/core' import { AppService, Logger, LogService, ConfigService, SplitTabComponent } from 'terminus-core' -import { IShell, ShellProvider, SessionOptions, Profile } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell, SessionOptions, Profile } from '../api/interfaces' import { TerminalTabComponent } from '../components/terminalTab.component' import { UACService } from './uac.service' diff --git a/terminus-terminal/src/services/uac.service.ts b/terminus-terminal/src/services/uac.service.ts index fb55df8c..24c7b9d9 100644 --- a/terminus-terminal/src/services/uac.service.ts +++ b/terminus-terminal/src/services/uac.service.ts @@ -1,7 +1,7 @@ import * as path from 'path' import { Injectable } from '@angular/core' import { ElectronService } from 'terminus-core' -import { SessionOptions } from '../api' +import { SessionOptions } from '../api/interfaces' import { WIN_BUILD_CONPTY_SUPPORTED, isWindowsBuild } from '../utils' diff --git a/terminus-terminal/src/shells/cmder.ts b/terminus-terminal/src/shells/cmder.ts index 7c20185b..7ad33c53 100644 --- a/terminus-terminal/src/shells/cmder.ts +++ b/terminus-terminal/src/shells/cmder.ts @@ -3,7 +3,8 @@ import { Injectable } from '@angular/core' import { DomSanitizer } from '@angular/platform-browser' import { HostAppService, Platform } from 'terminus-core' -import { ShellProvider, IShell } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell } from '../api/interfaces' /** @hidden */ @Injectable() diff --git a/terminus-terminal/src/shells/custom.ts b/terminus-terminal/src/shells/custom.ts index a17a0637..7b1f5639 100644 --- a/terminus-terminal/src/shells/custom.ts +++ b/terminus-terminal/src/shells/custom.ts @@ -1,7 +1,8 @@ import { Injectable } from '@angular/core' import { ConfigService } from 'terminus-core' -import { ShellProvider, IShell } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell } from '../api/interfaces' /** @hidden */ @Injectable() diff --git a/terminus-terminal/src/shells/cygwin32.ts b/terminus-terminal/src/shells/cygwin32.ts index af5ff9c2..ebee7ae7 100644 --- a/terminus-terminal/src/shells/cygwin32.ts +++ b/terminus-terminal/src/shells/cygwin32.ts @@ -3,7 +3,8 @@ import { Injectable } from '@angular/core' import { DomSanitizer } from '@angular/platform-browser' import { HostAppService, Platform } from 'terminus-core' -import { ShellProvider, IShell } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell } from '../api/interfaces' try { var wnr = require('windows-native-registry') // tslint:disable-line diff --git a/terminus-terminal/src/shells/cygwin64.ts b/terminus-terminal/src/shells/cygwin64.ts index 1b07ab25..eb3dae9e 100644 --- a/terminus-terminal/src/shells/cygwin64.ts +++ b/terminus-terminal/src/shells/cygwin64.ts @@ -3,7 +3,8 @@ import { Injectable } from '@angular/core' import { DomSanitizer } from '@angular/platform-browser' import { HostAppService, Platform } from 'terminus-core' -import { ShellProvider, IShell } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell } from '../api/interfaces' try { var wnr = require('windows-native-registry') // tslint:disable-line diff --git a/terminus-terminal/src/shells/gitBash.ts b/terminus-terminal/src/shells/gitBash.ts index fd451dc6..721d87b3 100644 --- a/terminus-terminal/src/shells/gitBash.ts +++ b/terminus-terminal/src/shells/gitBash.ts @@ -3,7 +3,8 @@ import { Injectable } from '@angular/core' import { DomSanitizer } from '@angular/platform-browser' import { HostAppService, Platform } from 'terminus-core' -import { ShellProvider, IShell } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell } from '../api/interfaces' try { var wnr = require('windows-native-registry') // tslint:disable-line diff --git a/terminus-terminal/src/shells/linuxDefault.ts b/terminus-terminal/src/shells/linuxDefault.ts index 391021b8..3e6bbdb5 100644 --- a/terminus-terminal/src/shells/linuxDefault.ts +++ b/terminus-terminal/src/shells/linuxDefault.ts @@ -2,7 +2,8 @@ import * as fs from 'mz/fs' import { Injectable } from '@angular/core' import { HostAppService, Platform, LogService, Logger } from 'terminus-core' -import { ShellProvider, IShell } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell } from '../api/interfaces' /** @hidden */ @Injectable() diff --git a/terminus-terminal/src/shells/macDefault.ts b/terminus-terminal/src/shells/macDefault.ts index 3cb1f50f..69ecd83f 100644 --- a/terminus-terminal/src/shells/macDefault.ts +++ b/terminus-terminal/src/shells/macDefault.ts @@ -2,7 +2,8 @@ import { exec } from 'mz/child_process' import { Injectable } from '@angular/core' import { HostAppService, Platform } from 'terminus-core' -import { ShellProvider, IShell } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell } from '../api/interfaces' /** @hidden */ @Injectable() diff --git a/terminus-terminal/src/shells/posix.ts b/terminus-terminal/src/shells/posix.ts index 2d2f2e54..cb217ab9 100644 --- a/terminus-terminal/src/shells/posix.ts +++ b/terminus-terminal/src/shells/posix.ts @@ -3,7 +3,8 @@ import slug from 'slug' import { Injectable } from '@angular/core' import { HostAppService, Platform } from 'terminus-core' -import { ShellProvider, IShell } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell } from '../api/interfaces' /** @hidden */ @Injectable() diff --git a/terminus-terminal/src/shells/powershellCore.ts b/terminus-terminal/src/shells/powershellCore.ts index bf30e905..1e91ddf9 100644 --- a/terminus-terminal/src/shells/powershellCore.ts +++ b/terminus-terminal/src/shells/powershellCore.ts @@ -1,7 +1,8 @@ import { Injectable } from '@angular/core' import { DomSanitizer } from '@angular/platform-browser' import { HostAppService, Platform } from 'terminus-core' -import { ShellProvider, IShell } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell } from '../api/interfaces' try { var wnr = require('windows-native-registry') // tslint:disable-line diff --git a/terminus-terminal/src/shells/winDefault.ts b/terminus-terminal/src/shells/winDefault.ts index aa63fd45..6ed794fd 100644 --- a/terminus-terminal/src/shells/winDefault.ts +++ b/terminus-terminal/src/shells/winDefault.ts @@ -1,7 +1,8 @@ import { Injectable } from '@angular/core' import { HostAppService, Platform } from 'terminus-core' -import { ShellProvider, IShell } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell } from '../api/interfaces' import { WSLShellProvider } from './wsl' import { PowerShellCoreShellProvider } from './powershellCore' diff --git a/terminus-terminal/src/shells/windowsStock.ts b/terminus-terminal/src/shells/windowsStock.ts index 565a7b66..e780fe3d 100644 --- a/terminus-terminal/src/shells/windowsStock.ts +++ b/terminus-terminal/src/shells/windowsStock.ts @@ -3,7 +3,8 @@ import { Injectable } from '@angular/core' import { DomSanitizer } from '@angular/platform-browser' import { HostAppService, Platform, ElectronService } from 'terminus-core' -import { ShellProvider, IShell } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell } from '../api/interfaces' /** @hidden */ @Injectable() diff --git a/terminus-terminal/src/shells/wsl.ts b/terminus-terminal/src/shells/wsl.ts index 1eade703..544941ac 100644 --- a/terminus-terminal/src/shells/wsl.ts +++ b/terminus-terminal/src/shells/wsl.ts @@ -4,7 +4,8 @@ import slug from 'slug' import { Injectable } from '@angular/core' import { HostAppService, Platform } from 'terminus-core' -import { ShellProvider, IShell } from '../api' +import { ShellProvider } from '../api/shellProvider' +import { IShell } from '../api/interfaces' import { isWindowsBuild, WIN_BUILD_WSL_EXE_DISTRO_FLAG } from '../utils' try { diff --git a/terminus-terminal/tsconfig.json b/terminus-terminal/tsconfig.json index d2383e0e..a863b98a 100644 --- a/terminus-terminal/tsconfig.json +++ b/terminus-terminal/tsconfig.json @@ -1,12 +1,7 @@ { "extends": "../tsconfig.json", - "exclude": ["node_modules", "dist"], + "exclude": ["node_modules", "dist", "typings"], "compilerOptions": { - "baseUrl": "src", - "declarationDir": "dist", - "paths": { - "terminus-*": ["terminus-*"], - "*": ["app/node_modules/*"] - } + "baseUrl": "src" } } diff --git a/terminus-terminal/tsconfig.typings.json b/terminus-terminal/tsconfig.typings.json new file mode 100644 index 00000000..c0d2273c --- /dev/null +++ b/terminus-terminal/tsconfig.typings.json @@ -0,0 +1,14 @@ +{ + "extends": "../tsconfig.json", + "exclude": ["node_modules", "dist", "typings"], + "compilerOptions": { + "baseUrl": "src", + "emitDeclarationOnly": true, + "declaration": true, + "declarationDir": "./typings", + "paths": { + "terminus-*": ["../../terminus-*"], + "*": ["../../app/node_modules/*"] + } + } +} diff --git a/tsconfig.json b/tsconfig.json index 4c4dad65..52236958 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,6 @@ "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "noUnusedLocals": true, - "declaration": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true,