Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ipfs-npm-republish

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-npm-republish

Republish your node project's dependencies to IPFS as a micro-registry

  • 1.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ipfs-npm-republish

Republish your node project's dependencies to IPFS as a micro-registry

Install

npm install -g ipfs-npm-republish

You also need IPFS running, I recommend installing IPFS Desktop.

Usage

To republish all the dependencies for your application, run the following command within folder with a package-lock.json present:

ipfs-npm-republish

To republish a specific module from npm along with it's dependencies to ipfs, run the following command passing the name of the package:

ipfs-npm-republish react

adding a version string also works:

ipfs-npm-republish react@16.8.6

You can also publish a new package directly to IPFS without needing to first publish to npmjs.org, run the following command within folder with a package.json present:

ipfs-npm-republish publish

To publish a second release to an existing package that was published to IPFS, you can pass the hash of the previous version of the registry:

ipfs-npm-republish publish bafybeiahqsziz6mxofxlvx3baqcrihjicxoh27mcg4eukwybvb2u7whuzm

You can also merge two micro-registries together:

ipfs-npm-republish merge bafybeib7yv2z6bgmzphqjuexdb6smfah6pitmah4hzqb7rw7yjzmwocb6e bafybeic3ldukh6jfg2wq4fhrigtvgnf5lml6wo5qdkmsdlr3ieo63qczyu

How it works

1. List dependencies for current directory from package-lock.json
2. Calculate list of packages to be republished
3. create an folder to act as ROOT
4. For each package
  1. Fetch packuments for each package and write to ROOT
  2. For each depended upon version:
    1. download the tarball to ROOT
    2. ipfs add tarball
    3. rewrite the dist.tarball url to a local gateway url with tarball hash
5. ipfs add -r ROOT
7. set per-project npm config to use new micro-registry
8. output command to update registry to point to ipfs ROOT hash

TODOS

  • Publish ROOT to ipns (optional due to speed issues)
  • Don't upload private modules
  • support git dependencies
  • check that IPFS is running locally
  • check that you have a package-lock.json
  • tests!

License

MIT

FAQs

Package last updated on 14 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc