From 37cb39cbc62d52ba45ad158d52a8239adf4db7f6 Mon Sep 17 00:00:00 2001 From: Ramiro Saenz Date: Mon, 23 May 2016 14:44:19 -0300 Subject: [PATCH] Build configurations Added packager and builder libraries. --- app.json | 4 +- app/package.json | 27 ++++++++++ electron_main.js => electron/main.js | 12 ++--- electron/tray.js | 7 ++- package.json | 79 ++++++++++++++++++---------- 5 files changed, 90 insertions(+), 39 deletions(-) create mode 100644 app/package.json rename electron_main.js => electron/main.js (89%) diff --git a/app.json b/app.json index a2ff4665..d5c1c783 100644 --- a/app.json +++ b/app.json @@ -277,9 +277,7 @@ * Extra resources to be copied along when build */ "resources": [ - "electron", - "electron_main.js", - "package.json" + "electron" ], /** diff --git a/app/package.json b/app/package.json new file mode 100644 index 00000000..88cdf370 --- /dev/null +++ b/app/package.json @@ -0,0 +1,27 @@ +{ + "name": "Rambox", + "productName": "Rambox", + "version": "0.2.0", + "description": "Free and Open Source messaging and emailing app that combines common web applications into one.", + "main": "electron/main.js", + "private": true, + "repository": { + "type": "git", + "url": "git+https://github.com/saenzramiro/rambox.git" + }, + "keywords": [ + "Rambox", + "messaging", + "app", + "slack", + "whatsapp", + "facebook", + "messenger", + "telegram", + "google", + "hangouts", + "skype" + ], + "author": "Ramiro Saenz", + "license": "MIT" +} diff --git a/electron_main.js b/electron/main.js similarity index 89% rename from electron_main.js rename to electron/main.js index e9b8ddb3..487401fb 100644 --- a/electron_main.js +++ b/electron/main.js @@ -5,14 +5,12 @@ const electron = require('electron'); const app = electron.app; // Module to create native browser window. const BrowserWindow = electron.BrowserWindow; -// Module to create tray icon -const Tray = electron.Tray; // Module for shell const shell = require('electron').shell; // Require for menu file -const appMenu = require('./electron/menu'); +const appMenu = require('./menu'); // Require for tray file -const tray = require('./electron/tray'); +const tray = require('./tray'); const MenuItem = electron.MenuItem; @@ -25,8 +23,8 @@ function createWindow () { // Create the browser window. mainWindow = new BrowserWindow({ title: 'Rambox' - ,skipTaskbar: false - ,icon: __dirname + '/resources/Icon.png' + ,skipTaskbar: true + ,icon: __dirname + '/../resources/Icon.png' ,webPreferences: { webSecurity: false ,nodeIntegration: true @@ -39,7 +37,7 @@ function createWindow () { mainWindow.maximize(); // and load the index.html of the app. - mainWindow.loadURL('file://' + __dirname + '/index.html'); + mainWindow.loadURL('file://' + __dirname + '/../index.html'); electron.Menu.setApplicationMenu(appMenu); diff --git a/electron/tray.js b/electron/tray.js index 8001aa2d..ddab4587 100644 --- a/electron/tray.js +++ b/electron/tray.js @@ -1,6 +1,9 @@ const path = require('path'); const electron = require('electron'); const app = electron.app; +// Module to create tray icon +const Tray = electron.Tray; + const MenuItem = electron.MenuItem; let tray = null; @@ -9,7 +12,7 @@ exports.create = win => { return; } - const icon = process.platform === 'linux' ? 'IconTray.png' : 'Icon.ico'; + const icon = process.platform === 'linux' || process.platform === 'darwin' ? 'IconTray.png' : 'Icon.ico'; const iconPath = path.join(__dirname, `../resources/${icon}`); let showMB = new MenuItem({ @@ -50,7 +53,7 @@ exports.create = win => { } ]); - tray = new electron.Tray(iconPath); + tray = new Tray('../resources/IconTray.png'); tray.setToolTip('Rambox'); tray.setContextMenu(contextMenu); tray.on('click', function() { diff --git a/package.json b/package.json index e67315c2..f131346e 100644 --- a/package.json +++ b/package.json @@ -1,35 +1,60 @@ { - "name": "Rambox", - "version": "0.2.0", - "description": "Free and Open Source messaging and emailing app that combines common web applications into one.", - "main": "electron_main.js", + "private": true, "scripts": { - "start": "electron electron_main.js" + "start": "electron electron/main.js", + "start:dev": "electron electron/main.js --enable-logging", + + "sencha:clean": "rm -rf ./build/production", + "sencha:compile": "sencha app build && cp app/package.json build/production/Rambox/", + + "clean": "rm -rf ./dist", + "clean:osx": "rm -rf ./dist/Rambox-darwin-*", + "clean:win": "rm -rf ./dist/Rambox-win32-*", + + "pack": "npm run pack:osx && npm run pack:win", + "pack:osx": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=darwin --arch=x64 --icon=resources/installer/Icon.icns --app-version=0.2.0 --build-version=64-bit --overwrite", + "pack:win": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=win32 --arch=ia32 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --overwrite", + + "build": "npm run build:osx && npm run build:win", + "build:osx": "build \"dist/Rambox-darwin-x64/Rambox.app\" --platform=osx", + "build:win": "build \"dist/Rambox-win32-ia32\" --platform=win", + + "all:osx": "npm run sencha:clean && npm run sencha:compile && npm run clean:osx && npm run pack:osx && npm run build:osx" }, - "repository": { - "type": "git", - "url": "git+https://github.com/saenzramiro/rambox.git" + "build": { + "productName": "Rambox", + "asar": true, + "osx" : { + "title": "Rambox", + "icon-size": 128, + "contents": [ + { "x": 355, "y": 125, "type": "link", "path": "/Applications" }, + { "x": 155, "y": 125, "type": "file" } + ] + }, + "win" : { + "title": "Rambox", + "icon": "resources/installer/Icon.ico" + } }, - "keywords": [ - "Rambox", - "messaging", - "app", - "slack", - "whatsapp", - "facebook", - "messenger", - "telegram", - "google", - "hangouts", - "skype" - ], - "author": "Ramiro Saenz", - "license": "MIT", - "bugs": { - "url": "https://github.com/saenzramiro/rambox/issues" + "directories": { + "buildResources": "resources/installer/", + "output": "dist/", + "app": "build/production/Rambox/" }, - "homepage": "https://github.com/saenzramiro/rambox#readme", "devDependencies": { - "electron-prebuilt": "^0.37.8" + "electron-prebuilt": "^1.1.0", + "electron-builder": "3.25.0", + "electron-packager": "7.0.1" + }, + "config": { + "pre-git": { + "commit-msg": "", + "pre-commit": [], + "post-commit": "", + "pre-push": [], + "post-checkout": "", + "post-merge": "" + } } }