vuex-gitstore
v1.0.8
Published
A plugin for Vuex to sync the store with a git repository.
Downloads
3
Readme
vuex-gitstore
Intended use with Electron or server side javascript as it needs access to the local file system. git-js dependency. Will save the entire store.state to individual json files for each key within the root. Options to pass a key to store only portions of the state.
import Vue from 'vue'
import Vuex from 'vuex'
import GitStore from 'vuex-gitstore'
Vue.use(Vuex)
const store = new Vuex.Store({
plugins: [
GitStore.install({})//pass options.
]
})
export default store
Pass options
key if you only want to target one key within the vuex store state, assign it here. For example with Vuex ORM use {key : 'entities'},
repo rename the default repo folder/name to something else. default is 'data' {repo : 'my_data_repo'}
root_path change where the json files are kept. default is 'gitstoreData/' {repo : 'my_data/somewhere_else/'}
Use with Vuex ORM
import Vue from 'vue'
import Vuex from 'vuex'
import VuexORM from '@vuex-orm/core'
import config from '../../config'
import Item from '../models/Item'
Vue.use(Vuex)
const database = new VuexORM.Database()
database.register(Item)
const store = new Vuex.Store({
plugins: [
VuexORM.install(database),
config.storage.driver.install({
key : 'entities',
repo : 'darknote',
root_path : 'darknoteData/'
})
]
})
export default store