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

Support republishing git dependencies #7

Open
andrew opened this issue Jun 7, 2019 · 2 comments
Open

Support republishing git dependencies #7

andrew opened this issue Jun 7, 2019 · 2 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@andrew
Copy link
Contributor

andrew commented Jun 7, 2019

Currently ipfs-npm-republish skips republishing git dependencies as they need to be downloaded slightly differently, to fully support republishing of ipfs-npm or ipfs then we'll need to properly support those options.

The current setup doesn't break installations because the npm client will go to github to fetch those dependencies, but that means it won't work 100% offline if there are git dependencies anywhere in the tree, and if they have unique dependencies from npmjs.org, they may not be included in the microregistry.

Couple of options:

  • check out the git repo, run npm pack, generate a packument and then rewrite the any dependencies to point at the new packument (not great)
  • add the checked out git directory to the microregistry and create an ipfs-npm-republish install command that can pull from there rather than trying to go to Github

Those git repos will also need to be checked out when publishing to correctly resolve the full dependency tree. Ideally we can lean on the internals of npm/yarn rather than reimplimenting it all again.

@andrew andrew added the kind/bug A bug in existing code (including security flaws) label Jun 7, 2019
@andrew andrew added the help wanted Seeking public contribution on this issue label Jun 10, 2019
@andrew
Copy link
Contributor Author

andrew commented Jun 11, 2019

Looks like the pacote library will take care of most of the plumbing, will tackle it this evening.

@andrew andrew self-assigned this Jun 11, 2019
@andrew andrew removed the help wanted Seeking public contribution on this issue label Jun 11, 2019
andrew added a commit that referenced this issue Jun 12, 2019
Related to #7, doesn't publish the github dependency itself to the 
micro-registry but does include any regular npm dependencies the github 
dependencies have.
@andrew
Copy link
Contributor Author

andrew commented Jun 12, 2019

As of 9f2db41 the dependencies of github dependencies are correctly added to the micro-registry, that means you can republish a module from npm that has github dependencies and the full transitive dependency tree is stored except for the actual github dependencies themselves.

That means it doesn't work offline but it does work without touching registry.npmjs.org.

To make it work offline will require either:

  • rewriting the package.json that declares the github dependency to point to a specific version published to the micro-registry
  • making a separate hacky install command that intercepts the github: dependencies and loads them from the micro-registry

The second option is much nastier as it doesn't allow the consumers to use which ever client their like (yarn, pnpm etc), the only downside to the first option is that the integrity values for the packages which have written package.json files won't match with the integrity from registry.npmjs.org.

@andrew andrew removed their assignment Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

No branches or pull requests

1 participant