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

[BUG] Redirect Installation of package x when a request for package y installation is made using config in package.json #9

Closed
1 task done
ganeshkbhat opened this issue Aug 9, 2022 · 3 comments

Comments

@ganeshkbhat
Copy link

ganeshkbhat commented Aug 9, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Need to change the entire sourcecode for the npmjs project or use an local alias to install a different package B instead of package A.

Expected Behavior

I should be able to redirect installation of a npmjs A package to npmjs B package from package.json config.

Citing my repositories as an example to ensure not to make phpcgijs old versions unfindable. What I am wishing to do is redirect phpcgijs to cgijs

package.json

{
...
"repository": {
    "type": "git",
    "url": "https://github.com/ganeshkbhat/cgi-js.git",
    "redirect": "newpackagename_preferably--OR--differentrepository"
  }
}

OR

{
...
"redirect": "newpackagename_preferably"
"repository": {
    "type": "git",
    "url": "https://github.com/ganeshkbhat/cgi-js.git"
  }
}

Steps To Reproduce

NA

Environment

  • npm: Current
  • Node: Current
  • OS: Windows / Linux / Mac
  • platform: Windows / Linux / Mac
@ganeshkbhat
Copy link
Author

ganeshkbhat commented Sep 22, 2022

Merging Issues. Seems this feature is being worked on already. I was not aware nor communicated. I though that was not nice at all.

npm/cli#5009
npm/config#76
#9

@ganeshkbhat
Copy link
Author

ganeshkbhat commented Mar 31, 2023

Citing npm package being pushed in as spam based on these articles I wish to push this as a reason to avoid false positives for a few percent of npm packages which were published as new packages:

While there may be a lot of spam packages, if you have duplicate package - renamed or republished due to some reason allowing redirect of a npm package to a different package name is definitely going to be a critical feature. You may want to do two this as per my view here:

  1. npm package one -> redirect -> npm package two using keyword in package.json (the feature will install npm package two instead of npm package one).
  2. npm package one -> redirect -> npm package two when opening the npm website
    • Redirect the npmjs website desciption page for npm package one to npm package two since the package.json specifies config of redirect from npm package one to npm package two
    • Alternatively put a note in npmjs website in package description page that the npm package one is deprecated in favour of npm package two and that installation of npm package one will lead to installation of npm package two). This will help you to take a look at legacy npm package one package, its description, and its legacy code. This is expected and preferable.

I am now updating the expected behaviour in the issues from:

I should be able to redirect a npmjs A package to npmjs B package from package.json config. to I should be able to redirect installation of a npmjs A package to npmjs B package from package.json config.

@ganeshkbhat ganeshkbhat changed the title [BUG] Redirect a npmjs A package to npmjs B package from package.json config [BUG] Redirect Installation of a npmjs A package to npmjs B package from package.json config Mar 31, 2023
@ganeshkbhat ganeshkbhat changed the title [BUG] Redirect Installation of a npmjs A package to npmjs B package from package.json config [BUG] Redirect Installation of package x when a request for package y installation is made using config in package.json Mar 31, 2023
@wraithgar
Copy link
Member

overrides are what you're looking for.

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