Skip to content

Commit 4b2d137

Browse files
committedAug 25, 2018
Fix all typescript errors
1 parent 803ed64 commit 4b2d137

File tree

7 files changed

+25
-27
lines changed

7 files changed

+25
-27
lines changed
 

Diff for: ‎gulpfile.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@ function buildRenderer() {
6767
delete webpackConfig.devtool;
6868
}
6969
// Build source
70-
gulp.src(webpackConfig.entry)
71-
.pipe(webpack(webpackConfig))
72-
.pipe(gulpif(config.isRelease, uglify()))
70+
return gulp.src(webpackConfig.entry)
71+
.pipe(webpack({
72+
...webpackConfig,
73+
mode: process.env.NODE_ENV || 'development',
74+
})
75+
// Listening for errors ensures that gulp doesn't exist when an error
76+
// happens. webpack already logs the errors to the console so we'll just
77+
// use a no-op function here.
78+
.on('error', () => {}))
7379
.pipe(gulp.dest(config.paths.renderer.dest));
7480
}
7581

Diff for: ‎package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
"fast-xml-parser": "3.12.0"
2020
},
2121
"devDependencies": {
22-
"@types/react": "16.4.10",
23-
"@types/react-dom": "16.0.7",
24-
"@types/react-router-dom": "4.3.0",
25-
"@types/react-virtualized": "9.18.6",
22+
"@types/node": "^10.9.2",
23+
"@types/react": "^16.4.11",
24+
"@types/react-dom": "^16.0.7",
25+
"@types/react-router-dom": "^4.3.0",
26+
"@types/react-virtualized": "^9.18.7",
2627
"awesome-typescript-loader": "5.2.0",
2728
"copy-webpack-plugin": "4.5.2",
2829
"cross-env": "^5.2.0",
@@ -41,7 +42,7 @@
4142
"tslint": "5.11.0",
4243
"typescript": "3.0.1",
4344
"webpack": "4.16.4",
44-
"webpack-cli": "3.1.0",
45+
"webpack-cli": "^3.1.0",
4546
"webpack-dev-server": "3.1.4",
4647
"webpack-stream": "5.1.0"
4748
}

Diff for: ‎src/main/Main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AppConfig } from '../shared/config/AppConfig';
55
import { IAppConfigData } from '../shared/config/IAppConfigData';
66
import BackgroundServices from './BackgroundServices';
77
import FlashPlayer from './FlashPlayer';
8-
import checkSanity from './checkSanity';
8+
import checkSanity from '../shared/checkSanity';
99

1010
export class Main {
1111
private _mainWindow: MainWindow = new MainWindow(this);

Diff for: ‎src/main/MainWindowPreload.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ window.External = Object.freeze({
5050
// (Slicing a "remote object" array will make a local copy of it - i think)
5151
if (callback) {
5252
// (Returns undefined if a callback is passed)
53-
Electron.remote.dialog.showOpenDialog(options,
53+
Electron.remote.dialog.showOpenDialog(options,
5454
(filePaths: string[], bookmarks: string[]) => {
55-
callback(filePaths && filePaths.slice(),
55+
callback(filePaths && filePaths.slice(),
5656
bookmarks && bookmarks.slice());
5757
}
5858
);

Diff for: ‎src/renderer/components/pages/ConfigPage.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as path from 'path';
33
import { IAppConfigData } from '../../../shared/config/IAppConfigData';
44
import { PathInput } from '../config/PathInput';
55
import { Toggle } from '../config/Toggle';
6-
import { isFlashpointValidCheck } from '../../../main/checkSanity';
6+
import { isFlashpointValidCheck } from '../../../shared/checkSanity';
77

88
export interface IConfigPageProps {
99
config: IAppConfigData;

Diff for: ‎src/main/checkSanity.ts renamed to ‎src/shared/checkSanity.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as fs from 'fs';
22
import * as path from 'path';
33
import * as util from 'util';
4-
import { isInstalled } from './Util';
5-
import { IAppConfigData } from "../shared/config/IAppConfigData";
4+
import { isInstalled } from '../main/Util';
5+
import { IAppConfigData } from "./config/IAppConfigData";
66

77
const stat = util.promisify(fs.stat);
88

Diff for: ‎webpack.config.js

+4-13
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
const path = require('path');
2-
const { CheckerPlugin } = require('awesome-typescript-loader');
2+
33
module.exports = {
44
entry: './src/renderer/index.tsx',
55
output: {
66
filename: 'main.bundle.js',
77
path: path.resolve(__dirname, './dist/renderer/'),
88
},
9-
//devtool: 'source-map',
9+
// Allows importing build-in node modules in electron render.
10+
// https://stackoverflow.com/questions/39417628/how-to-reference-node-fs-api-with-electron-in-typescript
11+
target: 'electron-renderer',
1012
resolve: {
1113
extensions: ['.js', '.json', '.ts', '.tsx'],
1214
},
@@ -18,15 +20,4 @@ module.exports = {
1820
},
1921
]
2022
},
21-
externals: {
22-
"react": "React",
23-
"react-dom": "ReactDOM",
24-
"react-virtualized": "ReactVirtualized",
25-
},
26-
plugins: [
27-
new CheckerPlugin({
28-
//configFileName: './tsconfig-renderer.json',
29-
// compiler: ???,
30-
})
31-
],
3223
};

0 commit comments

Comments
 (0)