fix(storage): migrate filesystem operations to smartfs and tighten TypeScript initialization checks
This commit is contained in:
@@ -6,8 +6,8 @@ import * as paths from './paths.js';
|
||||
*/
|
||||
export class Smartconfig {
|
||||
cwd: string;
|
||||
lookupPath: string;
|
||||
smartconfigJsonExists: boolean;
|
||||
lookupPath!: string;
|
||||
smartconfigJsonExists = false;
|
||||
smartconfigJsonData: any;
|
||||
|
||||
/**
|
||||
@@ -48,9 +48,7 @@ export class Smartconfig {
|
||||
* checks if the JSON exists
|
||||
*/
|
||||
private checkSmartconfigJsonExists() {
|
||||
this.smartconfigJsonExists = plugins.smartfile.fs.fileExistsSync(
|
||||
this.lookupPath,
|
||||
);
|
||||
this.smartconfigJsonExists = plugins.nodeFs.existsSync(this.lookupPath);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,8 +67,8 @@ export class Smartconfig {
|
||||
*/
|
||||
private checkSmartconfigJsonData() {
|
||||
if (this.smartconfigJsonExists) {
|
||||
this.smartconfigJsonData = plugins.smartfile.fs.toObjectSync(
|
||||
this.lookupPath,
|
||||
this.smartconfigJsonData = plugins.smartjson.parse(
|
||||
plugins.nodeFs.readFileSync(this.lookupPath, 'utf8'),
|
||||
);
|
||||
} else {
|
||||
this.smartconfigJsonData = {};
|
||||
|
||||
Reference in New Issue
Block a user