*Update dist

This commit is contained in:
Derrick Hammer 2023-04-18 23:36:33 -04:00
parent e1c57ea40b
commit 62856686f2
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 6 additions and 3 deletions

3
dist/index.d.ts vendored
View File

@ -11,7 +11,8 @@ import arg from "arg";
export default class Config { export default class Config {
private module; private module;
private data; private data;
constructor(module: string); private configProperty;
constructor(module: string, configProperty: string);
inject(options: object): void; inject(options: object): void;
load(): void; load(): void;
openDir(dir: string): void; openDir(dir: string): void;

6
dist/index.js vendored
View File

@ -20,10 +20,12 @@ const deep_to_flat_object_1 = __importDefault(require("deep-to-flat-object"));
class Config { class Config {
module; module;
data = {}; data = {};
constructor(module) { configProperty;
constructor(module, configProperty) {
(0, bsert_1.default)(typeof module === "string"); (0, bsert_1.default)(typeof module === "string");
(0, bsert_1.default)(module.length > 0); (0, bsert_1.default)(module.length > 0);
this.module = module; this.module = module;
this.configProperty = configProperty;
} }
inject(options) { inject(options) {
for (const key of Object.keys(options)) { for (const key of Object.keys(options)) {
@ -70,7 +72,7 @@ class Config {
save(file, data) { save(file, data) {
(0, bsert_1.default)(typeof data === "object"); (0, bsert_1.default)(typeof data === "object");
(0, bsert_1.default)(!Array.isArray(data)); (0, bsert_1.default)(!Array.isArray(data));
const configDir = this.str("configdir"); const configDir = this.str(this.configProperty);
const fullPath = path_1.default.join(configDir, `${file}.json`); const fullPath = path_1.default.join(configDir, `${file}.json`);
if (!fs_1.default.existsSync(configDir)) { if (!fs_1.default.existsSync(configDir)) {
fs_1.default.mkdirSync(configDir, { recursive: true }); fs_1.default.mkdirSync(configDir, { recursive: true });