From 8e64abc4bc91d6778588088e270b97dff0a7670d Mon Sep 17 00:00:00 2001 From: Rokt33r Date: Sun, 20 Dec 2015 15:47:29 +0900 Subject: [PATCH] cleanup code --- finder.js | 3 --- gruntfile.js | 33 +++++++++++++++++++-------------- hotkey.js | 2 -- webpack.config.production.js | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/finder.js b/finder.js index 05507a6c..e90edb8a 100755 --- a/finder.js +++ b/finder.js @@ -1,8 +1,6 @@ const electron = require('electron') const app = electron.app const Menu = electron.Menu -const ipcMain = electron.ipcMain -const path = require('path') var finderWindow = null @@ -24,4 +22,3 @@ app.on('ready', function () { finderWindow.hide() }) }) - diff --git a/gruntfile.js b/gruntfile.js index f8c4fa3c..ef018adb 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -5,8 +5,6 @@ const archiver = require('archiver') const fs = require('fs') module.exports = function (grunt) { - - // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), auth_code: grunt.file.readJSON('secret/auth_code.json'), @@ -25,27 +23,31 @@ module.exports = function (grunt) { } } }) + grunt.loadNpmTasks('grunt-electron-installer') grunt.registerTask('compile', function () { var done = this.async() var execPath = path.join('node_modules', '.bin', 'webpack') + ' --config webpack.config.production.js' grunt.log.writeln(execPath) - var compileProcess = ChildProcess.exec(execPath, + ChildProcess.exec(execPath, { env: Object.assign({}, process.env, { BABEL_ENV: 'production' }) - }, function (err, stdout, stderr) { - grunt.log.writeln(stdout) - if (err) { - grunt.log.writeln(err) - grunt.log.writeln(stderr) - done(false) - return + }, + function (err, stdout, stderr) { + grunt.log.writeln(stdout) + + if (err) { + grunt.log.writeln(err) + grunt.log.writeln(stderr) + done(false) + return + } + done() } - done() - }) + ) }) grunt.registerTask('zip', function (platform) { @@ -53,10 +55,13 @@ module.exports = function (grunt) { var archive = archiver.create('zip', {}) switch (platform) { case 'win': - archive.file(path.join('dist/Setup.exe'), { name:'Boostnote-installer-win32-x64.exe' }) + archive.file(path.join('dist/Setup.exe'), { + name: 'Boostnote-installer-win32-x64.exe' + }) + break default: done() - return + break } archive.finalize() var writeStream = fs.createWriteStream(path.join('dist/Boostnote-installer-win32-x64.zip')) diff --git a/hotkey.js b/hotkey.js index 353a509f..ff1c8ba0 100644 --- a/hotkey.js +++ b/hotkey.js @@ -1,10 +1,8 @@ const electron = require('electron') const app = electron.app -const Menu = electron.Menu const ipc = electron.ipcMain const globalShortcut = electron.globalShortcut const jetpack = require('fs-jetpack') -const path = require('path') const mainWindow = require('./atom-lib/main-window') const nodeIpc = require('@rokt33r/node-ipc') diff --git a/webpack.config.production.js b/webpack.config.production.js index 7fe46fb3..2f4f8b68 100644 --- a/webpack.config.production.js +++ b/webpack.config.production.js @@ -12,7 +12,7 @@ var opt = { publicPath: 'http://localhost:8080/assets/' } -config = { +var config = { module: { loaders: [ {