1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-25 08:33:27 +03:00
This commit is contained in:
Eugene Pankov 2017-06-20 23:28:58 +02:00
parent d9fd78fb42
commit 5e2dae153e
17 changed files with 217 additions and 115 deletions

115
HACKING.md Normal file
View File

@ -0,0 +1,115 @@
# Some background
Terminus is an Electron app, with the frontend written in Typescript with the help of Angular framework. It's built using Webpack.
# Getting started
First of all, clone this repository. You'll also need a recent version of Node installed.
First, install the dependencies:
```
# macOS/Linux:
npm i
./scripts/install-deps.js
./scripts/build-native.js
# Windows:
npm i
node scripts\install-deps.js
node scripts\build-native.js
```
Now, check if your build is working:
```
npm run build
```
Start Terminus with
```
npm start
```
# Project layout
```
terminus
├─ app # Electron app, just the bare essentials
| ├─ src # Electron renderer code
| └─ main.js # Electron main entry point
├─ build
├─ clink # Clink distributive, for Windows
├─ scripts # Maintenance scripts
├─ terminus-community-color-schemes # Plugin that provides color schemes
├─ terminus-core # Plugin that provides base UI and tab management
├─ terminus-plugin-manager # Plugin that installs other plugins
├─ terminus-settings # Plugin that provides the settings tab
└─ terminus-terminal # Plugin that provides terminal tabs
```
# Plugin layout
```
terminus-pluginname
├─ src # Typescript code
| ├─ components # Angular components
| | ├─ foo.component.ts # Code
| | ├─ foo.component.scss # Styles
| | └─ foo.component.pug # Template
| ├─ services # Angular services
| | └─ foo.service.ts
| ├─ api.ts # Publicly exported API
| └─ index.ts # Module entry point
├─ package.json
├─ tsconfig.json
└─ webpack.config.js
```
# Plugins
The app will load all plugins from the source checkout in the dev mode, and from the user's plugins directory at all times (click `Open Plugins Directory` under `Settings` > `Plugins`).
A plugin should only provide a default export, which should be a `NgModule` class (or a `NgModuleWithDependencies` where applicable). This module will be injected as a dependency to the app's root module.
```javascript
import { NgModule } from '@angular/core'
@NgModule()
export default class MyModule {
constructor () {
console.log('Angular engaged, cap\'n.')
}
}
```
Plugins provide functionality by exporting singular or multi providers:
```javascript
import { NgModule, Injectable } from '@angular/core'
import { ToolbarButtonProvider, IToolbarButton } from 'terminus-core'
@Injectable()
export class MyButtonProvider extends ToolbarButtonProvider {
provide (): IToolbarButton[] {
return [{
icon: 'star',
title: 'Foobar',
weight: 10,
click: () => {
alert('Woohoo!')
}
}]
}
}
@NgModule({
providers: [
{ provide: ToolbarButtonProvider, useClass: MyButtonProvider, multi: true },
],
})
export default class MyModule { }
```
See `terminus-core/src/api.ts`, `terminus-settings/src/api.ts` and `terminus-terminal/src/api.ts` for the available extension points.

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017 Eugene Pankov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,6 +1,6 @@
import 'core-js'
import 'zone.js/dist/zone.js' import 'zone.js/dist/zone.js'
import 'core-js/es7/reflect' import 'core-js/es7/reflect'
import 'core-js/core/delay'
import 'rxjs' import 'rxjs'
// Always land on the start view // Always land on the start view

View File

@ -62,5 +62,8 @@ module.exports = {
'path': 'commonjs path', 'path': 'commonjs path',
'rxjs': 'commonjs rxjs', 'rxjs': 'commonjs rxjs',
'zone.js': 'commonjs zone.js', 'zone.js': 'commonjs zone.js',
} },
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
],
} }

26
package-lock.json generated
View File

@ -27,18 +27,6 @@
"integrity": "sha1-JeTdgEtjDJFq5nEjPm1x9s4YEko=", "integrity": "sha1-JeTdgEtjDJFq5nEjPm1x9s4YEko=",
"dev": true "dev": true
}, },
"@types/raven": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@types/raven/-/raven-1.2.2.tgz",
"integrity": "sha1-r+Ur2YGHo6PSi4IS42MUO9FvI78=",
"dev": true
},
"@types/raven-js": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/@types/raven-js/-/raven-js-3.10.0.tgz",
"integrity": "sha1-0IMhYuvqdnHq//CKMktWrd5b+cM=",
"dev": true
},
"@types/webpack-env": { "@types/webpack-env": {
"version": "https://registry.npmjs.org/@types/webpack-env/-/webpack-env-1.13.0.tgz", "version": "https://registry.npmjs.org/@types/webpack-env/-/webpack-env-1.13.0.tgz",
"integrity": "sha1-MEQ4FkfhHulzxa8uklMjkw9pHYA=", "integrity": "sha1-MEQ4FkfhHulzxa8uklMjkw9pHYA=",
@ -2780,20 +2768,6 @@
"integrity": "sha1-Z0yZdgkBw8QRJ3GjHlIdw0nMCew=", "integrity": "sha1-Z0yZdgkBw8QRJ3GjHlIdw0nMCew=",
"dev": true "dev": true
}, },
"raven": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/raven/-/raven-2.0.2.tgz",
"integrity": "sha1-pD07hwKubbLpGYdii+jyiVAIEK4=",
"dev": true,
"dependencies": {
"uuid": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.0.tgz",
"integrity": "sha1-Zyj8BFnEUNeWqZwxg3VpvfZy1yg=",
"dev": true
}
}
},
"raven-js": { "raven-js": {
"version": "3.16.0", "version": "3.16.0",
"resolved": "https://registry.npmjs.org/raven-js/-/raven-js-3.16.0.tgz", "resolved": "https://registry.npmjs.org/raven-js/-/raven-js-3.16.0.tgz",

View File

@ -1,50 +1,50 @@
{ {
"name": "term", "name": "term",
"devDependencies": { "devDependencies": {
"@types/core-js": "^0.9.35", "@types/core-js": "0.9.35",
"@types/electron": "1.4.34", "@types/electron": "1.4.34",
"@types/fs-promise": "^1.0.1", "@types/fs-promise": "1.0.1",
"@types/node": "^7.0.5", "@types/node": "7.0.5",
"@types/raven": "^1.2.2", "@types/webpack-env": "1.13.0",
"@types/raven-js": "^3.10.0", "apply-loader": "0.1.0",
"@types/webpack-env": "^1.13.0",
"apply-loader": "^0.1.0",
"awesome-typescript-loader": "3.1.2", "awesome-typescript-loader": "3.1.2",
"core-js": "^2.4.1", "core-js": "2.4.1",
"cross-env": "^4.0.0", "cross-env": "4.0.0",
"css-loader": "0.26.1", "css-loader": "0.28.0",
"electron": "1.7.2", "electron-builder-squirrel-windows": "17.0.1",
"electron-builder": "^17.1.1", "electron-builder": "17.1.1",
"electron-builder-squirrel-windows": "^17.0.1",
"electron-osx-sign": "electron-userland/electron-osx-sign#f092181a1bffa2b3248a23ee28447a47e14a8f04", "electron-osx-sign": "electron-userland/electron-osx-sign#f092181a1bffa2b3248a23ee28447a47e14a8f04",
"electron-rebuild": "^1.5.11", "electron-rebuild": "1.5.11",
"file-loader": "^0.9.0", "electron": "1.7.2",
"file-loader": "0.9.0",
"font-awesome": "4.7.0", "font-awesome": "4.7.0",
"html-loader": "^0.4.4", "html-loader": "0.4.4",
"less": "^2.7.1", "json-loader": "0.5.4",
"less-loader": "^2.2.3", "less-loader": "2.2.3",
"node-abi": "^2.0.3", "less": "2.7.1",
"node-gyp": "^3.4.0", "node-abi": "2.0.3",
"node-sass": "^4.5.0", "node-gyp": "3.4.0",
"npmlog": "^4.1.0", "node-sass": "4.5.2",
"pug-html-loader": "^1.0.9", "npmlog": "4.1.0",
"pug-loader": "^2.3.0", "pug-html-loader": "1.0.9",
"pug-loader": "2.3.0",
"pug-static-loader": "0.0.1", "pug-static-loader": "0.0.1",
"raven": "^2.0.2", "pug": "2.0.0-beta11",
"raven-js": "^3.16.0", "raven-js": "3.16.0",
"raw-loader": "^0.5.1", "raw-loader": "0.5.1",
"sass-loader": "^6.0.3", "sass-loader": "6.0.3",
"shelljs": "^0.7.7", "shelljs": "0.7.7",
"source-sans-pro": "^2.0.10", "source-sans-pro": "2.0.10",
"style-loader": "^0.13.1", "style-loader": "0.13.1",
"to-string-loader": "^1.1.5", "to-string-loader": "1.1.5",
"tslint": "^5.1.0", "tslint-config-standard": "5.0.2",
"tslint-config-standard": "^5.0.2", "tslint-eslint-rules": "4.0.0",
"tslint-eslint-rules": "^4.0.0", "tslint": "5.1.0",
"typescript": "~2.1.0", "typescript": "2.2.2",
"url-loader": "^0.5.7", "url-loader": "0.5.7",
"val-loader": "^0.5.0", "val-loader": "0.5.0",
"webpack": "2.4.1" "yaml-loader": "0.4.0",
"webpack": "3.0.0"
}, },
"build": { "build": {
"appId": "org.terminus", "appId": "org.terminus",

View File

@ -8,6 +8,11 @@ log.info('deps', 'app')
sh.exec('npm prune') sh.exec('npm prune')
sh.exec('npm install') sh.exec('npm install')
sh.cd('app')
sh.exec('npm prune')
sh.exec('npm install')
sh.cd('..')
vars.builtinPlugins.forEach(plugin => { vars.builtinPlugins.forEach(plugin => {
log.info('deps', plugin) log.info('deps', plugin)
sh.cd(plugin) sh.cd(plugin)

View File

@ -20,10 +20,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/node": "7.0.12", "@types/node": "7.0.12",
"@types/webpack-env": "^1.13.0", "@types/webpack-env": "^1.13.0"
"awesome-typescript-loader": "3.1.2",
"raw-loader": "0.5.1",
"webpack": "2.3.3"
}, },
"false": {} "false": {}
} }

View File

@ -1,4 +1,5 @@
const path = require('path') const path = require('path')
const webpack = require('webpack')
module.exports = { module.exports = {
target: 'node', target: 'node',
@ -38,5 +39,8 @@ module.exports = {
/^@angular/, /^@angular/,
/^@ng-bootstrap/, /^@ng-bootstrap/,
/^terminus-/, /^terminus-/,
] ],
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
],
} }

View File

@ -19,16 +19,10 @@
"@types/js-yaml": "^3.5.29", "@types/js-yaml": "^3.5.29",
"@types/node": "^7.0.12", "@types/node": "^7.0.12",
"@types/webpack-env": "^1.13.0", "@types/webpack-env": "^1.13.0",
"awesome-typescript-loader": "^3.1.2",
"bootstrap": "4.0.0-alpha.6", "bootstrap": "4.0.0-alpha.6",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"json-loader": "^0.5.4", "ngx-perfect-scrollbar": "4.0.0",
"ngx-perfect-scrollbar": "^4.0.0", "typescript": "^2.2.2"
"style-loader": "^0.13.1",
"to-string-loader": "^1.1.5",
"typescript": "^2.2.2",
"webpack": "^2.3.3",
"yaml-loader": "^0.4.0"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/animations": "4.0.1", "@angular/animations": "4.0.1",

View File

@ -1,4 +1,5 @@
const path = require('path') const path = require('path')
const webpack = require('webpack')
module.exports = { module.exports = {
target: 'node', target: 'node',
@ -48,5 +49,8 @@ module.exports = {
/^rxjs/, /^rxjs/,
/^@angular/, /^@angular/,
/^@ng-bootstrap/, /^@ng-bootstrap/,
] ],
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
],
} }

View File

@ -16,20 +16,11 @@
"devDependencies": { "devDependencies": {
"@types/mz": "0.0.31", "@types/mz": "0.0.31",
"@types/node": "7.0.12", "@types/node": "7.0.12",
"@types/npm": "^2.0.28",
"@types/semver": "^5.3.31", "@types/semver": "^5.3.31",
"@types/webpack-env": "1.13.0", "@types/webpack-env": "1.13.0",
"awesome-typescript-loader": "3.1.2",
"css-loader": "^0.28.0",
"ngx-pipes": "^1.6.1", "ngx-pipes": "^1.6.1",
"pug": "^2.0.0-beta11", "css-loader": "^0.28.0",
"pug-loader": "^2.3.0", "semver": "^5.3.0"
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.3",
"semver": "^5.3.0",
"to-string-loader": "^1.1.5",
"typescript": "^2.2.2",
"webpack": "2.3.3"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/common": "4.0.1", "@angular/common": "4.0.1",

View File

@ -1,4 +1,5 @@
const path = require('path') const path = require('path')
const webpack = require('webpack')
module.exports = { module.exports = {
target: 'node', target: 'node',
@ -45,5 +46,8 @@ module.exports = {
/^@angular/, /^@angular/,
/^@ng-bootstrap/, /^@ng-bootstrap/,
/^terminus-/, /^terminus-/,
] ],
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
],
} }

View File

@ -17,16 +17,7 @@
"@types/deep-equal": "1.0.0", "@types/deep-equal": "1.0.0",
"@types/node": "7.0.12", "@types/node": "7.0.12",
"@types/webpack-env": "1.13.0", "@types/webpack-env": "1.13.0",
"awesome-typescript-loader": "3.1.2", "ngx-pipes": "^1.6.1"
"css-loader": "^0.28.0",
"ngx-pipes": "^1.6.1",
"node-sass": "^4.5.2",
"pug": "^2.0.0-beta3",
"pug-loader": "^2.3.0",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.3",
"to-string-loader": "^1.1.5",
"webpack": "2.3.3"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/common": "4.0.1", "@angular/common": "4.0.1",

View File

@ -1,4 +1,5 @@
const path = require('path') const path = require('path')
const webpack = require('webpack')
module.exports = { module.exports = {
target: 'node', target: 'node',
@ -44,5 +45,8 @@ module.exports = {
/^@angular/, /^@angular/,
/^@ng-bootstrap/, /^@ng-bootstrap/,
/^terminus-/, /^terminus-/,
] ],
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
],
} }

View File

@ -19,17 +19,8 @@
"@types/node": "7.0.12", "@types/node": "7.0.12",
"@types/webpack-env": "1.13.0", "@types/webpack-env": "1.13.0",
"@types/winreg": "^1.2.30", "@types/winreg": "^1.2.30",
"awesome-typescript-loader": "3.1.2",
"css-loader": "^0.28.0",
"dataurl": "0.1.0", "dataurl": "0.1.0",
"deep-equal": "1.0.1", "deep-equal": "1.0.1"
"pug": "^2.0.0-beta11",
"pug-loader": "^2.3.0",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.3",
"to-string-loader": "^1.1.5",
"typescript": "^2.2.2",
"webpack": "2.3.3"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/common": "4.0.1", "@angular/common": "4.0.1",

View File

@ -1,4 +1,5 @@
const path = require('path') const path = require('path')
const webpack = require('webpack')
module.exports = { module.exports = {
target: 'node', target: 'node',
@ -46,5 +47,8 @@ module.exports = {
/^@angular/, /^@angular/,
/^@ng-bootstrap/, /^@ng-bootstrap/,
/^terminus-/, /^terminus-/,
] ],
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
],
} }