@app-config/settings
Advanced tools
Comparing version 3.0.0-alpha.4 to 3.0.0-alpha.6
@@ -30,4 +30,5 @@ import { join, resolve } from 'path'; | ||
catch (error) { | ||
if (error instanceof NotFoundError) | ||
if (NotFoundError.isNotFoundError(error, path)) { | ||
return {}; | ||
} | ||
throw error; | ||
@@ -34,0 +35,0 @@ } |
@@ -35,6 +35,6 @@ "use strict"; | ||
if (process.env.APP_CONFIG_SETTINGS_FOLDER) { | ||
return path_1.resolve(process.env.APP_CONFIG_SETTINGS_FOLDER); | ||
return (0, path_1.resolve)(process.env.APP_CONFIG_SETTINGS_FOLDER); | ||
} | ||
const oldConfigDir = path_1.join(os_1.homedir(), '.app-config'); | ||
const { config: configDir } = env_paths_1.default('app-config', { suffix: '' }); | ||
const oldConfigDir = (0, path_1.join)((0, os_1.homedir)(), '.app-config'); | ||
const { config: configDir } = (0, env_paths_1.default)('app-config', { suffix: '' }); | ||
if (fs.pathExistsSync(oldConfigDir)) { | ||
@@ -48,3 +48,3 @@ logging_1.logger.warn(`Moving ${oldConfigDir} to ${configDir}`); | ||
async function loadSettings() { | ||
const path = path_1.join(settingsDirectory(), 'settings.yml'); | ||
const path = (0, path_1.join)(settingsDirectory(), 'settings.yml'); | ||
const source = new node_1.FileSource(path); | ||
@@ -58,4 +58,5 @@ logging_1.logger.verbose(`Loading settings from ${path}`); | ||
catch (error) { | ||
if (error instanceof core_1.NotFoundError) | ||
if (core_1.NotFoundError.isNotFoundError(error, path)) { | ||
return {}; | ||
} | ||
throw error; | ||
@@ -67,4 +68,4 @@ } | ||
settings = Promise.resolve(newSettings); | ||
const path = path_1.join(settingsDirectory(), 'settings.yml'); | ||
const stringified = core_1.stringify(newSettings, core_1.FileType.YAML); | ||
const path = (0, path_1.join)(settingsDirectory(), 'settings.yml'); | ||
const stringified = (0, core_1.stringify)(newSettings, core_1.FileType.YAML); | ||
logging_1.logger.verbose(`Saving settings to ${path}`); | ||
@@ -71,0 +72,0 @@ await fs.outputFile(path, stringified); |
{ | ||
"name": "@app-config/settings", | ||
"description": "User settings for @app-config", | ||
"version": "3.0.0-alpha.4", | ||
"version": "3.0.0-alpha.6", | ||
"license": "MPL-2.0", | ||
@@ -33,6 +33,6 @@ "author": { | ||
"dependencies": { | ||
"@app-config/core": "^3.0.0-alpha.4", | ||
"@app-config/logging": "^3.0.0-alpha.4", | ||
"@app-config/node": "^3.0.0-alpha.4", | ||
"@app-config/utils": "^3.0.0-alpha.4", | ||
"@app-config/core": "^3.0.0-alpha.6", | ||
"@app-config/logging": "^3.0.0-alpha.6", | ||
"@app-config/node": "^3.0.0-alpha.6", | ||
"@app-config/utils": "^3.0.0-alpha.6", | ||
"env-paths": "2", | ||
@@ -42,3 +42,3 @@ "fs-extra": "7" | ||
"devDependencies": { | ||
"@app-config/test-utils": "^3.0.0-alpha.4" | ||
"@app-config/test-utils": "^3.0.0-alpha.6" | ||
}, | ||
@@ -45,0 +45,0 @@ "prettier": "@lcdev/prettier", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
10848
153