@athenna/config
Advanced tools
Comparing version 3.4.1 to 3.5.0
{ | ||
"name": "@athenna/config", | ||
"version": "3.4.1", | ||
"version": "3.5.0", | ||
"description": "Cache and handle environment variables and config files of Athenna.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -16,3 +16,3 @@ /** | ||
*/ | ||
static setFile(path?: string, pjson?: boolean): Promise<typeof Rc>; | ||
static setFile(path?: string): Promise<typeof Rc>; | ||
/** | ||
@@ -19,0 +19,0 @@ * Set or subscribe a KEY:VALUE property in some property of the RC configuration file. |
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
static async setFile(path = Path.pwd('.athennarc.json'), pjson = false) { | ||
static async setFile(path = Path.pwd('.athennarc.json')) { | ||
this.content = new ObjectBuilder({ | ||
@@ -24,10 +24,4 @@ referencedValues: false, | ||
}); | ||
if (Config.is('rc.isInPackageJson', true) && pjson) { | ||
this.file = new File(Path.pwd('package.json')); | ||
const json = await this.file.getContentAsJson(); | ||
this.content.set(json.athenna); | ||
return this; | ||
} | ||
this.file = new File(path, ''); | ||
const json = await this.file.getContentAsJson(); | ||
this.file = await new File(path).load(); | ||
const json = this.file.getContentAsJsonSync(); | ||
if (json === null) { | ||
@@ -41,3 +35,7 @@ const mod = await import(this.file.href); | ||
this.content.set(mod.default); | ||
return this; | ||
} | ||
if (this.file.base === 'package.json') { | ||
this.content.set(json.athenna); | ||
} | ||
else { | ||
@@ -44,0 +42,0 @@ this.content.set(json); |
34080
875