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

--project-name and --project-version being overridden by package.json #845

Closed
sripberger opened this issue Jul 19, 2017 · 1 comment
Closed
Assignees

Comments

@sripberger
Copy link

sripberger commented Jul 19, 2017

Using v4.0.0-rc.1, I'm completely unable to use either of these CLI options when a package.json is present.

Documentation is installed locally and I am running with an npm script:

"scripts": {
    "docs": "documentation build --project-name whatever --project-version 0.0.2 -f html -o docs"
}

The result always comes out with the project name and version taken from my package.json. Based on the CLI help, though, I'd expect the CLI options to take prioity.

I did some further investigation and found that if I remove either the name or version property from package.json, the corresponding value becomes an empty string, continuing to ignore the CLI options. The only way I seemed to be able to get it to respect the CLI options is by removing package.json altogether and running like this:

./node_modules/.bin/documentation build lib/index.js --project-name whatever --project-version 0.02 -f html -o docs

Of course, removing package.json is hardly ideal. I suppose if it's there, there isn't much reason to need the CLI options, so I wouldn't exactly call this a high priority. It just doesn't quite work like the help says.

@tmcw
Copy link
Member

tmcw commented Jul 21, 2017

Reviewing the code for this config merging, I'd expect your intended behavior as well: _.defaults should give preference to the passed CLI configuration over the package.json defaults. So either

  • This isn't the right code to look at (maybe)
  • This was fixed since rc.1 (i don't think so)
  • Bug in _.defaults (extremely unlikely)
  • I'm missing something right now (likely)

@anthony-redFox anthony-redFox self-assigned this Aug 3, 2017
anthony-redFox added a commit to anthony-redFox/documentation that referenced this issue Aug 4, 2017
The first priority from CLI(from user) settings then package.json.

Fixed documentationjs#845
@tmcw tmcw closed this as completed in #864 Aug 4, 2017
tmcw pushed a commit that referenced this issue Aug 4, 2017
The first priority from CLI(from user) settings then package.json.

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

No branches or pull requests

3 participants