From 0bf4e683394f67e7603deb50961edad6f2208f76 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Sat, 14 Jul 2018 12:36:46 +0530 Subject: [PATCH 1/3] [sass] support imports that start with ~ --- .postcssrc.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.postcssrc.js b/.postcssrc.js index eee3e92d..d0424ec0 100644 --- a/.postcssrc.js +++ b/.postcssrc.js @@ -2,7 +2,15 @@ module.exports = { "plugins": { - "postcss-import": {}, + "postcss-import": { + resolve(id) { + // sass imports that start with ~ (which refers node_modules) should be supported + if (id.startsWith('~')) { + return id.slice(1); + } + return id; + } + }, "postcss-url": {}, // to edit target browsers: use "browserslist" field in package.json "autoprefixer": {} From cda0bbffc7da3f76bd745aadda890b851fe6c0c9 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Sat, 14 Jul 2018 13:02:01 +0530 Subject: [PATCH 2/3] Use frappeVue plugin instead of manual initialization --- src/main.js | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/src/main.js b/src/main.js index 983d7001..fb835af5 100644 --- a/src/main.js +++ b/src/main.js @@ -5,6 +5,7 @@ import Vue from 'vue'; import App from './App'; import router from './router'; +import frappeVue from 'frappejs/ui/plugins/frappeVue'; // frappejs imports import io from 'socket.io-client'; @@ -14,16 +15,6 @@ import Observable from 'frappejs/utils/observable'; import common from 'frappejs/common'; import coreModels from 'frappejs/models'; import models from '../models'; -import { _ } from 'frappejs/utils'; - -// vue components -import NotFound from 'frappejs/ui/components/NotFound'; -import FeatherIcon from 'frappejs/ui/components/FeatherIcon'; -import FrappeControl from 'frappejs/ui/components/controls/FrappeControl'; -import Button from 'frappejs/ui/components/Button'; -import Indicator from 'frappejs/ui/components/Indicator'; -import modalPlugin from 'frappejs/ui/components/Modal/plugin'; -import formModalPlugin from 'frappejs/ui/plugins/formModal'; import registerReportMethods from '../reports'; frappe.init(); @@ -54,29 +45,7 @@ frappe.getSingle('AccountingSettings') window.frappe = frappe; Vue.config.productionTip = false; - -Vue.component('not-found', NotFound); -Vue.component('feather-icon', FeatherIcon); -Vue.component('frappe-control', FrappeControl); -Vue.component('f-button', Button); -Vue.component('indicator', Indicator); - -Vue.use(modalPlugin); -Vue.use(formModalPlugin); - -Vue.mixin({ - computed: { - frappe() { - return frappe; - } - }, - methods: { - // global translation function in every component - _(...args) { - return _(...args); - } - } -}); +Vue.use(frappeVue); /* eslint-disable no-new */ new Vue({ From e9d2f5c2c24ad97964c35221e731c58d6dd9f2c6 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Sat, 14 Jul 2018 18:45:21 +0530 Subject: [PATCH 3/3] Initialize docs in frappe.init --- electron/settings.js | 22 ++--- src/main.js | 5 +- src/pages/SetupWizard/index.vue | 169 ++++++++++++++++---------------- 3 files changed, 98 insertions(+), 98 deletions(-) diff --git a/electron/settings.js b/electron/settings.js index 4dcf0fb2..18f8e654 100644 --- a/electron/settings.js +++ b/electron/settings.js @@ -6,21 +6,21 @@ const homedir = os.homedir(); const configFilePath = path.join(homedir, '.config', 'frappe-accounting', 'settings.json'); function getSettings() { - let settings; - try { - settings = require(configFilePath); - } catch (e) { - settings = {} - } + let settings; + try { + settings = require(configFilePath); + } catch (e) { + settings = {}; + } - return settings; + return settings; } async function saveSettings(settings) { - await writeFile(configFilePath, JSON.stringify(settings)); + await writeFile(configFilePath, JSON.stringify(settings)); } module.exports = { - getSettings, - saveSettings -} + getSettings, + saveSettings +}; diff --git a/src/main.js b/src/main.js index fb835af5..1d6aa259 100644 --- a/src/main.js +++ b/src/main.js @@ -8,10 +8,9 @@ import router from './router'; import frappeVue from 'frappejs/ui/plugins/frappeVue'; // frappejs imports -import io from 'socket.io-client'; import frappe from 'frappejs'; +import io from 'socket.io-client'; import HTTPClient from 'frappejs/backends/http'; -import Observable from 'frappejs/utils/observable'; import common from 'frappejs/common'; import coreModels from 'frappejs/models'; import models from '../models'; @@ -26,8 +25,6 @@ frappe.fetch = window.fetch.bind(); frappe.db = new HTTPClient({ server }); const socket = io.connect(`http://${server}`); frappe.db.bindSocketClient(socket); -frappe.registerModels(models); -frappe.docs = new Observable(); frappe.getSingle('SystemSettings'); registerReportMethods(); diff --git a/src/pages/SetupWizard/index.vue b/src/pages/SetupWizard/index.vue index d724cb0a..a6f6d873 100644 --- a/src/pages/SetupWizard/index.vue +++ b/src/pages/SetupWizard/index.vue @@ -1,36 +1,36 @@