Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Unable to set warnOnNotSemver to false #69

Open
pdehaan opened this issue Mar 31, 2015 · 1 comment
Open

Unable to set warnOnNotSemver to false #69

pdehaan opened this issue Mar 31, 2015 · 1 comment

Comments

@pdehaan
Copy link
Contributor

pdehaan commented Mar 31, 2015

I added npm-shrinkwrap locally to my project (npm i npm-shrinkwrap -D), but I don't seem to be able to set --warnOnNotSemver to false.

$ npm run shrinkwrap --warnOnNotSemver=false

> npm-shrinkwrap --dev

{ _: [],
  dev: true,
  dirname: '/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server',
  keepNested: false,
  warnOnNotSemver: true,
  cmd: 'npm-shrinkwrap' }
$ npm run shrinkwrap --warnOnNotSemver:false

> npm-shrinkwrap --dev

{ _: [],
  dev: true,
  dirname: '/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server',
  keepNested: false,
  warnOnNotSemver: true,
  cmd: 'npm-shrinkwrap' }
$ npm run shrinkwrap --warnOnNotSemver false

> npm-shrinkwrap --dev

{ _: [],
  dev: true,
  dirname: '/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server',
  keepNested: false,
  warnOnNotSemver: true,
  cmd: 'npm-shrinkwrap' }

Each time warnOnNotSemver seems to be set to true, and I see the warnings.

@pdehaan
Copy link
Contributor Author

pdehaan commented Mar 31, 2015

$ ./node_modules/.bin/npm-shrinkwrap --warnOnNotSemver=0
{ _: [],
  warnOnNotSemver: true,
  dirname: '/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server',
  keepNested: false,
  cmd: 'npm-shrinkwrap' }

I think that almost makes sense, given this code:

    opts.warnOnNotSemver = opts.warnOnNotSemver ?
        opts.warnOnNotSemver : true;

— via ./bin/cli.js:35-36

If my value for opts.warnOnNotSemver is false (because I don't want the warnings), then the if statement fails and sets the value to true.


$ ./node_modules/.bin/npm-shrinkwrap --dev --warnOnNotSemver=false
{ _: [],
  dev: true,
  warnOnNotSemver: 'false',
  dirname: '/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server',
  keepNested: false,
  cmd: 'npm-shrinkwrap' }

Here my value of 'false' is set as a string, which probably gets converted to a value of true.

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

No branches or pull requests

1 participant