From e1cd0011266843a5ce232bdf77c5ed851c741ecd Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 24 Jan 2020 14:30:20 +0000 Subject: [PATCH] refactor: move ipfs to peer deps Doing this reduced the size of `node_modules` in the js-IPFS module for me by about 300MB. Does require the user to bring their own version, but they can also skip installing go-IPFS if, for example, they are only going to use js-IPFS. --- .travis.yml | 18 +++++++++++++++++- README.md | 12 ++++++++++++ package.json | 8 +++++--- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6d271932..d1773910 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,11 @@ os: - osx - windows -script: npx nyc -s npm run test:node -- --timeout 60000 +script: + - npm install ipfs + - npm install ipfs-http-client + - npm install go-ipfs-dep + - npx nyc -s npm run test:node -- --timeout 60000 after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov jobs: @@ -31,6 +35,9 @@ jobs: addons: chrome: stable script: + - npm install ipfs + - npm install ipfs-http-client + - npm install go-ipfs-dep - npx aegir test -t browser -t webworker --bail --timeout 60000 - stage: test @@ -38,18 +45,27 @@ jobs: addons: firefox: latest script: + - npm install ipfs + - npm install ipfs-http-client + - npm install go-ipfs-dep - npx aegir test -t browser -t webworker --bail --timeout 60000 -- --browsers FirefoxHeadless - stage: test name: electron-main os: osx script: + - npm install ipfs + - npm install ipfs-http-client + - npm install go-ipfs-dep - npx aegir test -t electron-main --bail --timeout 60000 - stage: test name: electron-renderer os: osx script: + - npm install ipfs + - npm install ipfs-http-client + - npm install go-ipfs-dep - npx aegir test -t electron-renderer --bail --timeout 60000 notifications: email: false \ No newline at end of file diff --git a/README.md b/README.md index 49014cd9..231aa250 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,18 @@ Version 1.0.0 changed a bit the api and the options methods take so please read npm install --save ipfsd-ctl ``` +Please ensure your project also has dependencies on `ipfs`, `ipfs-http-client` and `go-ipfs-dep`. + +```sh +npm install --save ipfs +npm install --save ipfs-http-client +npm install --save go-ipfs-dep +``` + +If you are only going to use the `go` implementation of IPFS, you can skip installing the `js` implementation and vice versa, though both will require the `ipfs-http-client` module. + +If you are only using the `proc` type in-process IPFS node, you can skip installing `go-ipfs-dep` and `ipfs-http-client`. + ## Usage ### Spawning a single IPFS controller: `createController` diff --git a/package.json b/package.json index 0aac51fe..3facb598 100644 --- a/package.json +++ b/package.json @@ -56,9 +56,6 @@ "debug": "^4.1.1", "execa": "^4.0.0", "fs-extra": "^8.1.0", - "go-ipfs-dep": "~0.4.22", - "ipfs": "0.40.0", - "ipfs-http-client": "^41.0.0", "ipfs-utils": "^0.7.1", "ky": "^0.16.1", "ky-universal": "^0.3.0", @@ -77,6 +74,11 @@ "husky": "^4.0.10", "lint-staged": "^10.0.2" }, + "peerDependencies": { + "go-ipfs-dep": "*", + "ipfs": "*", + "ipfs-http-client": "*" + }, "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-ipfsd-ctl.git"