Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.1.0 to 2.2.0

57

cli.js

@@ -5,8 +5,18 @@ #!/usr/bin/env node

const { env } = process;
if (env.DEBUG === undefined) {
env.DEBUG = "*";
}
const { load, watch } = require("./index.js");
const { inspect } = require("util");
const get = require("lodash/get.js");
const pick = require("lodash/pick.js");
const { stdout } = process;
function print(config) {
function print(paths, config) {
if (paths.length !== 0) {
config = paths.length === 1 ? get(config, paths[0]) : pick(config, paths);
}
stdout.write(

@@ -23,5 +33,32 @@ inspect(config, {

async function main(args) {
if (args.length === 0 || args.some((_) => _ === "-h" || _ === "--help")) {
const cliOpts = {
_: [],
help: false,
paths: [],
watch: false,
};
for (let i = 0, n = args.length; i < n; ) {
const arg = args[i++];
if (arg[0] === "-") {
if (arg === "-h" || arg === "--help") {
cliOpts.help = true;
} else if (arg === "-w" || arg === "--watch") {
cliOpts.watch = true;
} else if (arg === "-p" || arg === "--path") {
if (i < n) {
cliOpts.paths.push(args[i++]);
} else {
throw new Error("missing argument for --path option");
}
} else {
throw new Error("unknown option: " + arg);
}
} else {
cliOpts._.push(arg);
}
}
if (cliOpts._.length === 0 || cliOpts.help) {
const { name, version } = require("./package.json");
return stdout.write(`Usage: ${name} [--watch | -w] <appName> [<appDir>]
return stdout.write(`Usage: ${name} [--watch | -w] [-p <path>]... <appName> [<appDir>]

@@ -32,12 +69,8 @@ ${name} v${version}

const watchChanges = args[0] === "--watch" || args[0] === "-w";
if (watchChanges) {
args.shift();
}
const [appName, appDir] = cliOpts._;
const [appName, appDir] = args;
const opts = { appDir, appName, ignoreUnknownFormats: true };
const printPaths = print.bind(undefined, cliOpts.paths);
if (watchChanges) {
if (cliOpts.watch) {
await watch(opts, (error, config) => {

@@ -49,8 +82,8 @@ console.log("--", new Date());

}
print(config);
printPaths(config);
});
} else {
print(await load(appName, opts));
printPaths(await load(appName, opts));
}
}
main(process.argv.slice(2)).catch(console.error.bind(console, "FATAL:"));

@@ -24,3 +24,3 @@ "use strict";

return {
path: path,
path,
content: buffer,

@@ -27,0 +27,0 @@ };

{
"name": "app-conf",
"version": "2.1.0",
"version": "2.2.0",
"license": "ISC",

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

"devDependencies": {
"eslint": "^7.23.0",
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.2.0",
"eslint-config-standard": "^16.0.2",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-n": "^15.2.0",
"eslint-plugin-promise": "^6.0.0",
"husky": "^4",
"lint-staged": "^10",
"lint-staged": "^12",
"mock-fs": "^5.1.2",
"prettier": "^2.2.1",
"rimraf": "^3.0.0",
"tap": "^15.1.6"
"tap": "^16.2.0"
},

@@ -50,0 +50,0 @@ "scripts": {

@@ -103,3 +103,3 @@ # app-conf

> Note: To ensure the configuration is parsed the same way as your application (e.g. optional formats), this command should be run from your appliacation directory and not from a global install.
> Note: To ensure the configuration is parsed the same way as your application (e.g. optional formats), this command should be run from your application directory and not from a global install.

@@ -106,0 +106,0 @@ ## Contributing

@@ -10,3 +10,3 @@ "use strict";

try {
// eslint-disable-next-line node/no-extraneous-require
// eslint-disable-next-line n/no-extraneous-require
return require("json5").parse;

@@ -16,3 +16,3 @@ } catch (_) {}

try {
// eslint-disable-next-line node/no-extraneous-require
// eslint-disable-next-line n/no-extraneous-require
const stripJsonComments = require("strip-json-comments");

@@ -55,3 +55,3 @@ return function parseJson(json) {

try {
// eslint-disable-next-line node/no-missing-require
// eslint-disable-next-line n/no-missing-require
const CSON = require("cson-parse");

@@ -74,3 +74,3 @@

try {
// eslint-disable-next-line node/no-missing-require
// eslint-disable-next-line n/no-missing-require
const ini = require("ini");

@@ -92,3 +92,3 @@

try {
// eslint-disable-next-line node/no-missing-require
// eslint-disable-next-line n/no-missing-require
const { parse, stringify } = require("@iarna/toml");

@@ -105,3 +105,3 @@

try {
// eslint-disable-next-line node/no-extraneous-require
// eslint-disable-next-line n/no-extraneous-require
const yaml = require("js-yaml");

@@ -129,3 +129,3 @@

return dump(value, {
indent: indent,
indent,
});

@@ -132,0 +132,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