@wocker/core
Advanced tools
Comparing version 1.0.15 to 1.0.16
@@ -15,3 +15,4 @@ import FS, { RmOptions, Stats, WriteFileOptions } from "fs"; | ||
readdirFiles(path?: string, options?: ReaddirOptions): Promise<string[]>; | ||
readJSON(...paths: string[]): Promise<any>; | ||
readJSON(...paths: string[]): any; | ||
writeFile(path: string, data: string | Buffer): Promise<void>; | ||
writeJSON(path: string, data: any, options?: WriteFileOptions): Promise<void>; | ||
@@ -18,0 +19,0 @@ rm(path: string, options?: RmOptions): Promise<void>; |
@@ -97,14 +97,16 @@ "use strict"; | ||
readJSON(...paths) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const res = yield new Promise((resolve, reject) => { | ||
const filePath = this.path(...paths); | ||
fs_2.default.readFile(filePath, (err, data) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
resolve(data); | ||
}); | ||
const filePath = this.path(...paths); | ||
const res = fs_2.default.readFileSync(filePath); | ||
return JSON.parse(res.toString()); | ||
} | ||
writeFile(path, data) { | ||
const fullPath = this.path(path); | ||
return new Promise((resolve, reject) => { | ||
fs_2.default.writeFile(fullPath, data, (err) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
resolve(undefined); | ||
}); | ||
return JSON.parse(res.toString()); | ||
}); | ||
@@ -111,0 +113,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import { Config } from "../makes"; | ||
import { AppConfig } from "../makes"; | ||
declare abstract class AppConfigService { | ||
protected config?: Config; | ||
protected config?: AppConfig; | ||
abstract getPWD(): string; | ||
@@ -8,5 +8,5 @@ abstract setPWD(pwd: string): void; | ||
abstract pluginsPath(...args: string[]): string; | ||
getConfig(): Promise<Config>; | ||
protected abstract loadConfig(): Promise<Config>; | ||
getConfig(): AppConfig; | ||
protected abstract loadConfig(): AppConfig; | ||
} | ||
export { AppConfigService }; |
@@ -8,11 +8,2 @@ "use strict"; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -23,8 +14,6 @@ exports.AppConfigService = void 0; | ||
getConfig() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!this.config) { | ||
this.config = yield this.loadConfig(); | ||
} | ||
return this.config; | ||
}); | ||
if (!this.config) { | ||
this.config = this.loadConfig(); | ||
} | ||
return this.config; | ||
} | ||
@@ -31,0 +20,0 @@ }; |
export declare abstract class LogService { | ||
abstract debug(...data: any[]): void; | ||
abstract log(...data: any[]): void; | ||
@@ -3,0 +4,0 @@ abstract info(...data: any[]): void; |
{ | ||
"name": "@wocker/core", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"author": "Kris Papercut <krispcut@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "Core of the Wocker", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96946
2454