1
0
mirror of https://github.com/rhysd/Mstdn.git synced 2024-11-28 20:24:10 +01:00

update dependencies and fix lint errors

This commit is contained in:
rhysd 2017-08-30 12:40:43 +09:00
parent 33c3b4df5f
commit 496cacb8c8
5 changed files with 69 additions and 66 deletions

View File

@ -49,7 +49,8 @@ export default class AccountSwitcher extends EventEmitter {
submenu,
});
const menu = Menu.getApplicationMenu();
// Note: Electron's type definitions don't support nullable types yet.
const menu = Menu.getApplicationMenu() as Electron.Menu | null;
if (menu !== null) {
// Insert item before 'Help'
menu.insert(menu.items.length - 1, item);

View File

@ -34,7 +34,9 @@ export default class Window {
public browser: Electron.BrowserWindow,
public state: any /*XXX: ElectronWindowState.WindowState */,
public account: Account,
/* tslint:disable:no-shadowed-variable */
public menubar: Menubar.MenubarApp | null,
/* tslint:enable:no-shadowed-variable */
) {
if (!IS_DARWIN) {
// Users can still access menu bar with pressing Alt key.

View File

@ -14,7 +14,7 @@
"build:bundle:release": "NODE_ENV=production browserify -x electron renderer/index.js -o renderer/preload.js",
"build:release": "npm run build:ts && npm run build:bundle:release",
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "tslint --project tsconfig.json --type-check $(git ls-files | grep -E \"\\.ts$\")",
"lint": "tslint --project tsconfig.json --type-check",
"watch": "guard --watchdir main renderer typings",
"debug": "NODE_ENV=development electron .",
"start": "NODE_ENV=production electron .",
@ -38,14 +38,14 @@
"homepage": "https://github.com/rhysd/Mstdn#readme",
"devDependencies": {
"@types/electron-window-state": "^2.0.29",
"@types/loglevel": "^1.4.29",
"@types/loglevel": "^1.4.30",
"@types/mousetrap": "^1.5.34",
"@types/node": "^8.0.0",
"@types/node": "^8.0.26",
"browserify": "^14.4.0",
"electron-packager": "^8.7.1",
"npm-run-all": "^4.0.2",
"tslint": "^5.4.3",
"typescript": "^2.3.4"
"electron-packager": "^9.0.0",
"npm-run-all": "^4.1.1",
"tslint": "^5.7.0",
"typescript": "^2.4.2"
},
"dependencies": {
"electron": "^1.7.5",

View File

@ -1,4 +1,4 @@
import * as path from 'path';
import {join} from 'path';
import {remote} from 'electron';
import * as Mousetrap from 'mousetrap';
import * as Ipc from './ipc';
@ -71,7 +71,7 @@ export default function setupKeymaps(
log.info('Loading external script is limited because Chromium sandbox is enabled. Disable shortcut:', action);
continue;
}
const script = path.join(dataDir, action);
const script = join(dataDir, action);
let plugin: (c: Config, a: Account) => void;
try {

112
typings/menubar.d.ts vendored
View File

@ -1,61 +1,61 @@
declare namespace Menubar {
type Position
= "trayLeft"
| "trayBottomLeft"
| "trayRight"
| "trayBottomRight"
| "trayCenter"
| "trayBottomCenter"
| "topLeft"
| "topRight"
| "bottomLeft"
| "bottomRight"
| "topCenter"
| "bottomCenter"
| "center";
type TrayBounds
= "trayLeft"
| "trayBottomLeft"
| "trayRight"
| "trayBottomRight"
| "trayCenter"
| "trayBottomCenter";
interface ElectronPositioner {
move(pos: Position): void;
calculate(pos: Position, bounds?: TrayBounds): Electron.Point;
}
class MenubarApp extends NodeJS.EventEmitter {
app: Electron.App;
window: Electron.BrowserWindow;
tray: Electron.Tray;
positioner: ElectronPositioner;
type Position
= 'trayLeft'
| 'trayBottomLeft'
| 'trayRight'
| 'trayBottomRight'
| 'trayCenter'
| 'trayBottomCenter'
| 'topLeft'
| 'topRight'
| 'bottomLeft'
| 'bottomRight'
| 'topCenter'
| 'bottomCenter'
| 'center';
type TrayBounds
= 'trayLeft'
| 'trayBottomLeft'
| 'trayRight'
| 'trayBottomRight'
| 'trayCenter'
| 'trayBottomCenter';
interface ElectronPositioner {
move(pos: Position): void;
calculate(pos: Position, bounds?: TrayBounds): Electron.Point;
}
class MenubarApp extends NodeJS.EventEmitter {
app: Electron.App;
window: Electron.BrowserWindow;
tray: Electron.Tray;
positioner: ElectronPositioner;
setOption(opt: string, value: any): void;
getOption(opt: string): any;
showWindow(): void;
hideWindow(): void;
}
interface MenubarOptions extends Electron.BrowserWindowConstructorOptions {
dir?: string;
index?: string;
tooltip?: string;
tray?: Electron.Tray;
icon?: string;
width?: number;
height?: number;
show?: boolean;
preloadWindow?: boolean;
alwaysOnTop?: boolean;
showOnAllWorkspaces?: boolean;
windowPosition?: Position;
showDockIcon?: boolean;
showOnRightClick?: boolean;
autoHideMenuBar?: boolean;
webPreferences?: Electron.WebPreferences;
}
setOption(opt: string, value: any): void;
getOption(opt: string): any;
showWindow(): void;
hideWindow(): void;
}
interface MenubarOptions extends Electron.BrowserWindowConstructorOptions {
dir?: string;
index?: string;
tooltip?: string;
tray?: Electron.Tray;
icon?: string;
width?: number;
height?: number;
show?: boolean;
preloadWindow?: boolean;
alwaysOnTop?: boolean;
showOnAllWorkspaces?: boolean;
windowPosition?: Position;
showDockIcon?: boolean;
showOnRightClick?: boolean;
autoHideMenuBar?: boolean;
webPreferences?: Electron.WebPreferences;
}
}
declare module "menubar" {
const ctor: (opts?: Menubar.MenubarOptions) => Menubar.MenubarApp;
export = ctor;
declare module 'menubar' {
const ctor: (opts?: Menubar.MenubarOptions) => Menubar.MenubarApp;
export = ctor;
}