1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-27 00:50:49 +03:00
This commit is contained in:
Eugene Pankov 2017-04-17 14:57:22 +02:00
parent 36c2aef860
commit 919aa7c65f
21 changed files with 108 additions and 78 deletions

View File

@ -21,9 +21,9 @@ install-deps:
npm install
npm prune
for dir in app terminus-* ; do \
cd $$dir; \
npm --color always install 2>&1 | grep -v 'requires a peer'; \
npm --color always prune 2>&1 | grep -v 'requires a peer'; \
cd $$dir; \
npm install; \
npm prune; \
cd ..; \
done
make build-native

View File

@ -14,6 +14,10 @@ export async function getRootModule(): Promise<any> {
...(plugins.filter(x => x.bootstrap).map(x => x.bootstrap)),
]
if (bootstrap.length == 0) {
throw new Error('Did not find any bootstrap components. Are there any plugins installed?')
}
@NgModule({
imports,
bootstrap,

View File

@ -1,26 +1,36 @@
import * as fs from 'fs-promise'
import * as path from 'path'
const nodeModule = (<any>global).require('module')
function normalizePath (path: string): string {
const cygwinPrefix = '/cygdrive/'
if (path.startsWith(cygwinPrefix)) {
path = path.substring(cygwinPrefix.length).replace('/', '\\')
path = path[0] + ':' + path.substring(1)
}
return path
};
(<any>global).require.main.paths.map(x => nodeModule.globalPaths.push(normalizePath(x)))
let nodeRequire = (<any>global).require
let module = nodeRequire('module')
nodeRequire.main.paths.map(x => module.globalPaths.push(x))
if (process.env.TERMINUS_PLUGINS) {
process.env.TERMINUS_PLUGINS.split(':').map(x => module.globalPaths.unshift(x))
process.env.TERMINUS_PLUGINS.split(':').map(x => nodeModule.globalPaths.unshift(normalizePath(x)))
}
export async function loadPlugins (): Promise<any[]> {
let paths = module.globalPaths
let paths = nodeModule.globalPaths
let plugins: any[] = []
for (let pluginDir of paths) {
pluginDir = normalizePath(pluginDir)
if (!await fs.exists(pluginDir)) {
continue
}
for (let pluginName of await fs.readdir(pluginDir)) {
if (/^terminus-/.exec(pluginName)) {
let pluginPath = path.join(pluginDir, pluginName)
console.info(`Loading ${pluginName}: ${nodeRequire.resolve(pluginPath)}`)
console.info(`Loading ${pluginName}: ${(<any>global).require.resolve(pluginPath)}`)
try {
let pluginModule = nodeRequire(pluginPath)
let pluginModule = (<any>global).require(pluginPath)
plugins.push(pluginModule)
} catch (error) {
console.error(`Could not load ${pluginName}:`, error)

View File

@ -2,7 +2,7 @@
"compilerOptions": {
"baseUrl": "./src",
"module": "commonjs",
"target": "es5",
"target": "es2015",
"declaration": false,
"noImplicitAny": false,
"removeComments": false,

View File

@ -56,8 +56,8 @@
}
},
"scripts": {
"build": "node --max-old-space-size=4096 ./node_modules/.bin/webpack --progress --color",
"watch": "node --max-old-space-size=4096 ./node_modules/.bin/webpack --progress --color --watch",
"build": "webpack --progress --color",
"watch": "webpack --progress --color --watch",
"pack": "build --dir",
"postinstall": "install-app-deps",
"dist": "build"

View File

@ -17,7 +17,7 @@
},
"devDependencies": {
"@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"

View File

@ -23,7 +23,5 @@
]
},
"compileOnSave": false,
"exclude": [
"node_modules"
]
"include": ["src"]
}

View File

@ -23,13 +23,14 @@ module.exports = {
loader: 'awesome-typescript-loader',
options: {
configFileName: path.resolve(__dirname, 'tsconfig.json'),
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
paths: {
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
"*": [path.resolve(__dirname, '../app/node_modules/*')],
}
}
},
{ test: /\/schemes\//, loader: "raw-loader" },
{ test: /[\\\/]schemes[\\\/]/, loader: "raw-loader" },
]
},
externals: [

View File

@ -5,24 +5,27 @@
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"build": "rm -r dist; webpack --progress --color --display-modules",
"watch": "rm -r dist; webpack --progress --color --watch"
"build": "rm -rf dist && webpack --progress --color --display-modules",
"watch": "rm -rf dist && webpack --progress --color --watch"
},
"author": "Eugene Pankov",
"license": "MIT",
"devDependencies": {
"awesome-typescript-loader": "^3.1.2",
"angular2-toaster": "3.0.1",
"@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.22",
"typescript": "^2.2.2",
"@types/electron": "^1.4.35",
"@types/js-yaml": "^3.5.29",
"webpack": "^2.3.3",
"@types/node": "^7.0.12",
"@types/webpack-env": "^1.13.0",
"angular2-toaster": "3.0.1",
"awesome-typescript-loader": "^3.1.2",
"bootstrap": "4.0.0-alpha.6",
"core-js": "^2.4.1",
"json-loader": "^0.5.4",
"ngx-perfect-scrollbar": "^4.0.0",
"style-loader": "^0.13.1",
"to-string-loader": "^1.1.5",
"json-loader": "^0.5.4",
"typescript": "^2.2.2",
"webpack": "^2.3.3",
"yaml-loader": "^0.4.0"
},
"peerDependencies": {

View File

@ -12,7 +12,7 @@ $tabs-height: 40px;
overflow: hidden;
min-width: 0;
transition: 0.25s all;
transition: 0.25s ease-out all;
.wrapper {
display: flex;

View File

@ -220,6 +220,14 @@ settings-tab > ngb-tabset {
padding: 10px 50px 10px 20px;
font-size: 14px;
&:not(.active) {
color: $body-color;
&:hover {
color: $white;
}
}
&.active {
border-top-color: $nav-tabs-active-link-hover-border-color;
border-bottom-color: $nav-tabs-active-link-hover-border-color;

View File

@ -1,6 +1,6 @@
{
"compilerOptions": {
"baseUrl": "./src",
"baseUrl": "src",
"module": "commonjs",
"target": "es2015",
"declaration": false,
@ -22,7 +22,5 @@
"es7"
]
},
"include": [
"src"
]
"include": ["src"]
}

View File

@ -23,6 +23,7 @@ module.exports = {
loader: 'awesome-typescript-loader',
options: {
configFileName: path.resolve(__dirname, 'tsconfig.json'),
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
paths: {
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
"*": [path.resolve(__dirname, '../app/node_modules/*')],

View File

@ -22,7 +22,5 @@
"es7"
]
},
"include": [
"src"
]
"include": ["src"]
}

View File

@ -23,6 +23,7 @@
"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": {

View File

@ -8,7 +8,7 @@
[style.background-color]='(config.store.terminal.background == "theme") ? null : config.store.terminal.colorScheme.background',
[style.color]='config.store.terminal.colorScheme.foreground',
)
div
div
span([style.background-color]='config.store.terminal.colorScheme.colors[0]') &nbsp;
span([style.background-color]='config.store.terminal.colorScheme.colors[1]') &nbsp;
span([style.background-color]='config.store.terminal.colorScheme.colors[2]') &nbsp;
@ -33,7 +33,7 @@
span([style.color]='config.store.terminal.colorScheme.colors[6]') T
span &nbsp;
span([style.color]='config.store.terminal.colorScheme.colors[7]') W
div
div
span([style.background-color]='config.store.terminal.colorScheme.colors[8]') &nbsp;
span([style.background-color]='config.store.terminal.colorScheme.colors[9]') &nbsp;
span([style.background-color]='config.store.terminal.colorScheme.colors[10]') &nbsp;
@ -58,51 +58,51 @@
span([style.color]='config.store.terminal.colorScheme.colors[14]') T
span &nbsp;
span([style.color]='config.store.terminal.colorScheme.colors[15]') W
div
span
div
div
span &nbsp;
div
span john@doe-pc
span([style.color]='config.store.terminal.colorScheme.colors[1]') $
span webpack
div
div
span Asset Size
div
span([style.color]='config.store.terminal.colorScheme.colors[2]') main.js
div
span([style.color]='config.store.terminal.colorScheme.colors[2]') main.js
span 234 kB
span([style.color]='config.store.terminal.colorScheme.colors[2]') [emitted]
div
span([style.color]='config.store.terminal.colorScheme.colors[3]') big.js
div
span([style.color]='config.store.terminal.colorScheme.colors[3]') big.js
span([style.color]='config.store.terminal.colorScheme.colors[3]') 1.2 MB
span([style.color]='config.store.terminal.colorScheme.colors[2]') [emitted]
span([style.color]='config.store.terminal.colorScheme.colors[3]') [big]
div
span
div
span &nbsp;
div
span john@doe-pc
span([style.color]='config.store.terminal.colorScheme.colors[1]') $
span ls -l
div
div
span drwxr-xr-x 1 root
span([style.color]='config.store.terminal.colorScheme.colors[4]') directory
div
div
span -rw-r--r-- 1 root file
div
div
span -rwxr-xr-x 1 root
span([style.color]='config.store.terminal.colorScheme.colors[2]') executable
div
div
span -rwxr-xr-x 1 root
span([style.color]='config.store.terminal.colorScheme.colors[6]') sym
span ->
span([style.color]='config.store.terminal.colorScheme.colors[1]') link
div
span
div
span &nbsp;
div
span john@doe-pc
span([style.color]='config.store.terminal.colorScheme.colors[1]') $
span rm -rf /
span([style.background-color]='config.store.terminal.colorScheme.cursor') &nbsp;
.col-md-6
.form-group
label Font
@ -136,11 +136,11 @@
button.btn.btn-secondary((click)='editScheme(config.store.terminal.colorScheme)') Edit
.input-group-btn
button.btn.btn-outline-danger(
(click)='deleteScheme(config.store.terminal.colorScheme)',
(click)='deleteScheme(config.store.terminal.colorScheme)',
*ngIf='isCustomScheme(config.store.terminal.colorScheme)'
)
i.fa.fa-trash-o
.form-group(*ngIf='editingColorScheme')
label Editing
.input-group
@ -149,7 +149,7 @@
button.btn.btn-secondary((click)='saveScheme()') Save
.input-group-btn
button.btn.btn-secondary((click)='cancelEditing()') Cancel
.form-group(*ngIf='editingColorScheme')
color-picker(
@ -187,23 +187,25 @@
type='radio',
[value]='"theme"'
)
| From the app theme
| From theme
label.btn.btn-secondary
input(
type='radio',
[value]='"colorScheme"'
)
| From the terminal colors
| From colors
.form-group
label Shell
input.form-control(
type='text',
[ngbTypeahead]='shellAutocomplete',
select.form-control(
'[(ngModel)]'='config.store.terminal.shell',
(ngModelChange)='config.save()',
)
option(
*ngFor='let shell of shells',
[ngValue]='shell.command'
) {{shell.name}}
.form-group
label Terminal bell
br

View File

@ -10,13 +10,18 @@ import { ConfigService, HostAppService, Platform } from 'terminus-core'
import { TerminalColorSchemeProvider, ITerminalColorScheme } from '../api'
interface IShell {
name: string
command: string
}
@Component({
template: require('./terminalSettingsTab.component.pug'),
styles: [require('./terminalSettingsTab.component.scss')],
})
export class TerminalSettingsTabComponent {
fonts: string[] = []
shells: string[] = []
shells: IShell[] = []
colorSchemes: ITerminalColorScheme[] = []
equalComparator = equal
editingColorScheme: ITerminalColorScheme
@ -44,11 +49,22 @@ export class TerminalSettingsTabComponent {
this.fonts.sort()
})
}
if (this.hostApp.platform == Platform.Windows) {
this.shells = [
{ name: 'CMD', command: 'cmd.exe' },
{ name: 'PowerShell', command: 'powershell.exe' },
]
const wslPath =`${process.env.windir}\\system32\\bash.exe`
if (await fs.exists(wslPath)) {
this.shells.push({ name: 'Bash on Windows', command: wslPath })
}
}
if (this.hostApp.platform == Platform.Linux || this.hostApp.platform == Platform.macOS) {
this.shells = (await fs.readFile('/etc/shells', 'utf-8'))
.split('\n')
.map(x => x.trim())
.filter(x => x && !x.startsWith('#'))
.map(x => ({ name: x, command: x }))
}
this.colorSchemes = (await Promise.all(this.colorSchemeProviders.map(x => x.getSchemes()))).reduce((a, b) => a.concat(b))
}
@ -61,10 +77,6 @@ export class TerminalSettingsTabComponent {
.map(list => Array.from(new Set(list)))
}
shellAutocomplete = (text$: Observable<string>) => {
return text$.map(_ => ['auto'].concat(this.shells))
}
editScheme (scheme: ITerminalColorScheme) {
this.editingColorScheme = scheme
this.schemeChanged = false

View File

@ -23,7 +23,7 @@ export class TerminalConfigProvider extends ConfigProvider {
[Platform.macOS]: {
terminal: {
font: 'Menlo',
shell: 'zsh',
shell: '/bin/zsh',
},
hotkeys: {
'new-tab': [
@ -49,7 +49,7 @@ export class TerminalConfigProvider extends ConfigProvider {
[Platform.Linux]: {
terminal: {
font: 'Liberation Mono',
shell: 'auto',
shell: '/bin/bash',
},
hotkeys: {
'new-tab': [

View File

@ -22,8 +22,5 @@
"es7"
]
},
"compileOnSave": false,
"exclude": [
"node_modules"
]
"include": ["src"]
}

View File

@ -29,10 +29,9 @@ module.exports = {
}
}
},
{ test: /schemes\/.*$/, use: "raw-loader" },
{ test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
{ test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
{ test: /\.css$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
{ test: /\.css$/, use: ['to-string-loader', 'css-loader'] },
]
},
externals: [

View File

@ -14,7 +14,5 @@
"es7"
]
},
"exclude": [
"node_modules"
]
"include": ["src"]
}