Skip to content

Commit 954d75d

Browse files
committed
chore: use npm 7 workspaces instead of lerna bootstrap
It's faster - running `time npm i` shows a nice speed up: lerna ``` npm timing command:install Completed in 183859ms npm timing npm Completed in 184077ms npm info ok real 3m4.246s user 2m48.066s sys 0m58.948s ``` npm7 + workspaces ``` npm timing command:install Completed in 101724ms npm timing npm Completed in 101914ms npm info ok real 1m42.075s user 1m52.422s sys 0m46.022s ``` The downside is it requires npm7 - it's bundled with node 15 but will require users up upgrade if they are using node 14 or below. chore: deps
1 parent e57ba16 commit 954d75d

File tree

6 files changed

+59
-37
lines changed

6 files changed

+59
-37
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ yarn.lock
55
test/repo-tests*
66
**/bundle.js
77
package-lock.json
8+
tsconfig-types.aegir.json
89

910
# Logs
1011
logs

.travis.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,28 @@ stages:
1616
- release
1717

1818
node_js:
19-
- 'node'
2019
- 'lts/*'
20+
- 'node'
2121

2222
os:
2323
- linux
2424
- osx
2525
- windows
2626

2727
before_install:
28+
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then npm config set loglevel verbose ; fi
2829
# prevents windows error: npm ERR! ... git-sh-setup: file not found
29-
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then export PATH=/c/PROGRA~1/Git/usr/bin:/c/PROGRA~1/Git/mingw64/libexec/git-core:$PATH ; fi
30+
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then export PATH=/c/PROGRA~1/Git/usr/bin:/c/PROGRA~1/Git/mingw64/libexec/git-core:$PATH ; fi
31+
# upgrading npm on travis/windows/node 14 is completely broken
32+
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then export NODE_INSTALL_DIR=`npm prefix -g` ; fi
33+
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then mkdir $NODE_INSTALL_DIR/node_modules ; fi
34+
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then mv $NODE_INSTALL_DIR/node_modules $NODE_INSTALL_DIR/node_modules_old ; fi
35+
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then rm -f $NODE_INSTALL_DIR/npm $NODE_INSTALL_DIR/npm.cmd $NODE_INSTALL_DIR/npm.ps1 $NODE_INSTALL_DIR/npx $NODE_INSTALL_DIR/npx.cmd $NODE_INSTALL_DIR/npx.ps1 ; fi
36+
# workspaces require npm 7 or above
37+
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then node $NODE_INSTALL_DIR/node_modules_old/npm/bin/npm-cli.js i -g npm@latest ; fi
38+
- if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then npm install -g npm@latest ; fi
39+
# allow windows to run scripts with node 14 and npm 7 (may not be necessary when node 14 is no longer lts)
40+
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then npm config set script-shell c:/PROGRA~1/Git/bin/bash.exe ; fi
3041

3142
script: npx nyc -s npm run test -- -- -- -t node --bail
3243
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov
@@ -36,6 +47,7 @@ jobs:
3647
- stage: check
3748
name: linting
3849
script:
50+
- npm --version
3951
- npm run lint
4052

4153
- stage: check

package.json

+9-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
"version": "1.0.0",
44
"description": "JS implementation of the IPFS UnixFS",
55
"scripts": {
6-
"postinstall": "lerna bootstrap",
7-
"reset": "lerna run clean && rm -rf packages/*/node_modules node_modules",
6+
"reset": "lerna run clean && rimraf packages/*/node_modules node_modules",
87
"test": "lerna run test",
98
"coverage": "lerna run coverage",
109
"prepare": "lerna run prepare",
@@ -17,6 +16,7 @@
1716
"update-contributors": "aegir release --lint=false --test=false --bump=false --build=false --changelog=false --commit=false --tag=false --push=false --ghrelease=false --docs=false --publish=false"
1817
},
1918
"devDependencies": {
19+
"aegir": "^30.3.0",
2020
"lerna": "^3.22.1"
2121
},
2222
"repository": {
@@ -47,5 +47,11 @@
4747
"Diogo Silva <fsdiogo@gmail.com>",
4848
"jbenet <juan@benet.ai>",
4949
"Bernard Mordan <bernard@tableflip.io>"
50-
]
50+
],
51+
"workspaces": [
52+
"packages/*"
53+
],
54+
"engines": {
55+
"npm": ">=7.0.0"
56+
}
5157
}

packages/ipfs-unixfs-exporter/package.json

+12-11
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
"scripts": {
1111
"prepare": "aegir build --no-bundle",
1212
"test": "aegir test",
13-
"clean": "rm -rf ./dist",
13+
"clean": "rimraf ./dist",
1414
"lint": "aegir lint",
1515
"coverage": "nyc -s npm run test -t node && nyc report --reporter=html",
16-
"depcheck": "aegir dep-check -i @types/mocha -i @types/sinon -i nyc -i abort-controller"
16+
"depcheck": "aegir dep-check -i @types/mocha -i @types/sinon -i nyc -i abort-controller -i rimraf"
1717
},
1818
"repository": {
1919
"type": "git",
@@ -32,7 +32,7 @@
3232
},
3333
"homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme",
3434
"devDependencies": {
35-
"@types/mocha": "^8.2.0",
35+
"@types/mocha": "^8.2.1",
3636
"@types/sinon": "^9.0.10",
3737
"abort-controller": "^3.0.0",
3838
"aegir": "^30.3.0",
@@ -41,23 +41,24 @@
4141
"ipld": "^0.28.0",
4242
"ipld-dag-pb": "^0.21.0",
4343
"ipld-in-memory": "^7.0.0",
44-
"it-all": "^1.0.1",
44+
"it-all": "^1.0.5",
4545
"it-buffer-stream": "^2.0.0",
46-
"it-first": "^1.0.1",
46+
"it-first": "^1.0.6",
4747
"merge-options": "^3.0.4",
48-
"multicodec": "^2.0.0",
48+
"multicodec": "^2.1.0",
4949
"native-abort-controller": "^1.0.3",
5050
"nyc": "^15.0.0",
51-
"sinon": "^9.0.10",
52-
"uint8arrays": "^2.0.5"
51+
"rimraf": "^3.0.2",
52+
"sinon": "^9.2.4",
53+
"uint8arrays": "^2.1.2"
5354
},
5455
"dependencies": {
5556
"cids": "^1.1.5",
56-
"err-code": "^3.0.0",
57+
"err-code": "^3.0.1",
5758
"hamt-sharding": "^2.0.0",
5859
"ipfs-unixfs": "^3.0.0",
59-
"it-last": "^1.0.1",
60-
"multihashing-async": "^2.0.0"
60+
"it-last": "^1.0.5",
61+
"multihashing-async": "^2.1.0"
6162
},
6263
"types": "dist/src/index.d.ts",
6364
"files": [

packages/ipfs-unixfs-importer/package.json

+16-15
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
"scripts": {
1111
"prepare": "aegir build --no-bundle",
1212
"test": "aegir test",
13-
"clean": "rm -rf ./dist",
13+
"clean": "rimraf ./dist",
1414
"lint": "aegir lint",
1515
"coverage": "nyc -s npm run test -t node && nyc report --reporter=html",
16-
"depcheck": "aegir dep-check -i @types/mocha -i nyc"
16+
"depcheck": "aegir dep-check -i @types/mocha -i nyc -i rimraf"
1717
},
1818
"repository": {
1919
"type": "git",
@@ -32,29 +32,30 @@
3232
},
3333
"homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme",
3434
"devDependencies": {
35-
"@types/mocha": "^8.2.0",
35+
"@types/mocha": "^8.2.1",
3636
"aegir": "^30.3.0",
3737
"ipld": "^0.28.0",
3838
"ipld-in-memory": "^7.0.0",
3939
"it-buffer-stream": "^2.0.0",
40-
"multicodec": "^2.0.0",
41-
"nyc": "^15.0.0"
40+
"multicodec": "^2.1.0",
41+
"nyc": "^15.0.0",
42+
"rimraf": "^3.0.2"
4243
},
4344
"dependencies": {
44-
"bl": "^4.0.0",
45+
"bl": "^4.1.0",
4546
"cids": "^1.1.5",
46-
"err-code": "^3.0.0",
47+
"err-code": "^3.0.1",
4748
"hamt-sharding": "^2.0.0",
4849
"ipfs-unixfs": "^3.0.0",
4950
"ipld-dag-pb": "^0.21.0",
50-
"it-all": "^1.0.1",
51-
"it-batch": "^1.0.3",
52-
"it-first": "^1.0.1",
53-
"it-parallel-batch": "^1.0.3",
54-
"merge-options": "^3.0.3",
55-
"multihashing-async": "^2.0.0",
56-
"rabin-wasm": "^0.1.1",
57-
"uint8arrays": "^2.0.5"
51+
"it-all": "^1.0.5",
52+
"it-batch": "^1.0.8",
53+
"it-first": "^1.0.6",
54+
"it-parallel-batch": "^1.0.9",
55+
"merge-options": "^3.0.4",
56+
"multihashing-async": "^2.1.0",
57+
"rabin-wasm": "^0.1.4",
58+
"uint8arrays": "^2.1.2"
5859
},
5960
"types": "dist/src/index.d.ts",
6061
"files": [

packages/ipfs-unixfs/package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"prepare:proto": "pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/unixfs.js ./src/unixfs.proto",
1313
"prepare:proto:types": "pbts -o src/unixfs.d.ts src/unixfs.js",
1414
"prepare:types": "aegir build --no-bundle",
15-
"prepare:copy": "cp ./src/*.d.ts ./dist/src",
15+
"prepare:copy": "copy ./src/*.d.ts ./dist/src",
1616
"test": "aegir test",
17-
"clean": "rm -rf ./dist",
17+
"clean": "rimraf ./dist",
1818
"lint": "aegir lint",
1919
"coverage": "nyc -s aegir test -t node && nyc report --reporter=html",
20-
"depcheck": "aegir dep-check -i mkdirp -i protobufjs -i @types/mocha -i nyc -i npm-run-all"
20+
"depcheck": "aegir dep-check -i mkdirp -i @types/mocha -i nyc -i npm-run-all -copy"
2121
},
2222
"repository": {
2323
"type": "git",
@@ -36,15 +36,16 @@
3636
},
3737
"homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme",
3838
"devDependencies": {
39-
"@types/mocha": "^8.2.0",
39+
"@types/mocha": "^8.2.1",
4040
"aegir": "^30.3.0",
41+
"copy": "^0.3.2",
4142
"mkdirp": "^1.0.4",
4243
"npm-run-all": "^4.1.5",
4344
"nyc": "^15.0.0",
44-
"uint8arrays": "^2.0.5"
45+
"uint8arrays": "^2.1.2"
4546
},
4647
"dependencies": {
47-
"err-code": "^3.0.0",
48+
"err-code": "^3.0.1",
4849
"protobufjs": "^6.10.2"
4950
},
5051
"types": "dist/src/index.d.ts",

0 commit comments

Comments
 (0)