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

base-cli

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base-cli - npm Package Compare versions

Comparing version 0.4.23 to 0.4.24

lib/init2.js

2

index.js

@@ -21,3 +21,3 @@ /*!

argv(this, process.argv.slice(2));
cli(this, options.keys || []);
cli(this, options.keys || [], utils.merge({}, app.options, options));
update(this);

@@ -24,0 +24,0 @@ };

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

module.exports = function(app, keys) {
module.exports = function(app, keys, options) {
app.debug.namespace += ':commands';

@@ -16,5 +16,5 @@ app.debug('commands');

app.debug('adding command > %s', key);
app.cli.map(key, commands[key](app));
app.cli.map(key, commands[key](app, options));
}
}
};
'use strict';
var debug = require('debug')('base:cli:ask');
var questions = require('../questions');
var utils = require('../utils');

@@ -28,3 +29,3 @@

module.exports = function(app) {
module.exports = function(app, options) {
return function(pattern, key, config, next) {

@@ -40,17 +41,33 @@ app.debug('command > %s: "%j"', key, pattern);

questions(app, options);
if (pattern === true) {
app.question('ask.choices', 'Which questions would you like to ask?');
console.log(app.questions);
next();
return;
}
var queue = utils.arrayify(pattern).map(function(str) {
if (!utils.isGlob(str)) {
str += '(\\.*|)';
}
return str;
});
// register the `question-match` plugin
app.questions.use(utils.match());
app.questions.match(queue);
app.questions.match(pattern === true ? '*' : pattern)
.on('ask', function(key, question) {
question.force();
})
.ask(function(err, answers) {
if (err) return next(err);
debug('answers:\n%j');
app.data(answers);
next(null, answers);
});
app.questions.on('ask', function(question) {
question.force();
});
app.ask(app.questions.queue, function(err, answers) {
if (err) return next(err);
debug('answers:\n%j');
app.data(answers);
next(null, answers);
});
};
};
'use strict';
var debug = require('debug')('base:cli:init');
var commands = require('spawn-commands');
var debug = require('debug')('base:cli:init');
var questions = require('./questions');
var utils = require('./utils');

@@ -20,53 +21,10 @@

function group(prefix) {
app.questions.add = function(name, msg, question) {
app.questions.set(prefix + '.' + name, msg, question);
return app.questions;
}
}
app.questions.disable('save');
questions(app, options);
app.questions.disable('save')
.set('global.preferences', 'Would you like to use global preferences?', {
type: 'confirm',
next: function(answer, question, answers, cb) {
if (answer === true) {
app.ask('config', cb);
} else {
cb(null, answers);
}
}
})
.set('config.layout', 'What layout would you like to use?', {
default: 'default'
})
.set('config.toc', 'Do you want to add a Table of Contents to README.md?', {
type: 'confirm',
default: false
})
.set('config.plugins', 'What plugins do you want to use?', {
default: ['gulp-format-md']
})
.set('config.tasks', 'What tasks or generators do you want to run on this project?', {
default: ['readme']
})
.set('config.run', 'Do you want to run tasks anyway when only non-task flags are passed?', {
type: 'confirm'
})
.set('config.lint.reflinks', 'Do you want to lint for missing reflinks and add them to verb config?', {
type: 'confirm'
})
.set('after.plugins', 'Plugins need to be installed, want to do that now?', {
type: 'confirm'
});
app.ask('global.preferences', function(err, answers) {
app.ask('init.choose', function(err, answers) {
if (err) return cb(err);
debug('finished with global.preferences "%j"', answers);
debug('finished with init.choose "%j"', answers);
var answer = utils.get(answers, 'global.preferences');
if (answer === true) {
app.questions.globals.set('preferences', answers.config);
}
var plugins = arrayify(app, utils.get(answers, 'config.plugins'));

@@ -77,4 +35,4 @@ if (plugins.length) {

var yes = utils.get(res, 'after.plugins');
if (yes) {
var answer = utils.get(res, 'after.plugins');
if (answer === true) {
install(plugins, function(err) {

@@ -81,0 +39,0 @@ if (err) return cb(err);

@@ -27,10 +27,9 @@ 'use strict';

require('ansi-colors', 'colors');
require('arr-union', 'union');
require('define-property', 'define');
require('extend-shallow', 'extend');
require('fancy-log', 'timestamp');
require('get-value', 'get');
require('is-affirmative');
require('kind-of', 'typeOf');
require('get-value', 'get');
require('set-value', 'set');
require('arr-union', 'union');
require('map-schema', 'Schema');

@@ -40,2 +39,3 @@ require('minimist');

require('question-match', 'match');
require('set-value', 'set');

@@ -73,2 +73,27 @@ // naming

/**
* Save a value to, or delete a value from the specified stores.
*/
utils.stores = function(app, stores, val, method) {
if (!Array.isArray(stores)) return;
method = method || 'set';
var len = stores.length;
var idx = -1;
if (utils.isObject(val)) {
delete val.stores;
}
while (++idx < len) {
var name = stores[idx];
if (name === 'pkg') {
app[name][method](app._name, val);
} else {
app[name][method](val);
}
}
};
/**
* Returns true if `val` is true or is an object with `show: true`

@@ -75,0 +100,0 @@ *

{
"name": "base-cli",
"description": "Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a few plugins, like 'base-store', 'base-options' and 'base-data'.",
"version": "0.4.23",
"version": "0.4.24",
"homepage": "https://github.com/jonschlinkert/base-cli",

@@ -135,2 +135,2 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

}
}
}

@@ -75,3 +75,3 @@ # base-cli [![NPM version](https://img.shields.io/npm/v/base-cli.svg)](https://www.npmjs.com/package/base-cli) [![Build Status](https://img.shields.io/travis/jonschlinkert/base-cli.svg)](https://travis-ci.org/jonschlinkert/base-cli)

### [.ask](lib/commands/ask.js#L28)
### [--ask](lib/commands/ask.js#L29)

@@ -96,3 +96,3 @@ Force questions that match the given pattern to be asked. The resulting answer data is merged onto `app.cache.data`.

### [.config](lib/commands/config.js#L31)
### [--config](lib/commands/config.js#L31)

@@ -118,3 +118,3 @@ Persist a value to a namespaced config object in package.json. For example, if you're using `verb`, the value would be saved to the `verb` object.

### [.cwd](lib/commands/cwd.js#L21)
### [--cwd](lib/commands/cwd.js#L21)

@@ -132,3 +132,3 @@ Set the current working directory.

### [.data](lib/commands/data.js#L25)
### [--data](lib/commands/data.js#L25)

@@ -150,3 +150,3 @@ Set data on the `app.cache.data` object. This is the API-equivalent of calling `app.data()`.

### [.disable](lib/commands/disable.js#L19)
### [--disable](lib/commands/disable.js#L19)

@@ -162,3 +162,3 @@ Disable a configuration setting. This is the API-equivalent of calling `app.disable('foo')`, or `app.option('foo', false)`.

### [.emit](lib/commands/emit.js#L21)
### [--emit](lib/commands/emit.js#L21)

@@ -178,3 +178,3 @@ Bind `console.error` to the given event listener, so that when event `name` is emitted, the event arguments will be output in the console.

### [.enable](lib/commands/enable.js#L19)
### [--enable](lib/commands/enable.js#L19)

@@ -190,3 +190,3 @@ Enable a configuration setting. This is the API-equivalent of calling `app.enable('foo')`, or `app.option('foo', true)`.

### [.global](lib/commands/g.js#L25)
### [--global](lib/commands/g.js#L25)

@@ -210,3 +210,3 @@ Persist a value to the global config store by prefixing a command line option with `-g` or `--global`.

### [.init](lib/commands/init.js#L17)
### [--init](lib/commands/init.js#L17)

@@ -221,3 +221,3 @@ Ask initialization questions and persist answer data to the global config store.

### [.open](lib/commands/open.js#L21)
### [--open](lib/commands/open.js#L21)

@@ -235,3 +235,3 @@ Open a directory, or open a file in the default application associated with the file type.

### [.option](lib/commands/option.js#L25)
### [--option](lib/commands/option.js#L25)

@@ -251,3 +251,3 @@ Set options on the `app.options` object. This is the API-equivalent of calling `app.option()`. You may also use the plural `--options` flag for identical behavior.

### [.options](lib/commands/options.js#L24)
### [--options](lib/commands/options.js#L24)

@@ -269,3 +269,3 @@ Set in-memory options on the `app.options` object. This is the API-equivalent of calling `app.option()`. You may also use the singular `--option` flag for identical behavior.

### [.save](lib/commands/save.js#L25)
### [--save](lib/commands/save.js#L25)

@@ -289,19 +289,4 @@ Persist a value to the global config store by prefixing a command line option with `--save` or `-s`.

### [.tasks](lib/commands/task.js#L20)
### [--tasks](lib/commands/tasks.js#L20)
Alias for `--tasks`. Run the given generators and tasks. This flag is unnecessary when used with [base-runner](https://github.com/jonschlinkert/base-runner).
**Example**
```sh
# run task "foo"
$ app --task foo
#=> {task: ['foo']}
# run generator "foo", task "bar"
$ app --task foo:bar
#=> {task: ['foo:bar']}
```
### [.tasks](lib/commands/tasks.js#L20)
Run the given generators and tasks. This flag is unnecessary when used with [base-runner](https://github.com/jonschlinkert/base-runner).

@@ -320,3 +305,3 @@

### [.show](lib/utils.js#L78)
### [--show](lib/utils.js#L103)

@@ -381,2 +366,2 @@ Returns true if `val` is true or is an object with `show: true`

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