Skip to content

Commit

Permalink
fix(electron): match new electron forge config
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMason committed May 10, 2020
1 parent 331b0ac commit 84d128b
Show file tree
Hide file tree
Showing 9 changed files with 585 additions and 3,633 deletions.
12 changes: 6 additions & 6 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module.exports = {
makers: [
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
],
packagerConfig: {
icon: 'assets/icons/mac/astexplorer',
name: 'ASTExplorer',
overwrite: true,
ignore: ['/scripts', '/static', '/vendor/astexplorer/website'],
packageManager: 'yarn',
},
makers: [
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
],
github_repository: {
owner: 'JamieMason',
name: 'astexplorer.app',
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@
"dependencies": {
"chalk": "4.0.0",
"chokidar": "3.4.0",
"electron-compile": "6.4.4",
"electron-devtools-installer": "3.0.0",
"electron-squirrel-startup": "1.0.0",
"memory-fs": "0.5.0",
"rollup": "2.9.0"
},
"devDependencies": {
"@electron-forge/cli": "6.0.0-beta.51",
"@electron-forge/maker-zip": "6.0.0-beta.51",
"babel-plugin-transform-async-to-generator": "6.24.1",
"babel-preset-env": "1.7.0",
"babel-preset-react": "6.24.1",
"commit-release": "1.2.4",
"electron-forge": "5.2.4",
"electron-prebuilt-compile": "8.2.0",
"electron": "8.2.5",
"eslint": "^7",
"eslint-config-airbnb": "^18",
"eslint-plugin-import": "^2",
Expand Down
4 changes: 3 additions & 1 deletion src/main/app-menu.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { app, Menu, shell } = require('electron');

export const create = () => {
const create = () => {
const appMenu = {
label: app.getName(),
submenu: [
Expand Down Expand Up @@ -67,3 +67,5 @@ export const create = () => {
Menu.buildFromTemplate([appMenu, editMenu, viewMenu, windowMenu, helpMenu]),
);
};

module.exports = { create };
6 changes: 4 additions & 2 deletions src/main/app-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const installDevtools = (names) => {

app.on('will-quit', dereference);

export const create = async () => {
const create = async () => {
if (win) {
throw new Error('attempt to recreate existing app window');
}
Expand All @@ -50,9 +50,11 @@ export const create = async () => {
win.webContents.insertCSS(cssOverrides);
};

export const sendEvent = (name, data) => {
const sendEvent = (name, data) => {
if (!win) {
throw new Error('attempt to send event to missing app window');
}
win.webContents.send(name, data);
};

module.exports = { create, sendEvent };
4 changes: 3 additions & 1 deletion src/main/file-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const transformNamesById = {
tslint: 'TSLint Rule',
};

export const openTransform = (id) =>
const openTransform = (id) =>
new Promise((done) => {
const transformName = transformNamesById[id] || 'Transform';
dialog.showOpenDialog(
Expand All @@ -28,3 +28,5 @@ export const openTransform = (id) =>
done(Array.isArray(files) && files.length === 1 ? files[0] : ''),
);
});

module.exports = { openTransform };
4 changes: 3 additions & 1 deletion src/main/file-watcher.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const chokidar = require('chokidar');

export const create = (onChange) => {
const create = (onChange) => {
let filePath = '';
let watcher = null;

Expand Down Expand Up @@ -45,3 +45,5 @@ export const create = (onChange) => {
stop,
};
};

module.exports = { create };
8 changes: 5 additions & 3 deletions src/main/log.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const chalk = require('chalk');

export const error = (...args) => console.error(chalk.red('[FAIL]'), ...args);
export const info = (...args) => console.info(chalk.blue('[INFO]'), ...args);
export const warn = (...args) => console.warn(chalk.yellow('[WARN]'), ...args);
const error = (...args) => console.error(chalk.red('[FAIL]'), ...args);
const info = (...args) => console.info(chalk.blue('[INFO]'), ...args);
const warn = (...args) => console.warn(chalk.yellow('[WARN]'), ...args);

module.exports = { error, info, warn };
4 changes: 3 additions & 1 deletion src/main/rollup-watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const getBundledSource = async (filePath) => {
return code;
};

export const create = (onChange) => {
const create = (onChange) => {
const watcher = fileWatcher.create(async (filePath) => {
try {
const bundledSource = await getBundledSource(filePath);
Expand All @@ -34,3 +34,5 @@ export const create = (onChange) => {
},
};
};

module.exports = { create };
Loading

0 comments on commit 84d128b

Please sign in to comment.