Skip to content
Permalink
Browse files

[DDW-597] fix issue with pretty-quick

  • Loading branch information...
DominikGuzei committed Mar 13, 2019
1 parent d81f09a commit 40f61753242c3c48eb03e4f590eae62ce5ce074a
Showing with 37 additions and 18 deletions.
  1. +23 −0 .prettierignore
  2. +3 −3 package.json
  3. +11 −15 source/main/windows/main.js
@@ -0,0 +1,23 @@
# Let's start by ignoring everything
/*

# But not the following folders
!source/
!features/
!storybook/

# Now we ignore all files
*.*

# But not these file types
!*.js
!*.scss
!*.json

# Ignore any top-level json file except package.json
/*.json
!package.json

# Ignore the following special folders and files
source/renderer/app/i18n/locales/
features/support/default-wallet.json
@@ -23,8 +23,8 @@
"cucumber:watch:debug": "KEEP_APP_AFTER_TESTS=true npm run cucumber -- --tags @watch",
"lint": "eslint --format=node_modules/eslint-formatter-pretty source features storybook *.js",
"flow:test": "flow; test $? -eq 0 -o $? -eq 2",
"prettier": "./node_modules/.bin/prettier --ignore-path .eslintignore \"./**/*.{js,scss,json}\"",
"prettier:check": "yarn prettier -c",
"prettier": "./node_modules/.bin/prettier \"**/*.*\"",
"prettier:check": "yarn prettier --check",
"prettier:format": "yarn prettier --write --loglevel warn",
"manage:translations": "gulp purge:translations && gulp clear:cache && gulp build && node ./translations/translation-runner.js",
"storybook": "start-storybook -p 6006 -c storybook",
@@ -184,7 +184,7 @@
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged --pattern \"./**/*.{js,scss,json}\"",
"pre-commit": "pretty-quick --staged",
"pre-push": "yarn prettier:check && yarn lint && yarn flow:test && yarn manage:translations"
}
}
@@ -13,10 +13,7 @@ const { isDev, isTest, buildLabel, isLinux } = environment;

const id = 'window';

const getWindowTitle = (
isInSafeMode: boolean,
locale: string,
): string => {
const getWindowTitle = (isInSafeMode: boolean, locale: string): string => {
const translations = require(`../locales/${locale}`);
const translation = getTranslation(translations, id);
let title = buildLabel;
@@ -37,10 +34,7 @@ type WindowOptionsType = {
icon?: string,
};

export const createMainWindow = (
isInSafeMode: boolean,
locale: string,
) => {
export const createMainWindow = (isInSafeMode: boolean, locale: string) => {
const windowOptions: WindowOptionsType = {
show: false,
width: 1150,
@@ -49,8 +43,8 @@ export const createMainWindow = (
nodeIntegration: isTest,
webviewTag: false,
enableRemoteModule: isTest,
preload: path.join(__dirname, './preload.js')
}
preload: path.join(__dirname, './preload.js'),
},
};

if (isLinux) {
@@ -74,13 +68,15 @@ export const createMainWindow = (
});

// Provide render process with an api to close the main window
ipcMain.on('close-window', (event) => {
ipcMain.on('close-window', event => {
if (event.sender !== window.webContents) return;
window.close();
});

window.loadURL(`file://${__dirname}/../renderer/index.html`);
window.on('page-title-updated', event => { event.preventDefault(); });
window.on('page-title-updated', event => {
event.preventDefault();
});
window.setTitle(getWindowTitle(isInSafeMode, locale));

window.webContents.on('context-menu', (e, props) => {
@@ -95,7 +91,7 @@ export const createMainWindow = (
label: 'Inspect element',
click() {
window.inspectElement(x, y);
}
},
});
}

@@ -127,11 +123,11 @@ export const createMainWindow = (
app.quit();
});

window.webContents.on('did-fail-load', (err) => {
window.webContents.on('did-fail-load', err => {
rendererErrorHandler.onError('did-fail-load', err);
});

window.webContents.on('crashed', (err) => {
window.webContents.on('crashed', err => {
rendererErrorHandler.onError('crashed', err);
});

0 comments on commit 40f6175

Please sign in to comment.
You can’t perform that action at this time.