fix(config): migrate project config and harden SmartFile and StreamFile defaults for updated toolchain compatibility
This commit is contained in:
+13
-10
@@ -23,7 +23,7 @@ export class SmartFile extends plugins.smartjson.Smartjson {
|
||||
* the relative path of the file
|
||||
*/
|
||||
@plugins.smartjson.foldDec()
|
||||
public path: string;
|
||||
public accessor path: string = '';
|
||||
|
||||
/**
|
||||
* a parsed path
|
||||
@@ -43,20 +43,20 @@ export class SmartFile extends plugins.smartjson.Smartjson {
|
||||
* the content of the file as Buffer
|
||||
*/
|
||||
@plugins.smartjson.foldDec()
|
||||
public contentBuffer: Buffer;
|
||||
public accessor contentBuffer: Buffer = Buffer.alloc(0);
|
||||
|
||||
/**
|
||||
* The current working directory of the file
|
||||
* Note:this is similar to gulp and different from native node path base
|
||||
*/
|
||||
@plugins.smartjson.foldDec()
|
||||
public base: string;
|
||||
public accessor base: string = process.cwd();
|
||||
|
||||
/**
|
||||
* sync the file with disk
|
||||
*/
|
||||
@plugins.smartjson.foldDec()
|
||||
public sync: boolean;
|
||||
public accessor sync: boolean = false;
|
||||
|
||||
/**
|
||||
* the constructor of Smartfile
|
||||
@@ -64,13 +64,16 @@ export class SmartFile extends plugins.smartjson.Smartjson {
|
||||
* @param smartFs optional SmartFs instance for filesystem operations
|
||||
*/
|
||||
|
||||
constructor(optionsArg: ISmartfileConstructorOptions, smartFs?: any) {
|
||||
constructor(
|
||||
optionsArg: ISmartfileConstructorOptions = {
|
||||
path: '',
|
||||
contentBuffer: Buffer.alloc(0),
|
||||
base: process.cwd(),
|
||||
},
|
||||
smartFs?: any,
|
||||
) {
|
||||
super();
|
||||
if (optionsArg.contentBuffer) {
|
||||
this.contentBuffer = optionsArg.contentBuffer;
|
||||
} else {
|
||||
console.log('created empty Smartfile?');
|
||||
}
|
||||
this.contentBuffer = optionsArg.contentBuffer || Buffer.alloc(0);
|
||||
this.path = optionsArg.path;
|
||||
this.base = optionsArg.base;
|
||||
this.smartFs = smartFs;
|
||||
|
||||
Reference in New Issue
Block a user