bdy 1.7.51-dev → 1.7.52-dev
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.
- package/package.json +1 -1
- package/src/cfg.js +15 -3
- package/src/logger.js +5 -1
- package/src/utils.js +5 -1
package/package.json
CHANGED
package/src/cfg.js
CHANGED
|
@@ -34,19 +34,27 @@ class Cfg {
|
|
|
34
34
|
mkdirSync(this.dir, {
|
|
35
35
|
recursive: true,
|
|
36
36
|
});
|
|
37
|
-
chmodSync(this.dir, 0o777);
|
|
38
37
|
} catch (err) {
|
|
39
38
|
throw new Error(ERR_CANT_CREATE_DIR_IN_HOME('.bdy'));
|
|
40
39
|
}
|
|
40
|
+
try {
|
|
41
|
+
chmodSync(this.dir, 0o777);
|
|
42
|
+
} catch {
|
|
43
|
+
// do nothing
|
|
44
|
+
}
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
createEmptyFile() {
|
|
44
48
|
try {
|
|
45
49
|
writeFileSync(this.file, '{}', 'utf-8');
|
|
46
|
-
chmodSync(this.file, 0o666);
|
|
47
50
|
} catch (err) {
|
|
48
51
|
throw new Error(ERR_CANT_CREATE_DIR_IN_HOME('.bdy/cfg.json'));
|
|
49
52
|
}
|
|
53
|
+
try {
|
|
54
|
+
chmodSync(this.file, 0o666);
|
|
55
|
+
} catch {
|
|
56
|
+
// do nothing
|
|
57
|
+
}
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
ensureDir() {
|
|
@@ -217,10 +225,14 @@ class Cfg {
|
|
|
217
225
|
this.ensureDir();
|
|
218
226
|
try {
|
|
219
227
|
writeFileSync(this.file, JSON.stringify(this.json, null, 4), 'utf-8');
|
|
220
|
-
chmodSync(this.file, 0o666);
|
|
221
228
|
} catch (err) {
|
|
222
229
|
throw new Error(ERR_CANT_CREATE_DIR_IN_HOME('.bdy/cfg.json'));
|
|
223
230
|
}
|
|
231
|
+
try {
|
|
232
|
+
chmodSync(this.file, 0o666);
|
|
233
|
+
} catch {
|
|
234
|
+
// do nothing
|
|
235
|
+
}
|
|
224
236
|
}
|
|
225
237
|
}
|
|
226
238
|
|
package/src/logger.js
CHANGED
|
@@ -31,7 +31,11 @@ class Logger {
|
|
|
31
31
|
this.logPath = resolve(this.rootPath, 'cli.log');
|
|
32
32
|
this.log1Path = resolve(this.rootPath, 'cli.1.log');
|
|
33
33
|
this.logStream = fs.openSync(this.logPath, 'w');
|
|
34
|
-
|
|
34
|
+
try {
|
|
35
|
+
fs.chmodSync(this.logPath, 0o666);
|
|
36
|
+
} catch {
|
|
37
|
+
// do nothing
|
|
38
|
+
}
|
|
35
39
|
this.p = pino({
|
|
36
40
|
level: process.env.DEBUG === '1' ? 'debug' : 'info',
|
|
37
41
|
timestamp: () => `, "time": "${new Date().toISOString()}"`,
|
package/src/utils.js
CHANGED
|
@@ -249,7 +249,11 @@ const getHomeDirectory = () => {
|
|
|
249
249
|
const p = path.join(r, '.bdy');
|
|
250
250
|
if (!existsSync(p)) {
|
|
251
251
|
mkdirSync(p, { recursive: true });
|
|
252
|
-
|
|
252
|
+
try {
|
|
253
|
+
chmodSync(p, 0o777);
|
|
254
|
+
} catch {
|
|
255
|
+
// do nothing
|
|
256
|
+
}
|
|
253
257
|
}
|
|
254
258
|
return p;
|
|
255
259
|
};
|