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

Outdated package normalization #959

Open
MartinKolarik opened this issue May 13, 2022 · 4 comments
Open

Outdated package normalization #959

MartinKolarik opened this issue May 13, 2022 · 4 comments

Comments

@MartinKolarik
Copy link
Collaborator

Looking into #657, I found npm now allows the repository property to be a string:

For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for npm install:

{
  "repository": "npm/npm",
  "repository": "github:user/repo",
  "repository": "gist:11081aaa281",
  "repository": "bitbucket:user/repo",
  "repository": "gitlab:user/repo"
}

The first case (not sure about others right now) isn't currently handled correctly:

	"githubRepo": null, // should not be null
	"repository": {
		"type": "git",
		"url": "npm/security-holder", // probably should be an actual URL?
		"project": "security-holder",
		"user": "npm",
		"host": "github.com",
		"path": "",
		"branch": "master"
	},

Npm's tool normalize-package-data normalizes this to the object format in the latest version. As it turns out, however, nice-package, which is used in this project, doesn't use normalize-package-data despite claiming so in the readme, it uses normalize-registry-metadata instead, which seems abandoned.

The reason repository has at least some information is it goes through hosted-git-info as well, which handles this format. This is likely not blocking #657 since we can check for repository.project and repository.user but still, the normalization library looks fairly outdated and there may be various other cases where it doesn't parse correct data.

@Haroenv
Copy link
Collaborator

Haroenv commented May 13, 2022

Great catch, I wasn't aware that the normalisation has changed

@MartinKolarik
Copy link
Collaborator Author

Note that we currently don't handle repository.directory field because of the old hosted-git-info version. Might be something to fix on our side if we don't decide to upgrade that package as the field is useful for mono repos: jupyterlab/jupyterlab#6443

@Haroenv
Copy link
Collaborator

Haroenv commented Dec 18, 2023

Maybe we switch to the new version, but patch the breaking changes?

@MartinKolarik
Copy link
Collaborator Author

Maybe we switch to the new version, but patch the breaking changes?

It's an option for sure.

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

No branches or pull requests

2 participants