New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

base-cli-process

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base-cli-process - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

5

index.js

@@ -15,4 +15,3 @@ 'use strict';

return function(app, base) {
if (!this.isApp) return;
if (this.isRegistered('base-cli-process')) return;
if (!this.isApp || this.isRegistered('base-cli-process')) return;
debug('initializing <%s>, called from <%s>', __filename, module.parent.id);

@@ -66,2 +65,4 @@

function initPlugins(app, options) {
app.use(utils.cwd());
if (typeof app.option === 'undefined') {

@@ -68,0 +69,0 @@ app.use(utils.option(options));

6

lib/debug.js

@@ -6,9 +6,5 @@ 'use strict';

module.exports = function(prop) {
return debug('base:cli:process:' + prop);
};
module.exports.field = function(key, val) {
base('field')('normalizing ' + key + ', ' + val);
field('normalizing ' + key + ', ' + val);
};

@@ -41,3 +41,3 @@ 'use strict';

if (utils.isString(val)) {
val = utils.stripQuotes(val);
val = [utils.stripQuotes(val)];
}

@@ -44,0 +44,0 @@ app.config.process({asyncHelpers: val}, next);

'use strict';
var path = require('path');
var merge = require('merge-deep');
var normalize = require('../normalize');
var utils = require('../utils');

@@ -43,15 +43,24 @@

var keys = Object.keys(val);
var orig = app.pkg.get(name) || {};
var pkgPath = path.resolve(app.cwd, 'package.json');
var pkg = {};
// temporarily remove the config object from package.json
if (utils.exists(pkgPath)) {
pkg = require(pkgPath);
}
pkg = merge({}, app.pkg.data, pkg);
app.pkg.del(name);
var orig = pkg[name] || {};
// normalize both the old and new values befor merging, using
// a schema that is specifically used for normalizing values to
// be written back to package.json
orig = normalize(app, orig);
val = normalize(app, val);
orig = app.cli.schema.normalize(orig);
// merge the normalized values
var merged = merge({}, orig, val);
var merged = val;
if (utils.isObject(val) && utils.isObject(orig)) {
merged = merge({}, orig, val);
}

@@ -63,3 +72,2 @@ // show the new value in the console

// update options and `cache.config`
app.option(merged);
app.set('cache.config', merged);

@@ -74,4 +82,5 @@ app.emit('config', merged);

app.pkg.save();
next();
app.cli.process(merged, next);
};
};

@@ -23,3 +23,3 @@ 'use strict';

module.exports = function(app) {
module.exports = function(app, base) {
return function(val, key, config, next) {

@@ -38,4 +38,4 @@ app.debug('command > %s: "%j"', key, val);

} else {
for (var key in val) {
app.emit('data', key, val[key]);
for (var prop in val) {
app.emit('data', prop, val[prop]);
}

@@ -45,2 +45,3 @@ app.cache.data = utils.merge({}, app.cache.data, val);

}
config[key] = val;

@@ -47,0 +48,0 @@ next();

'use strict';
var util = require('util');
var utils = require('../utils');

@@ -42,3 +41,3 @@

if (utils.isString(val)) {
val = utils.stripQuotes(val);
val = config[key] = [utils.stripQuotes(val)];
}

@@ -45,0 +44,0 @@ app.config.process({helpers: val}, next);

'use strict';
var utils = require('../utils');
/**

@@ -6,0 +4,0 @@ * Merge options onto the `app.options` object. If the [base-option][] plugin

@@ -5,4 +5,5 @@ 'use strict';

return function(val, key, config, next) {
if (!val) return next();
app.config.process({use: val}, next);
};
};

@@ -16,2 +16,3 @@ 'use strict';

require('base-cli-schema', 'schema');
require('base-cwd', 'cwd');
require('base-config-process', 'config');

@@ -24,6 +25,6 @@ require('base-option', 'option');

require('arr-union');
require('fs-exists-sync', 'exists');
require('kind-of', 'typeOf');
require('log-utils', 'log');
require('mixin-deep', 'merge');
require('map-schema', 'Schema');
require('object.pick', 'pick');

@@ -30,0 +31,0 @@ require('os-homedir', 'home');

{
"name": "base-cli-process",
"description": "Commonly used config mappings for the base-cli plugin. Also pre-processes the given object with base-cli-schema before calling `.process()`",
"version": "0.1.0",
"description": "Normalizers for common argv commands handled by the base-cli plugin. Also pre-processes the given object with base-cli-schema before calling `.process()`",
"version": "0.1.1",
"homepage": "https://github.com/jonschlinkert/base-cli-process",

@@ -26,5 +26,6 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"arrayify-compact": "^0.2.0",
"base-cli": "^0.4.26",
"base-cli-schema": "^0.1.3",
"base-config-process": "^0.1.0",
"base-cli": "^0.5.0",
"base-cli-schema": "^0.1.7",
"base-config-process": "^0.1.1",
"base-cwd": "^0.1.6",
"base-option": "^0.7.0",

@@ -34,6 +35,7 @@ "base-pkg": "^0.2.0",

"export-files": "^2.1.1",
"fs-exists-sync": "^0.1.0",
"kind-of": "^3.0.2",
"lazy-cache": "^1.0.3",
"log-utils": "^0.1.0",
"merge-deep": "^2.0.2",
"merge-deep": "^3.0.0",
"mixin-deep": "^1.1.3",

@@ -65,5 +67,5 @@ "object.pick": "^1.1.2",

"baseplugin",
"commands",
"cli",
"command-line",
"cli"
"commands"
],

@@ -88,5 +90,5 @@ "verb": {

"reflinks": [
"verb",
"base-cli",
"base-cli-schema",
"base-cli"
"verb"
],

@@ -96,3 +98,6 @@ "lint": {

}
},
"base": {
"toc": true
}
}
# base-cli-process [![NPM version](https://img.shields.io/npm/v/base-cli-process.svg?style=flat)](https://www.npmjs.com/package/base-cli-process) [![NPM downloads](https://img.shields.io/npm/dm/base-cli-process.svg?style=flat)](https://npmjs.org/package/base-cli-process) [![Build Status](https://img.shields.io/travis/jonschlinkert/base-cli-process.svg?style=flat)](https://travis-ci.org/jonschlinkert/base-cli-process)
> Commonly used config mappings for the base-cli plugin. Also pre-processes the given object with base-cli-schema before calling `.process()`
> Normalizers for common argv commands handled by the base-cli plugin. Also pre-processes the given object with base-cli-schema before calling `.process()`

@@ -19,10 +19,10 @@ ## Install

var Base = require('base');
var config = require('base-cli-process');
var cli = require('base-cli-process');
var app = new Base();
app.use(config());
app.use(cli());
var pkg = require('./package');
app.config.process(pkg, function(err) {
app.cli.process(pkg, function(err) {
if (err) throw err;

@@ -36,5 +36,5 @@ });

* [base](https://www.npmjs.com/package/base): base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… [more](https://www.npmjs.com/package/base) | [homepage](https://github.com/node-base/base)
* [base-cli](https://www.npmjs.com/package/base-cli): Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a… [more](https://www.npmjs.com/package/base-cli) | [homepage](https://github.com/node-base/base-cli)
* [base-config](https://www.npmjs.com/package/base-config): base-methods plugin that adds a `config` method for mapping declarative configuration values to other 'base'… [more](https://www.npmjs.com/package/base-config) | [homepage](https://github.com/node-base/base-config)
* [base](https://www.npmjs.com/package/base): base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… [more](https://www.npmjs.com/package/base) | [homepage](https://github.com/node-base/base)

@@ -81,2 +81,2 @@ ## Contributing

_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 11, 2016._
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 15, 2016._
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