Socket
Socket
Sign inDemoInstall

app-conf

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-conf - npm Package Compare versions

Comparing version 2.3.0 to 3.0.0

2

_merge.js

@@ -0,1 +1,3 @@

"use strict";
module.exports = function merge(target, source) {

@@ -2,0 +4,0 @@ if (source === undefined) {

@@ -0,1 +1,3 @@

"use strict";
module.exports = function pMap(array, iteratee) {

@@ -2,0 +4,0 @@ const { then } = array;

9

cli.js

@@ -31,3 +31,3 @@ #!/usr/bin/env node

sorted: true,
})
}),
);

@@ -77,3 +77,8 @@ stdout.write("\n");

const opts = { appDir, appName, ignoreUnknownFormats: true };
const opts = {
appDir,
appName,
ignoreUnknownFormats: true,
initialLoad: true,
};
const printPaths = print.bind(undefined, cliOpts.paths);

@@ -80,0 +85,0 @@

@@ -89,5 +89,5 @@ "use strict";

silent: true,
}).catch(ignoreAccessErrors)
}).catch(ignoreAccessErrors),
).then(flatten),
readFile
readFile,
);

@@ -94,0 +94,0 @@ },

@@ -24,20 +24,17 @@ "use strict";

if (typeof value === "string") {
return Promise.resolve(
value[0] === "~" && (value[1] === "/" || value[1] === "\\")
? homedir() + value.slice(1)
: RELATIVE_PATH_RE.test(value)
return value[0] === "~" && (value[1] === "/" || value[1] === "\\")
? homedir() + value.slice(1)
: RELATIVE_PATH_RE.test(value)
? resolvePath(base, value)
: value
);
: value;
}
if (value !== null && typeof value === "object") {
return pMap(Object.keys(value), (key) =>
resolvePaths(value[key], base).then((resolved) => {
value[key] = resolved;
})
).then(() => value);
for (const key of Object.keys(value)) {
value[key] = resolvePaths(value[key], base);
}
return value;
}
return Promise.resolve(value);
return value;
}

@@ -49,3 +46,3 @@

appName,
{ appDir, defaults, entries: whitelist, ignoreUnknownFormats = false } = {}
{ appDir, defaults, entries: whitelist, ignoreUnknownFormats = false } = {},
) {

@@ -81,8 +78,11 @@ const useWhitelist = whitelist !== undefined;

.then((data) =>
data.reduce((acc, cfg) => {
if (cfg !== undefined) {
merge(acc, cfg);
}
return acc;
}, merge({}, defaults))
data.reduce(
(acc, cfg) => {
if (cfg !== undefined) {
merge(acc, cfg);
}
return acc;
},
merge({}, defaults),
),
);

@@ -94,3 +94,3 @@ }

exports.watch = function watch({ appName, ...opts }, cb) {
exports.watch = function watch({ appName, initialLoad = false, ...opts }, cb) {
return new Promise((resolve, reject) => {

@@ -128,9 +128,23 @@ const dirs = [];

.once("error", reject)
.once("ready", (...args) => {
loadWrapper();
resolve(function unsubscribe() {
.once("ready", () => {
function unsubscribe() {
return watcher.close();
});
}
if (initialLoad) {
load(appName, opts).then(
(config) => {
cb(undefined, config);
resolve(unsubscribe);
},
(error) => {
const rejectOriginal = () => reject(error);
unsubscribe().then(rejectOriginal, rejectOriginal);
},
);
} else {
resolve(unsubscribe);
}
});
});
};
{
"name": "app-conf",
"version": "2.3.0",
"version": "3.0.0",
"license": "ISC",

@@ -25,3 +25,3 @@ "author": "Julien Fontanet <julien.fontanet@isonoe.net> (http://julien.isonoe.net/)",

"engines": {
"node": ">=8.10"
"node": ">=9.9"
},

@@ -31,3 +31,3 @@ "dependencies": {

"debug": "^4.1.0",
"glob": "^7.1.3",
"glob": "^8.1.0",
"lodash": "^4.17.11",

@@ -39,30 +39,25 @@ "make-error": "^1.3.5",

"devDependencies": {
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.2.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-n": "^15.2.0",
"eslint-plugin-promise": "^6.0.0",
"husky": "^4",
"lint-staged": "^12",
"mock-fs": "^5.1.2",
"prettier": "^2.2.1",
"rimraf": "^3.0.0",
"tap": "^16.2.0"
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-promise": "^6.1.1",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"mock-fs": "^5.2.0",
"prettier": "^3.2.5",
"test": "^3.3.0"
},
"scripts": {
"dev-test": "tap --no-check-coverage --watch",
"test": "tap --no-check-coverage"
"test": "node--test && true",
"prepare": "husky"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged && npm run test"
}
},
"lint-staged": {
"*.js": [
"prettier --write",
"eslint --ignore-pattern '!*'"
]
"*": [
"npm test",
"prettier --ignore-unknown --write"
],
"*.{{,c,m}j,t}s{,x}": "eslint --ignore-pattern '!*'"
}
}

@@ -72,2 +72,13 @@ # app-conf

// if set to true the configuration will be loaded before waiting for
// changes
//
// in that case, the returned promise will reject if the initial load
// failed, or will resolve after the callback has been called with the
// initial configuration
//
// because the async call to `watchConfig()` will not have returned yet,
// `stopWatching()` will not be available in this first callback call
initialLoad: false,
// all other options are passed to load()

@@ -86,3 +97,3 @@ },

console.log("config has been loaded", config);
}
},
);

@@ -89,0 +100,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc