Skip to content

Commit

Permalink
Merge pull request #6 from electron/better-tsc
Browse files Browse the repository at this point in the history
build: use better tsc in build phase
  • Loading branch information
felixrieseberg authored Jun 7, 2018
2 parents 248ec24 + 59ac41b commit b52ee70
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* tslint:disable */

module.exports = {
hooks: {
generateAssets: require('./tools/tsc')
},
packagerConfig: {},
makers: [
{
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"repository": "https://github.com/electron/fiddle",
"main": "./dist/main",
"scripts": {
"build": "tsc -p tsconfig.json",
"start": "npm run build && electron-forge start",
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
Expand Down
23 changes: 23 additions & 0 deletions tools/tsc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* tslint:disable */
const childProcess = require('child_process');
const path = require('path');

module.exports = async () => {
await new Promise((resolve, reject) => {
console.info('Compiling Typescript');

const child = childProcess.spawn(
path.resolve(__dirname, '..', 'node_modules', '.bin', 'tsc'),
['-p', 'tsconfig.json'],
{
cwd: path.resolve(__dirname, '..'),
stdio: 'inherit'
}
);

child.on('exit', (code) => {
if (code === 0) return resolve();
reject(new Error('Typescript compilation failed'));
});
});
};

0 comments on commit b52ee70

Please sign in to comment.