import ElectronStore from 'electron-store' ; import { ProjectOptions } from '@lib/frameworks/project' ; export class Project { protected store : any ; constructor ( id ) { log . info ( 'Initializing project store: ' + id ) ; this . store = new ElectronStore ( { encryptionKey : process . env . NODE_ENV === 'production' ? 'v1' : undefined , name : 'project' , defaults : { options : { id } } , fileExtension : 'db' , cwd : `Projects/${ id }` } ) ; } public getPath ( ) { return this . store . path . replace ( /\/project\.db$/i , '' ) ; } public get ( key ? , fallback ? ) { if ( ! key ) { return this . store . store ; } return this . store . get ( key , fallback ) ; } public set ( key , value ? ) { this . store . set ( key , value ) ; } public save ( options ) { this . store . set ( 'options' , { ... this . store . get ( 'options' ) , ... options } ) ; } public toJSON ( ) { return this . store . get ( 'options' ) ; } }