Skip to content

fix: Allow package.json to have missing dependency property - #23

Merged
lili2311 merged 1 commit into
masterfrom
fix/allow-empty-dependencies
Oct 5, 2018
Merged

fix: Allow package.json to have missing dependency property#23
lili2311 merged 1 commit into
masterfrom
fix/allow-empty-dependencies

Conversation

@lili2311

@lili2311 lili2311 commented Oct 5, 2018

Copy link
Copy Markdown
Contributor
  • Tests written and linted ℹ︎
  • Commit history is tidy ℹ︎

What this does

Even though dependencies is a required field for npm, npm init doesn't seem to generate this property and users can easily not add the dependencies to the file. Return empty tree if this happens and do not error.

Notes for the reviewer

Instructions on how to run this locally, background context, what to review, questions…

More information

@lili2311 lili2311 self-assigned this Oct 5, 2018
@CLAassistant

CLAassistant commented Oct 5, 2018

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@adrukh

adrukh commented Oct 5, 2018

Copy link
Copy Markdown
Contributor

Can you also add a test case where the package.json file simply doesn't have the dependencies key?

@lili2311

lili2311 commented Oct 5, 2018

Copy link
Copy Markdown
Contributor Author

@adrukh That is exactly what this test is, it re-uses a fixture we already have which only has devDependencies https://github.com/snyk/nodejs-lockfile-parser/blob/master/test/lib/fixtures/dev-deps-only/package.json

@lili2311
lili2311 requested a review from miiila October 5, 2018 14:54

@miiila miiila left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🥇

@lili2311
lili2311 merged commit bda244f into master Oct 5, 2018
@lili2311
lili2311 deleted the fix/allow-empty-dependencies branch October 5, 2018 15:18
@snyksec

snyksec commented Oct 5, 2018

Copy link
Copy Markdown

🎉 This PR is included in version 1.5.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

5 participants