Skip to content

Commit 308b008

Browse files
committed
config creates properly if it doesn't exist, bumped version to 0.3.0
1 parent b366fef commit 308b008

File tree

5 files changed

+28
-13
lines changed

5 files changed

+28
-13
lines changed

config.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
{"notePath":"notes","editorConfig":{"lineNumbers":false,"tabSize":4,"theme":"sticky hypermd-light","mode":{"name":"hypermd","hashtag":true}}}
1+
{
2+
"notePath": "notes",
3+
"editorConfig": {
4+
"lineNumbers": false,
5+
"tabSize": 4,
6+
"theme": "sticky hypermd-light",
7+
"mode": {
8+
"name": "hypermd",
9+
"hashtag": true
10+
}
11+
}
12+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stickynoteapp",
3-
"version": "0.2.5",
3+
"version": "0.3.0",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",

src/components/Editor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import VueEmitter from "@/utility/VueEmitter"
1919
export default class Editor extends VueEmitter {
2020
private internalEditor: any;
2121
private saveWatcher: any;
22-
private config:Configuration;
22+
private config:Configuration = new Configuration();
2323
private file;
2424
2525
private filePath() {

src/utility/Configuration.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@ export default class Configuration {
1818
var stashed = new Configuration
1919
return new Promise<Configuration>((r,e) =>{
2020
access("./config.json", fsConstants.F_OK, (err) => {
21-
if(err) writeFile("./config.json",JSON.stringify(stashed),ex => e(ex))
21+
if(err) writeFile("./config.json",JSON.stringify(stashed,null,"\t"),ex =>{
22+
if(ex) e(ex)
23+
this.readFile(stashed,r);
24+
})
25+
this.readFile(stashed,r);
2226
});
23-
readFile("./config.json",(e,b)=>{
24-
var obj = Object.assign(stashed,(b.toJSON()));
25-
r(obj);
26-
})
27+
28+
})
29+
}
30+
31+
private static readFile(stashed:Configuration, resolve){
32+
readFile("./config.json",(e,b)=>{
33+
var obj = Object.assign(stashed,(b.toJSON()));
34+
resolve(obj);
2735
})
2836
}
2937

vue.config.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ module.exports = {
77
"win": {
88
"icon": __dirname + '/src/assets/icon.ico',
99
"target": "NSIS"
10-
},
11-
"win": {
12-
"icon": __dirname + '/src/assets/icon.ico',
13-
"target": "NSIS"
14-
},
10+
}
1511
}
1612
}
1713
}

0 commit comments

Comments
 (0)