From 4d2243e6b570c71d236b12e0279a676c2145d086 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 1 Nov 2015 19:21:54 +0000 Subject: [PATCH] Initialised project (mainly with filler) --- package.json | 7 +++++-- scripts/build-js.sh | 10 ++++------ src/index.html | 15 ++++++++++++++- src/main.js | 35 ++++++++++++++++++++++++++++++++++- 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 252ba2d..545996e 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,13 @@ "description": "Make your computer keyboard sound like a mechanical keyboard", "main": "build/main.js", "scripts": { + "create-build-dirs": "mkdir -p build/lib build/js build/css build/img dist/ ", + "clean": "rm -rf node_modules/ dist/ build/", "build-js": " bash scripts/build-js.sh", - "start": "node_modules/.bin/electron build/", + "start": "node_modules/.bin/electron .", "test": "echo \"Error: no test specified\" && exit 1", - "lint": "eslint -c node_modules/eslint-config/.eslintrc 'src/'" + "lint": "eslint -c node_modules/eslint-config/.eslintrc 'src/'", + "build-html": "cp src/index.html build/index.html" }, "repository": { "type": "git", diff --git a/scripts/build-js.sh b/scripts/build-js.sh index e33edac..c5de4fd 100644 --- a/scripts/build-js.sh +++ b/scripts/build-js.sh @@ -2,15 +2,13 @@ set -e -cp node_modules/bootstrap/dist/js/bootstrap.js static/src/js/lib/ - echo ">> Building Libraries..." -uglifyjs node_modules/jquery/dist/jquery.js --compress --screw-ie8 --define --stats --keep-fnames -o build/lib/jquery.js +# uglifyjs node_modules/jquery/dist/jquery.js --compress --screw-ie8 --define --stats --keep-fnames -o build/lib/jquery.js uglifyjs node_modules/bootstrap/dist/js/bootstrap.js --compress --screw-ie8 --define --stats --keep-fnames -o build/lib/bootstrap.js echo ">> Building Application JS..." -browserify -t reactify src/page.js -o build/page.js -uglifyjs build/js/app.js --compress --screw-ie8 --define --stats --keep-fnames -o src/js/app.js +browserify -t reactify src/js/app.js -o build/js/app.js +uglifyjs build/js/app.js --compress --screw-ie8 --define --stats --keep-fnames -o build/js/app.js echo ">> Building Main JS..." -uglifyjs build/main.js --compress --screw-ie8 --define --stats --keep-fnames -o src/main.js +uglifyjs src/main.js --compress --screw-ie8 --define --stats --keep-fnames -o build/main.js diff --git a/src/index.html b/src/index.html index 64233a9..cb4e9f8 100644 --- a/src/index.html +++ b/src/index.html @@ -1 +1,14 @@ -index.html \ No newline at end of file + + + + + Hello World! + + +

Hello World!

+ We are using node , + Chrome , + and Electron . + + + diff --git a/src/main.js b/src/main.js index 82df346..6e4d7f8 100644 --- a/src/main.js +++ b/src/main.js @@ -1 +1,34 @@ -main.js \ No newline at end of file +var app = require('app'); +var BrowserWindow = require('browser-window'); +var Menu = require('menu'); +var globalShortcut = require('global-shortcut') +var fs = require('fs'); +var Tray = require('tray'); + +require('crash-reporter').start(); // Start crash reporter + +// Creating menu +var menu = new Menu(); +Menu.setApplicationMenu(menu); +var mainWindow = null; + + +// Make sure the application closes +app.on('window-all-closed', function () { + app.quit(); +}); + +app.on('ready', function () { + mainWindow = new BrowserWindow({ + width: 800, + height: 600 + }); + console.log(__dirname); + mainWindow.loadUrl('file://' + __dirname + '/index.html'); + + mainWindow.toggleDevTools(); + + mainWindow.on('closed', function() { + mainWindow = undefined; + }); +}); \ No newline at end of file