Skip to content

Commit 7cf404c

Browse files
authored
fix: move wrtc to optional deps (ipfs#3705)
npm7 has started installing peer deps by default, which means if you are running a future tech node.js version you may end up compiling native addons that may fail. These addons should be opt-in so move them to optional deps which means if they fail to install, the whole installation does not fail. Also adds `@mapbox/node-pre-gyp` as a dependency so we can attempt to compile modules that have native addons where no prebuilt binary is available instead of requiring users to install it globally which is required due to a misconfiguration in the `webrtc` module.
1 parent 0266abf commit 7cf404c

File tree

5 files changed

+5
-12
lines changed

5 files changed

+5
-12
lines changed

.github/workflows/bundlesize.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-README.md
1111
strategy:
1212
matrix:
13-
node-version: [15.x]
13+
node-version: [14.x]
1414
project:
1515
- packages/ipfs
1616
- packages/ipfs-core
@@ -25,7 +25,7 @@ jobs:
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
- uses: actions/checkout@v2
28-
- run: npm install -g @mapbox/node-pre-gyp && npm install
28+
- run: npm install
2929
- name: Bundlesize ${{ matrix.project }}
3030
uses: ipfs/aegir/actions/[email protected]
3131
continue-on-error: true

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ before_install:
6666
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then export PATH=/c/PROGRA~1/Git/usr/bin:/c/PROGRA~1/Git/mingw64/libexec/git-core:$PATH ; fi
6767
# only run jobs in packages that have changed since master in PR builds
6868
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export RUN_SINCE='--since master' ; fi
69-
# modules with pre-built binaries may not have deployed versions for bleeding-edge node so this lets us fall back to building from source
70-
- npm install -g @mapbox/node-pre-gyp
7169

7270
script:
7371
- npm run test:node -- $RUN_SINCE -- -- --timeout 10000 --bail -- --exit # TODO remove --exit https://mochajs.org/#-exit

Dockerfile.latest

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ ENV BUILD_DEPS='libnspr4 libnspr4-dev libnss3'
88
RUN apk add --no-cache git python3 build-base
99

1010
# Hopefully remove when https://github.com/node-webrtc/node-webrtc/pull/694 is merged
11-
RUN npm install -g @mapbox/node-pre-gyp
1211
RUN npm install -g ipfs@"$IPFS_VERSION"
1312

1413
# Make the image a bit smaller
15-
RUN npm uninstall -g @mapbox/node-pre-gyp
1614
RUN npm cache clear --force
1715
RUN apk del build-base python3 git
1816

Dockerfile.next

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ ENV BUILD_DEPS='libnspr4 libnspr4-dev libnss3'
88
RUN apk add --no-cache git python3 build-base
99

1010
# Hopefully remove when https://github.com/node-webrtc/node-webrtc/pull/694 is merged
11-
RUN npm install -g @mapbox/node-pre-gyp
1211
RUN npm install -g ipfs@"$IPFS_VERSION"
1312

1413
# Make the image a bit smaller
15-
RUN npm uninstall -g @mapbox/node-pre-gyp
1614
RUN npm cache clear --force
1715
RUN apk del build-base python3 git
1816

packages/ipfs-daemon/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
"test:node": "aegir test -t node",
2727
"coverage": "nyc --reporter=text --reporter=lcov npm run test:node",
2828
"clean": "rimraf ./dist",
29-
"dep-check": "aegir dep-check -i ipfs-core-types",
29+
"dep-check": "aegir dep-check -i ipfs-core-types -i @mapbox/node-pre-gyp",
3030
"build": "aegir build --no-bundle"
3131
},
3232
"dependencies": {
33+
"@mapbox/node-pre-gyp": "^1.0.5",
3334
"debug": "^4.1.1",
3435
"dlv": "^1.1.3",
3536
"ipfs-core": "^0.7.0",
@@ -53,9 +54,7 @@
5354
},
5455
"optionalDependencies": {
5556
"prom-client": "^12.0.0",
56-
"prometheus-gc-stats": "^0.6.0"
57-
},
58-
"peerDependencies": {
57+
"prometheus-gc-stats": "^0.6.0",
5958
"electron-webrtc": "^0.3.0",
6059
"wrtc": "^0.4.6"
6160
}

0 commit comments

Comments
 (0)