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: lockfile parser must always return depTree.name #29

Merged
merged 2 commits into from
Dec 2, 2018

Conversation

yuliabaron
Copy link
Contributor

@yuliabaron yuliabaron commented Dec 2, 2018

  • Tests written and linted ℹ︎
  • Documentation written ℹ︎
  • Commit history is tidy ℹ︎

What this does

When package name is missing use manifest filename instead

More information

https://snyksec.atlassian.net/browse/SC-6758
Also related to https://github.com/snyk/npm-deps/pull/53 and https://github.com/snyk/registry/pull/6331

@yuliabaron yuliabaron self-assigned this Dec 2, 2018
@CLAassistant
Copy link

CLAassistant commented Dec 2, 2018

CLA assistant check
All committers have signed the CLA.

@yuliabaron yuliabaron closed this Dec 2, 2018
@yuliabaron yuliabaron reopened this Dec 2, 2018
@yuliabaron yuliabaron changed the title feat: lockfile parser must always return depTree.name BREAKING CHANGE: lockfile parser must always return depTree.name Dec 2, 2018
@yuliabaron yuliabaron changed the title BREAKING CHANGE: lockfile parser must always return depTree.name feat: lockfile parser must always return depTree.name Dec 2, 2018
const manifestFile = JSON.parse(manifestFileContents);
// Fallback to the file name if name is not set
if (!manifestFile.name) {
manifestFile.name = manifestFileName;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can I suggest to move all logic relevant to manifestFileName to /lib/index.ts? Looks like it is not related to parsers because they only need to parse existing file. And also it is less changes (do not need to pass manifestFileName everywhere).

lib/index.ts Outdated
@@ -21,7 +21,7 @@ export {
};

async function buildDepTree(
manifestFileContents: string, lockFileContents: string,
manifestFileContents: string, manifestFileName: string, lockFileContents: string,
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's maybe make it last argument and make it optional? This way you'll keep API consistent.

@yuliabaron yuliabaron force-pushed the feat/lockfile_parser_return_valid_name branch from b2aae05 to 3a9d98a Compare December 2, 2018 14:16
@yuliabaron yuliabaron merged commit 5b45a53 into master Dec 2, 2018
@yuliabaron yuliabaron deleted the feat/lockfile_parser_return_valid_name branch December 2, 2018 14:47
@snyksec
Copy link

snyksec commented Dec 2, 2018

🎉 This PR is included in version 1.9.0 🎉

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants