From 7e8a6fe2f81e4630d6bd9ca0ad1a81f6dce0c598 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Fri, 30 Mar 2018 00:22:46 +0530 Subject: [PATCH] Add electron commands and files --- electron/client.js | 39 +++++++++------------------------------ electron/index.html | 2 +- package.json | 11 ++++------- 3 files changed, 14 insertions(+), 38 deletions(-) diff --git a/electron/client.js b/electron/client.js index ec2b3a9f..c84bdd41 100644 --- a/electron/client.js +++ b/electron/client.js @@ -1,33 +1,12 @@ -const client = require('frappejs/client/electron'); +const electron = require('frappejs/client/electron'); +const appClient = require('../client'); -// start server -client.start({ +electron.start({ dbPath: 'test.db', - columns: 3 -}).then(() => { + columns: 3, + models: require('../models') +}).then((frappe) => { - // require modules - frappe.registerModels(require('../models'), 'client'); - - frappe.registerView('List', 'ToDo', require('frappejs/models/doctype/ToDo/ToDoList.js')); - frappe.registerView('Form', 'FilterSelector', require('frappejs/models/doctype/FilterSelector/FilterSelectorForm.js')); - - frappe.registerView('List', 'Account', require('../models/doctype/Account/AccountList.js')); - frappe.registerView('Form', 'Account', require('../models/doctype/Account/AccountForm.js')); - - frappe.registerView('List', 'Invoice', require('../models/doctype/Invoice/InvoiceList.js')); - frappe.registerView('List', 'Customer', require('../models/doctype/Party/CustomerList.js')); - - frappe.desk.menu.addItem('ToDo', '#list/ToDo'); - frappe.desk.menu.addItem('Accounts', '#list/Account'); - frappe.desk.menu.addItem('Items', '#list/Item'); - frappe.desk.menu.addItem('Customers', '#list/Customer'); - frappe.desk.menu.addItem('Invoice', '#list/Invoice'); - frappe.desk.menu.addItem('Settings', () => frappe.desk.showFormModal('SystemSettings')); - - frappe.router.default = '#list/ToDo'; - - frappe.router.show(window.location.hash); -}); - -module.exports = false; \ No newline at end of file +module.exports = false; + appClient.start(frappe); +}); \ No newline at end of file diff --git a/electron/index.html b/electron/index.html index ff2b2f3a..a3e9514c 100644 --- a/electron/index.html +++ b/electron/index.html @@ -4,7 +4,7 @@ Document - + diff --git a/package.json b/package.json index 412507fd..5e89d22c 100644 --- a/package.json +++ b/package.json @@ -8,15 +8,12 @@ "test": "mocha tests", "start": "nodemon server.js", "watch": "rollup -c --watch", - "start-electron": "electron electron/main.js", - "electron-dev": "yarn run start-electron & yarn run watch", - "postinstall": "electron-builder install-app-deps", - "electron-pack": "electron-packager . --overwrite" + "electron": "electron electron/main.js", + "electron-pack": "electron-packager electron/main.js --overwrite", + "postinstall": "electron-builder install-app-deps" }, "dependencies": { - "frappejs": "^0.0.5", - "nunjucks": "^3.1.2", - "sqlite3": "^4.0.0" + "frappejs": "../frappejs" }, "devDependencies": { "electron": "1.8.4",