Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify which areas of package to upgrade #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Xotic750
Copy link

#15

Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! A few comments.

Also, please make sure that the main salita function throws if the sections option is invalid, and also please ensure that bin/salita exits with an argument error if you:

  1. pass duplicate section names
  2. pass a section name that we do not support
  3. pass the argument, but no section names

README.md Outdated
@@ -27,6 +27,7 @@ salita
- `--ignore-stars`: ignore updates to packages that are set to "*"
- `--ignore-pegged`: ignore updates to packages that are pegged to a single version, rather than a range
- `--check`: implies "dry-run"; and returns with an exit code matching the number of updated dependencies.
- `--sections`: comma-separated list of sections to process, default: dep,dev,pee,opt.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/pee/peer/g, there's no need to make them all be 3 letters - and "pee" isn't really a good word choice :-)

bin/salita Outdated
@@ -27,6 +27,8 @@ var options = require('yargs')
.boolean('ignore-pegged').describe('ignore-pegged', 'ignore updates to packages that are pegged to a single version, rather than a range')
.boolean('check').describe('check', 'implies --dry-run and --no-update, and returns with an exit code matching the number of updated dependencies')
.default('check', FALSE).alias('check', 'c')
.string('sections').describe('sections', 'comma-separated list of sections to process, default: dep,dev,pee,opt')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe this can be made an array instead of a string, and yargs should do the splitting for us?

index.js Outdated
var sectionCheck = function (options, key) {
return options.sections.some(function (section) {
var length = section.length;
return length > 2 && key.slice(0, length) === section;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than an implicit relationship, let's please use an explicit map of option → section name.

index.js Outdated
var depLookup = Promise.all(dependenciesLookup(pkg.data, key, options['ignore-stars'], options['ignore-pegged']));
depLookups.push(depLookup);
depPromises.push(depLookup.then(options.json ? createResultJSON(key) : createResultTable(title)));
if (sectionCheck(options, key)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can probably just pass options.section; there's no need to pass the entire object here.

bin/salita Outdated
return false;
};

var sections = ['dep', 'dev', 'peer', 'opt'];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since "opt" isn't actually supported right now, it probably shouldn't be included right now?

Also, it'd probably be better if the main salita function exports this list rather than duplicating it in bin/salita

Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This seems good; I'll test it locally for a few days prior to merging.

@Xotic750
Copy link
Author

No problem. Glad to help when I can.

@ljharb
Copy link
Collaborator

ljharb commented Mar 31, 2017

@Xotic750 in testing this locally, when i do salita -s dep for example, it completely omits the dev and peer dep sections - I think I want the section heading always displayed in the output; perhaps noting it as skipped is sufficient (instead of listing all the versions in it anyways).

Also, in using this, I think that -s dep,dev,peer is more friendly than -s dep dev peer, but this seems to be how yargs operates. I filed yargs/yargs#846 to investigate this; in the meantime let's keep it as-is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants