mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-20 02:18:01 +00:00
lint
This commit is contained in:
@@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'
|
||||
import { BrowserModule } from '@angular/platform-browser'
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
|
||||
export async function getRootModule(plugins: any[]): Promise<any> {
|
||||
export async function getRootModule (plugins: any[]): Promise<any> {
|
||||
let imports = [
|
||||
BrowserModule,
|
||||
...(plugins.map(x => x.default.forRoot ? x.default.forRoot() : x.default)),
|
||||
@@ -12,7 +12,7 @@ export async function getRootModule(plugins: any[]): Promise<any> {
|
||||
...(plugins.filter(x => x.bootstrap).map(x => x.bootstrap)),
|
||||
]
|
||||
|
||||
if (bootstrap.length == 0) {
|
||||
if (bootstrap.length === 0) {
|
||||
throw new Error('Did not find any bootstrap components. Are there any plugins installed?')
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
(<any>console).timeStamp('entry point')
|
||||
|
||||
import 'core-js'
|
||||
import 'zone.js/dist/zone.js'
|
||||
import 'core-js/es7/reflect'
|
||||
@@ -14,7 +12,7 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
|
||||
import { getRootModule } from './app.module'
|
||||
import { findPlugins, loadPlugins } from './plugins'
|
||||
|
||||
if ((<any>global).require('electron-is-dev')) {
|
||||
if (require('electron-is-dev')) {
|
||||
console.warn('Running in debug mode')
|
||||
} else {
|
||||
enableProdMode()
|
||||
@@ -22,7 +20,7 @@ if ((<any>global).require('electron-is-dev')) {
|
||||
|
||||
findPlugins().then(async plugins => {
|
||||
let pluginsModules = await loadPlugins(plugins, (current, total) => {
|
||||
(<HTMLElement>document.querySelector('.progress .bar')).style.width = 100 * current / total + '%'
|
||||
(document.querySelector('.progress .bar') as HTMLElement).style.width = 100 * current / total + '%'
|
||||
})
|
||||
let module = await getRootModule(pluginsModules)
|
||||
platformBrowserDynamic().bootstrapModule(module)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import * as fs from 'fs-promise'
|
||||
import * as path from 'path'
|
||||
const nodeModule = (<any>global).require('module')
|
||||
const nodeModule = require('module')
|
||||
const nodeRequire = (global as any).require
|
||||
|
||||
function normalizePath (path: string): string {
|
||||
const cygwinPrefix = '/cygdrive/'
|
||||
@@ -9,9 +10,9 @@ function normalizePath (path: string): string {
|
||||
path = path[0] + ':' + path.substring(1)
|
||||
}
|
||||
return path
|
||||
};
|
||||
}
|
||||
|
||||
(<any>global).require.main.paths.map(x => nodeModule.globalPaths.push(normalizePath(x)))
|
||||
nodeRequire.main.paths.map(x => nodeModule.globalPaths.push(normalizePath(x)))
|
||||
|
||||
if (process.env.DEV) {
|
||||
nodeModule.globalPaths.unshift(path.dirname(require('electron').remote.app.getAppPath()))
|
||||
@@ -80,10 +81,10 @@ export async function loadPlugins (foundPlugins: IPluginEntry[], progress: Progr
|
||||
progress(0, 1)
|
||||
let index = 0
|
||||
for (let foundPlugin of foundPlugins) {
|
||||
console.info(`Loading ${foundPlugin.name}: ${(<any>global).require.resolve(foundPlugin.path)}`)
|
||||
console.info(`Loading ${foundPlugin.name}: ${nodeRequire.resolve(foundPlugin.path)}`)
|
||||
progress(index, foundPlugins.length)
|
||||
try {
|
||||
let pluginModule = (<any>global).require(foundPlugin.path)
|
||||
let pluginModule = nodeRequire(foundPlugin.path)
|
||||
plugins.push(pluginModule)
|
||||
} catch (error) {
|
||||
console.error(`Could not load ${foundPlugin.name}:`, error)
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { Component } from '@angular/core'
|
||||
|
||||
|
||||
@Component({
|
||||
template: '<app-root></app-root>'
|
||||
})
|
||||
|
@@ -27,12 +27,5 @@
|
||||
"*/node_modules",
|
||||
"terminus*",
|
||||
"platforms"
|
||||
],
|
||||
"filesGlob" : [
|
||||
"app/src/*.ts",
|
||||
"app/src/**/*.ts",
|
||||
"!node_modules/**",
|
||||
"!app/node_modules/**",
|
||||
"!*/node_modules/**"
|
||||
]
|
||||
}
|
||||
|
@@ -57,6 +57,7 @@ module.exports = {
|
||||
'@ng-bootstrap/ng-bootstrap': 'commonjs @ng-bootstrap/ng-bootstrap',
|
||||
'fs-promise': 'commonjs fs-promise',
|
||||
'electron': 'commonjs electron',
|
||||
'electron-is-dev': 'commonjs electron-is-dev',
|
||||
'module': 'commonjs module',
|
||||
'path': 'commonjs path',
|
||||
'rxjs': 'commonjs rxjs',
|
||||
|
Reference in New Issue
Block a user