@wabot-dev/framework 0.1.0-beta.68 → 0.1.0-beta.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -60,16 +60,18 @@ CmdChannel = CmdChannel_1 = __decorate([
|
|
|
60
60
|
injectable()
|
|
61
61
|
], CmdChannel);
|
|
62
62
|
function writeJsonToFile(filename, data) {
|
|
63
|
-
const filePath = path.
|
|
63
|
+
const filePath = path.resolve(process.cwd(), filename);
|
|
64
|
+
const dir = path.dirname(filePath);
|
|
65
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
64
66
|
fs.writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf-8');
|
|
65
67
|
}
|
|
66
68
|
function readJsonFromFile(filename) {
|
|
67
|
-
const filePath = path.
|
|
69
|
+
const filePath = path.resolve(process.cwd(), filename);
|
|
68
70
|
if (!fs.existsSync(filePath)) {
|
|
69
71
|
return null;
|
|
70
72
|
}
|
|
71
|
-
const jsonData = fs.readFileSync(filePath, 'utf-8');
|
|
72
73
|
try {
|
|
74
|
+
const jsonData = fs.readFileSync(filePath, 'utf-8');
|
|
73
75
|
return JSON.parse(jsonData);
|
|
74
76
|
}
|
|
75
77
|
catch (err) {
|