From 4989072170c4f443d1d6cef3e910b06580f224d0 Mon Sep 17 00:00:00 2001 From: Kim Ung Date: Thu, 11 Jan 2018 12:13:21 +0100 Subject: [PATCH] 2.1.1 (#20) --- CHANGELOG.md | 4 ++++ lib/manager.js | 4 ++-- lib/sections/field/path.js | 4 ++-- lib/sections/field/type.js | 4 ++-- lib/sections/field/yaml.js | 4 ++-- package-lock.json | 28 ++++++++++++++-------------- package.json | 2 +- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5add3c3..62dba9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 2.1.1 - 2018-01-11 +### Changed +- add appRelative parameter for path.resolve + ## 2.1.0 - 2018-01-01 ### Added - path resolve diff --git a/lib/manager.js b/lib/manager.js index b2f4100..4da2fff 100644 --- a/lib/manager.js +++ b/lib/manager.js @@ -77,11 +77,11 @@ ConfigurationManager.prototype.init = function(env) { let configFileName = path + config.prefix + '.' + env + config.ext; if (fs.existsSync(defaultConfigFileName)) { - document = yaml.load(defaultConfigFileName); + document = yaml.load(defaultConfigFileName, true); } if(defaultConfigFileName !== configFileName && fs.existsSync(configFileName)) { - document = extend(true, document || {}, yaml.load(configFileName)); + document = extend(true, document || {}, yaml.load(configFileName, true)); } } diff --git a/lib/sections/field/path.js b/lib/sections/field/path.js index 2dd1464..7171bba 100644 --- a/lib/sections/field/path.js +++ b/lib/sections/field/path.js @@ -27,12 +27,12 @@ var errors = require('@rduk/errors'); module.exports = { - resolve: function(path) { + resolve: function(path, appRelative) { if (!path || typeof path !== 'string') { errors.throwArgumentError('path', path); } - if (/^\w/.test(path)) { + if (/^\w/.test(path) && appRelative) { path = '~/' + path; } diff --git a/lib/sections/field/type.js b/lib/sections/field/type.js index 190ac09..8da171f 100644 --- a/lib/sections/field/type.js +++ b/lib/sections/field/type.js @@ -28,7 +28,7 @@ var errors = require('@rduk/errors'); var path = require('./path'); module.exports = { - load: function(filepath) { - return require(path.resolve(filepath)); + load: function(filepath, appRelative) { + return require(path.resolve(filepath, appRelative)); } }; diff --git a/lib/sections/field/yaml.js b/lib/sections/field/yaml.js index abc2939..7c1e9be 100644 --- a/lib/sections/field/yaml.js +++ b/lib/sections/field/yaml.js @@ -29,7 +29,7 @@ var path = require('./path'); var loadYaml = require('../../utils/loadYaml'); module.exports = { - load: function(filepath) { - return loadYaml(path.resolve(filepath)); + load: function(filepath, appRelative) { + return loadYaml(path.resolve(filepath, appRelative)); } }; diff --git a/package-lock.json b/package-lock.json index b6f0005..943c4fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@rduk/configuration", - "version": "2.1.0", + "version": "2.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -198,7 +198,7 @@ "coveralls": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.0.tgz", - "integrity": "sha512-ZppXR9y5PraUOrf/DzHJY6gzNUhXYE3b9D43xEXs4QYZ7/Oe0Gy0CS+IPKWFfvQFXB3RG9QduaQUFehzSpGAFw==", + "integrity": "sha1-Iu9zAzBTgIDSm4wVHckUav3oipk=", "dev": true, "requires": { "js-yaml": "3.10.0", @@ -220,7 +220,7 @@ "boom": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "integrity": "sha1-XdnabuOl8wIHdDYpDLcX0/SlTgI=", "dev": true, "requires": { "hoek": "4.2.0" @@ -432,7 +432,7 @@ "hawk": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "integrity": "sha1-r02RTrBl+bXOTZ0RwcshJu7MMDg=", "dev": true, "requires": { "boom": "4.3.1", @@ -444,7 +444,7 @@ "hoek": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", - "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==", + "integrity": "sha1-ctnQdU9/4lyi0BrY+PmpRJqJUm0=", "dev": true }, "http-signature": { @@ -477,7 +477,7 @@ "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", "dev": true }, "is-typedarray": { @@ -542,7 +542,7 @@ "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -674,7 +674,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "dev": true, "requires": { "brace-expansion": "1.1.8" @@ -792,7 +792,7 @@ "qs": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "integrity": "sha1-NJzfbu+J7EXBLX1es/wMhwNDptg=", "dev": true }, "repeat-string": { @@ -804,7 +804,7 @@ "request": { "version": "2.83.0", "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", - "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "integrity": "sha1-ygtl2gLtYpNYh4COb1EDgQNOM1Y=", "dev": true, "requires": { "aws-sign2": "0.7.0", @@ -850,13 +850,13 @@ "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=", "dev": true }, "sntp": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "integrity": "sha1-LGzsFP7cIiJznK+bXD2F0cxaLMg=", "dev": true, "requires": { "hoek": "4.2.0" @@ -973,7 +973,7 @@ "uuid": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==", + "integrity": "sha1-PdPT55Crwk17DToDT/q6vijrvAQ=", "dev": true }, "verror": { @@ -990,7 +990,7 @@ "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=", "dev": true, "requires": { "isexe": "2.0.0" diff --git a/package.json b/package.json index ec2b652..7662832 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rduk/configuration", - "version": "2.1.0", + "version": "2.1.1", "description": "Manage configuration in your Node.js app", "main": "lib/index.js", "scripts": {