Coder Social home page Coder Social logo

npm-on-ipfs's Introduction

npm distributed on top of lots of connected IPFS nodes worldwide

npm on IPFS

Build Status Code Coverage Dependency Status

Install your favourite modules from the Distributed Web using IPFS. Have a cache always ready and share them in all your local networks.

PRE-RELEASE WARNING

This module depends on features in the upcoming v0.34.0 release of js-ipfs (due by the end of December 2018).

If you use this module, please aslo upgrade your IPFS install with

npm install -g [email protected]

Resources

Lead Maintainer

Alex Potsides

Install this module

> npm i ipfs-npm -g

Usage

ipfs-npm wraps your chosen package manager (e.g. npm or yarn) with configuration to use IPFS to retrieve your dependences instead of over HTTP from the central npm registry.

In the directory with your package.json file, run:

$ ipfs-npm install
๐Ÿ‘ฟ Spawning an in-process IPFS node
Swarm listening on /ip4/127.0.0.1/tcp/57029/ipfs/QmVDtTRCoYyYu5JFdtrtBMS4ekPn8f9NndymoHdWuuJ7N2
๐Ÿ—‚๏ธ Loading registry index from https://registry.js.ipfs.io
โ˜Ž๏ธ Dialling registry mirror /ip4/35.178.192.119/tcp/10015/ipfs/QmWBaYSnmgZi6F6D69JuZGhyL8rm6pt8GX5r7Atc6Gd7vR,/dns4/registry.js.ipfs.io/tcp/10015/ipfs/QmWBaYSnmgZi6F6D69JuZGhyL8rm6pt8GX5r7Atc6Gd7vR
๐Ÿ—‘๏ธ Replacing old registry index if it exists
๐Ÿ“  Copying registry index /ipfs/QmQmVsNFw3stJky7agrETeB9kZqkcvLSLRnFFMrhiR8zG1 to /npm-registry
๐Ÿ‘ฉโ€๐Ÿš€ Starting local proxy
๐Ÿš€ Server running on port 57314
๐ŸŽ Installing dependencies with /Users/alex/.nvm/versions/node/v10.8.0/bin/npm
...

You can use any command you'd use with npm/yarn with ipfs-npm in exactly the same way:

$ ipfs-npm install
$ ipfs-npm version minor
$ ipfs-npm publish

$ ipfs-npm --package-manager=yarn
// etc

CLI

$ ipfs-npm --help
ipfs-npm

Installs your js dependencies using IPFS

Options:
  --help                        Show help                              [boolean]
  --version                     Show version number                    [boolean]
  --package-manager             Which package manager to use - eg. npm or yarn
                                                                [default: "npm"]
  --ipfs-registry               Where to download any packages that haven't made
                                it into the registry index yet from
                                        [default: "https://registry.js.ipfs.io"]
  --registry-upload-size-limit  How large a file upload to allow when proxying
                                for the registry             [default: "1024MB"]
  --registry-update-interval    Only request the manifest for a given module
                                every so many ms                [default: 60000]
  --registry-connect-timeout    How long to wait while dialling the mirror
                                before timing out                [default: 5000]
  --registry-read-timeout       How long to wait for individual packages before
                                timing out                       [default: 5000]
  --ipfs-mfs-prefix             Which mfs prefix to use
                                                      [default: "/npm-registry"]
  --ipfs-node                   "proc" to start an in-process IPFS node,
                                "disposable" to start an in-process disposable
                                node, "go" or "js" to spawn an IPFS node as a
                                separate process or a multiaddr that resolves to
                                a running node                 [default: "proc"]
  --ipfs-repo                   If --ipfs-node is set to "proc", this is the
                                path that contains the IPFS repo to use
                                                [default: "/Users/alex/.jsipfs"]
  --ipfs-flush                  Whether to flush the MFS cache   [default: true]
  --clone-pin                   Whether to pin cloned modules   [default: false]
  --request-max-sockets         How many concurrent http requests to make while
                                cloning the repo                   [default: 10]
  --request-retries             How many times to retry when downloading
                                manifests and tarballs from the registry
                                                                    [default: 5]
  --request-retry-delay         How long in ms to wait between retries
                                                                 [default: 1000]
  --request-timeout             How long in ms we should wait when requesting
                                files                           [default: 30000]
  --npm-registry                A fallback to use if the IPFS npm registry is
                                unavailable
                                         [default: "https://registry.npmjs.com"]

Update your registry index

By default we keep a local copy of the npm registry index in your mfs at /npm-registry and update it when you install new packages. This means for the first request for a given module it will be fetched from npm over http. There is a continously updated copy of the npm registry index with CIDs for all modules being generated by the ipfs-npm-registry-mirror - if you'd like to clone this registry index, use the update-registry-index subcommand:

$ ipfs-npm update-registry-index

npm-on-ipfs's People

Contributors

daviddias avatar achingbrain avatar ralphtheninja avatar dignifiedquire avatar alanshaw avatar despairblue avatar mateon1 avatar

Watchers

Peter Grassberger avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.