-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove electron-store and electron-settings
- Loading branch information
1 parent
278be73
commit 3e2b424
Showing
11 changed files
with
87 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
block_comment_start = /** | ||
block_comment = * | ||
block_comment_end = */ | ||
|
||
[*.md] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"printWidth": 120, | ||
"useTabs": true, | ||
"semi":true, | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"jsxSingleQuote":false, | ||
"trailingComma": "all", | ||
"bracketSpacing": true, | ||
"bracketSameLine": true, | ||
"arrowParens": "always" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const electron = require('electron'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
const Store = (opts) => { | ||
const userDataPath = (electron.app || electron.remote.app).getPath('userData'); | ||
const pathJSON = path.join(userDataPath, opts.configName + '.json'); | ||
const parseDataFile = (filePath, defaults) => { | ||
try { | ||
return JSON.parse(fs.readFileSync(filePath)); | ||
} catch (error) { | ||
return defaults; | ||
} | ||
}; | ||
const data = parseDataFile(pathJSON, opts.defaults); | ||
const get = (key) => { | ||
return data[key]; | ||
}; | ||
const set = (key, val) => { | ||
data[key] = val; | ||
fs.writeFileSync(pathJSON, JSON.stringify(data)); | ||
}; | ||
return { | ||
get, | ||
set, | ||
}; | ||
}; | ||
|
||
module.exports = Store; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.