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

feat: Add .parserConfiguration() method, deprecating package.json config #1262

Merged
merged 5 commits into from Jan 29, 2019

Conversation

jean-emmanuel
Copy link
Contributor

@jean-emmanuel jean-emmanuel commented Dec 30, 2018

A non-breaking proposal to address #1259 and #1248, it might be incomplete so please amend if needed.

@bcoe
Copy link
Member

bcoe commented Dec 30, 2018

@jean-emmanuel this looks great, we should add a test though 👍

@jean-emmanuel
Copy link
Contributor Author

I just pushed 2 tests, what do you think ?

@jean-emmanuel
Copy link
Contributor Author

Travis' fail seems unrelated by the way.

Copy link
Contributor

@evocateur evocateur left a comment

Choose a reason for hiding this comment

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

Really excited for this!

One small tweak and we're good to go.

yargs.js Show resolved Hide resolved
@bcoe
Copy link
Member

bcoe commented Jan 22, 2019

@evocateur @jean-emmanuel where does this stand? would love to land the work; I'm thinking perhaps we land this as a major, and then in the next major actually retire it?

Copy link
Contributor

@evocateur evocateur left a comment

Choose a reason for hiding this comment

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

I think this is good to go now, @bcoe

@evocateur
Copy link
Contributor

This strikes me as semver-minor, with removal in the next major. If there are other semver-majors waiting in the wings, it could certainly go along with that.

@bcoe
Copy link
Member

bcoe commented Jan 28, 2019

@evocateur @jean-emmanuel, @isaacs just pointed this out to me:

https://nodejs.org/api/util.html#util_util_deprecate_fn_msg_code

☝️ Node.js has a built in deprecate message that debounces.

@bcoe
Copy link
Member

bcoe commented Jan 28, 2019

let's use this -- @evocateur there's some somewhat finicky breaking changes landing in yargs-parser, so I'm a bit tempted to land it in a major (the ones you reviewed around handling of missing right-hand values).

Copy link
Contributor

@evocateur evocateur left a comment

Choose a reason for hiding this comment

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

Thanks for your patience @jean-emmanuel, do you have time to migrate to util.deprecate()?

yargs.js Show resolved Hide resolved
@evocateur
Copy link
Contributor

@bcoe As @jean-emmanuel rightly pointed out, util.deprecate() isn't appropriate for something that is called every time yargs parses arguments.

@evocateur evocateur changed the title Deprecate package.json config and add parserConfiguration method feat: Add .parserConfiguration() method, deprecating package.json config Jan 29, 2019
@evocateur evocateur merged commit b9766d1 into yargs:master Jan 29, 2019
@evocateur
Copy link
Contributor

Thanks @jean-emmanuel!

@jean-emmanuel
Copy link
Contributor Author

woohooo !

bcoe pushed a commit that referenced this pull request Jan 30, 2019
…onfig (#1262)

BREAKING CHANGE: we now warn if the yargs stanza package.json is used.
trevorlinton added a commit to trevorlinton/yargs that referenced this pull request Jan 30, 2019
@bcoe
Copy link
Member

bcoe commented Feb 12, 2019

this is now available in yargs@13.1.0.

@plroebuck
Copy link

plroebuck commented Feb 19, 2019

Uh, yeah. @bcoe?
Re: mochajs/mocha#3742

  • yargs-13.0.0 mentions in "breaking changes" that Node-6 was being dropped (though "package.json" still shows "node": ">=6"). Did you or didn't you?
  • Mocha will support Node-6 at least until end-of-life, so cannot upgrade to yargs-13 yet if support dropped (or will be without another semver-major).
  • Yargs-13 introduced yargs.parserConfiguration, but no backport to yargs-12 available.
  • Users using yargs-13 now get deprecation warning, with no visible means to address the problem from Mocha via yargs-12.

Recommendations?

@plroebuck
Copy link

plroebuck commented Feb 19, 2019

BTW, your documentation shows:

yargs.parserConfiguration({
  "yargs": {
    "short-option-groups": true,
    "camel-case-expansion": true,
    "dot-notation": true,
    "parse-numbers": true,
    "boolean-negation": true
  }
})

but "test/fixtures/configured-bin.js" shows:

var argv = require('./yargs/index.js')
  .parserConfiguration({'dot-notation': true})
  .help('help')
  .version()
  .argv

@bcoe
Copy link
Member

bcoe commented Feb 19, 2019

  • yargs-13.0.0 mentions in "breaking changes" that Node-6 was being dropped (though "package.json" still shows "node": ">=6"). Did you or didn't you?

@plroebuck we can no longer promise that Node >=6 will continue to be supported in yargs 13; one reason being flakiness we were seeing in CI/CD with the current combination of npm and Node.js shipped on 6.x. The engine field was just missed being updated.

  • Mocha will support Node-6 at least until end-of-life, so cannot upgrade to yargs-13 yet if support dropped (or will be without another semver-major).

We would be open to back-porting this change-request, and security patches back to 12.x.

BTW, your documentation shows...

☝️ I believe the documentation is wrong.

@plroebuck could you open a few issues rather than commenting on a closed issue, the odds of us losing track of your comment are high.

@jean-emmanuel interested in back-porting this to yargs@12.x without the deprecation warning. To do so we would create a new 12.x branch, from the point at which we released 8789bf4, and cherry-pick create a pull request against this branch.

romellem added a commit to romellem/bundle-phobia-cli that referenced this pull request Jul 24, 2019
Using the "yargs" key with 'package.json' was deprecated.
See yargs/yargs#1262 for more information
AdrieanKhisbe pushed a commit to AdrieanKhisbe/bundle-phobia-cli that referenced this pull request Oct 10, 2019
Using the "yargs" key with 'package.json' was deprecated.
See yargs/yargs#1262 for more information
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.

None yet

4 participants