mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 10:46:32 +00:00
Enable to set configs in ~/.boostnoterc
This commit is contained in:
@@ -14,6 +14,10 @@ import InitModal from 'browser/main/modals/InitModal'
|
|||||||
import mixpanel from 'browser/main/lib/mixpanel'
|
import mixpanel from 'browser/main/lib/mixpanel'
|
||||||
import mobileAnalytics from 'browser/main/lib/AwsMobileAnalyticsConfig'
|
import mobileAnalytics from 'browser/main/lib/AwsMobileAnalyticsConfig'
|
||||||
import eventEmitter from 'browser/main/lib/eventEmitter'
|
import eventEmitter from 'browser/main/lib/eventEmitter'
|
||||||
|
import RcParser from 'browser/main/lib/RcParser'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
|
const BOOSTNOTERC = '.boostnoterc'
|
||||||
|
|
||||||
function focused () {
|
function focused () {
|
||||||
mixpanel.track('MAIN_FOCUSED')
|
mixpanel.track('MAIN_FOCUSED')
|
||||||
@@ -76,6 +80,10 @@ class Main extends React.Component {
|
|||||||
|
|
||||||
eventEmitter.on('editor:fullscreen', this.toggleFullScreen)
|
eventEmitter.on('editor:fullscreen', this.toggleFullScreen)
|
||||||
window.addEventListener('focus', focused)
|
window.addEventListener('focus', focused)
|
||||||
|
|
||||||
|
const homePath = global.process.env.HOME || global.process.env.USERPROFILE
|
||||||
|
const boostnotercPath = path.join(homePath, BOOSTNOTERC)
|
||||||
|
RcParser.exec(boostnotercPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const sander = require('sander')
|
const sander = require('sander')
|
||||||
|
|
||||||
@@ -7,6 +9,15 @@ function parse (boostnotercPath) {
|
|||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
function exec (boostnotercPath) {
|
||||||
parse
|
const config = this.parse(boostnotercPath)
|
||||||
|
if (config.execs === undefined) return
|
||||||
|
_.forEach(config.execs, (exec) => {
|
||||||
|
eval(exec)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
parse,
|
||||||
|
exec
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user