Skip to content

Commit 5abaebc

Browse files
authored
chore: remove ipfs-utils from monorepo (ipfs#2931)
Splits the ipfs-utils code out as it's used in a lot of other projects. Creates a ipfs-core-utils module to share code between ipfs and ipfs-http-client
1 parent 82b9e08 commit 5abaebc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+87
-1194
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,15 @@ jobs:
131131
- stage: test
132132
name: examples
133133
script:
134-
- npm run build -- --scope={ipfs,ipfs-http-client}
134+
- npm run build
135135
- npm run test -- $RUN_SINCE --scope=example* --concurrency=1
136136

137137
- stage: release-rc
138138
# only run on changes to master
139139
if: branch = master AND type = push AND fork = false
140140
name: release rc
141141
script:
142+
- npm run build
142143
- echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
143144
- npm run release:rc -- --yes
144145

examples/browser-create-react-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"dot-prop": "^5.0.0",
77
"ipfs": "^0.41.0",
88
"ipfs-css": "^0.13.1",
9-
"react": "^16.8.0",
10-
"react-dom": "^16.8.0",
9+
"react": "^16.8.6",
10+
"react-dom": "^16.8.6",
1111
"react-scripts": "^3.2.0",
1212
"tachyons": "^4.11.1"
1313
},

examples/browser-parceljs/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
},
2323
"devDependencies": {
2424
"@babel/cli": "^7.1.5",
25-
"@babel/core": "^7.1.6",
26-
"@babel/preset-env": "^7.1.6",
25+
"@babel/core": "^7.2.2",
26+
"@babel/preset-env": "^7.3.1",
2727
"babel-plugin-syntax-async-functions": "^6.13.0",
2828
"babel-plugin-transform-regenerator": "^6.26.0",
2929
"babel-polyfill": "^6.26.0",
30-
"parcel-bundler": "^1.10.3",
30+
"parcel-bundler": "^1.12.4",
3131
"standard": "^13.1.0",
3232
"test-ipfs-example": "^1.0.0"
3333
}

examples/browser-webpack/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
"keywords": [],
1414
"devDependencies": {
1515
"@babel/core": "^7.2.2",
16-
"@babel/preset-env": "^7.2.3",
16+
"@babel/preset-env": "^7.3.1",
1717
"@babel/preset-react": "^7.0.0",
1818
"babel-loader": "^8.0.5",
1919
"copy-webpack-plugin": "^5.0.4",
20-
"react": "^16.7.0",
21-
"react-dom": "^16.7.0",
20+
"react": "^16.8.6",
21+
"react-dom": "^16.8.6",
2222
"react-hot-loader": "^4.8.8",
2323
"test-ipfs-example": "^1.0.0",
2424
"webpack": "^4.28.4",

examples/circuit-relaying/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"execa": "^3.2.0",
2424
"ipfs-css": "^0.13.1",
2525
"ipfs-http-client": "^42.0.0",
26-
"parcel-bundler": "^1.6.2",
26+
"parcel-bundler": "^1.12.4",
2727
"tachyons": "^4.9.1",
2828
"test-ipfs-example": "^1.0.0"
2929
},

examples/custom-libp2p/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"license": "MIT",
1212
"dependencies": {
1313
"ipfs": "^0.41.0",
14-
"libp2p": "^0.27.0-rc.0",
14+
"libp2p": "^0.27.2",
1515
"libp2p-bootstrap": "^0.10.3",
1616
"libp2p-kad-dht": "^0.18.3",
1717
"libp2p-mdns": "^0.13.1",

packages/interface-ipfs-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"dirty-chai": "^2.0.1",
3939
"ipfs-block": "^0.8.1",
4040
"ipfs-unixfs": "^1.0.0",
41-
"ipfs-utils": "^0.7.2",
41+
"ipfs-utils": "^1.0.0",
4242
"ipld-dag-cbor": "^0.15.1",
4343
"ipld-dag-pb": "^0.18.3",
4444
"is-ipfs": "^0.6.1",
File renamed without changes.
File renamed without changes.

packages/ipfs-core-utils/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# ipfs-core-utils <!-- omit in toc -->
2+
3+
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)
4+
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
5+
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
6+
[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs-utils)](https://travis-ci.com/ipfs/js-ipfs-utils)
7+
[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs-utils/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs-utils)
8+
[![Dependency Status](https://david-dm.org/ipfs/js-ipfs-utils.svg?style=flat-square)](https://david-dm.org/ipfs/js-ipfs-utils)
9+
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
10+
11+
> This package serves as a repository code shared between the core `ipfs` core implementation and the `ipfs-http-client`
12+
13+
## Lead Maintainer <!-- omit in toc -->
14+
15+
[Alex Potsides](https://github.com/achingbrain)
16+
17+
## Table of Contents <!-- omit in toc -->
18+
19+
- [Install](#install)
20+
- [Contribute](#contribute)
21+
- [License](#license)
22+
23+
## Install
24+
25+
```bash
26+
$ npm install --save ipfs-core-utils
27+
```
28+
29+
## Contribute
30+
31+
Contributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs-utils/issues).
32+
33+
Check out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
34+
35+
## License
36+
37+
[MIT](LICENSE) © Protocol Labs Inc.
Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "ipfs-utils",
3-
"version": "0.7.2",
4-
"description": "Package to aggregate shared logic and dependencies for the IPFS ecosystem",
2+
"name": "ipfs-core-utils",
3+
"version": "0.0.0",
4+
"description": "Package to share code between ipfs and ipfs-http-client",
55
"main": "src/index.js",
6-
"author": "Hugo Dias <[email protected]>",
6+
"author": "Alex Potsides <[email protected]>",
77
"homepage": "https://github.com/ipfs/js-ipfs",
88
"bugs": "https://github.com/ipfs/js-ipfs/issues",
9-
"leadMaintainer": "Hugo Dias <[email protected]>",
9+
"leadMaintainer": "Alex Potsides <[email protected]>",
1010
"files": [
1111
"src",
1212
"dist"
@@ -28,35 +28,16 @@
2828
},
2929
"license": "MIT",
3030
"dependencies": {
31-
"abort-controller": "^3.0.0",
3231
"buffer": "^5.4.2",
3332
"err-code": "^2.0.0",
34-
"fs-extra": "^8.1.0",
35-
"is-electron": "^2.2.0",
36-
"iso-url": "^0.4.7",
37-
"it-glob": "0.0.7",
38-
"merge-options": "^2.0.0",
39-
"node-fetch": "^2.6.0",
40-
"stream-to-it": "^0.2.0"
33+
"ipfs-utils": "^1.0.0"
4134
},
4235
"devDependencies": {
4336
"aegir": "21.3.0",
4437
"chai": "^4.2.0",
4538
"chai-as-promised": "^7.1.1",
4639
"delay": "^4.3.0",
4740
"dirty-chai": "^2.0.1",
48-
"it-all": "^1.0.1",
49-
"it-drain": "^1.0.0",
50-
"it-to-stream": "^0.1.1"
51-
},
52-
"contributors": [
53-
"Alan Shaw <[email protected]>",
54-
"Alex Potsides <[email protected]>",
55-
"Hugo Dias <[email protected]>",
56-
"Marcin Rataj <[email protected]>"
57-
],
58-
"browser": {
59-
"fs-extra": false,
60-
"./src/text-encoder.js": "./src/text-encoder.browser.js"
41+
"it-all": "^1.0.1"
6142
}
6243
}

packages/ipfs-utils/src/files/normalise-input.js renamed to packages/ipfs-core-utils/src/files/normalise-input.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const errCode = require('err-code')
44
const { Buffer } = require('buffer')
5-
const globalThis = require('../globalthis')
5+
const globalThis = require('ipfs-utils/src/globalthis')
66

77
/*
88
* Transform one of:

packages/ipfs-core-utils/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
'use strict'

packages/ipfs-utils/test/files/format-mode.spec.js renamed to packages/ipfs-core-utils/test/files/format-mode.spec.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
'use strict'
22

33
/* eslint-env mocha */
4-
const chai = require('chai')
5-
const dirtyChai = require('dirty-chai')
6-
const formatMode = require('../../src/files/format-mode')
74

8-
chai.use(dirtyChai)
9-
const expect = chai.expect
5+
const { expect } = require('../utils/chai')
6+
const formatMode = require('../../src/files/format-mode')
107

118
describe('format-mode', function () {
129
it('formats mode for directories', function () {

packages/ipfs-utils/test/files/format-mtime.spec.js renamed to packages/ipfs-core-utils/test/files/format-mtime.spec.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
'use strict'
22

33
/* eslint-env mocha */
4-
const chai = require('chai')
5-
const dirtyChai = require('dirty-chai')
6-
const formatMtime = require('../../src/files/format-mtime')
74

8-
chai.use(dirtyChai)
9-
const expect = chai.expect
5+
const { expect } = require('../utils/chai')
6+
const formatMtime = require('../../src/files/format-mtime')
107

118
describe('format-mtime', function () {
129
it('formats mtime', function () {

packages/ipfs-utils/test/files/normalise-input.spec.js renamed to packages/ipfs-core-utils/test/files/normalise-input.spec.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
'use strict'
22

33
/* eslint-env mocha */
4-
const chai = require('chai')
5-
const dirtyChai = require('dirty-chai')
4+
const { expect } = require('../utils/chai')
65
const normalise = require('../../src/files/normalise-input')
7-
const { supportsFileReader } = require('../../src/supports')
6+
const { supportsFileReader } = require('ipfs-utils/src/supports')
87
const { Buffer } = require('buffer')
98
const all = require('it-all')
10-
const globalThis = require('../../src/globalthis')
11-
12-
chai.use(dirtyChai)
13-
const expect = chai.expect
9+
const globalThis = require('ipfs-utils/src/globalthis')
1410

1511
const STRING = () => 'hello world'
1612
const BUFFER = () => Buffer.from(STRING())
@@ -34,11 +30,7 @@ if (supportsFileReader) {
3430

3531
async function verifyNormalisation (input) {
3632
expect(input.length).to.equal(1)
37-
38-
if (!input[0].content[Symbol.asyncIterator] && !input[0].content[Symbol.iterator]) {
39-
chai.assert.fail('Content should have been an iterable or an async iterable')
40-
}
41-
33+
expect(input[0].content[Symbol.asyncIterator] || input[0].content[Symbol.iterator]).to.be.ok('Content should have been an iterable or an async iterable')
4234
expect(await all(input[0].content)).to.deep.equal([BUFFER()])
4335
expect(input[0].path).to.equal('')
4436
}

packages/ipfs-http-client/examples/upload-file-via-browser/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"ipfs-http-client": "../.."
1515
},
1616
"devDependencies": {
17-
"react": "^16.6.3",
18-
"react-dom": "^16.6.3",
17+
"react": "^16.8.6",
18+
"react-dom": "^16.8.6",
1919
"parcel-bundler": "^1.12.4"
2020
},
2121
"browserslist": [

packages/ipfs-http-client/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@
4646
"debug": "^4.1.0",
4747
"form-data": "^3.0.0",
4848
"ipfs-block": "^0.8.1",
49-
"ipfs-utils": "^0.7.2",
49+
"ipfs-core-utils": "~0.0.0",
50+
"ipfs-utils": "^1.0.0",
5051
"ipld-dag-cbor": "^0.15.1",
5152
"ipld-dag-pb": "^0.18.3",
5253
"ipld-raw": "^4.0.1",
53-
"iso-url": "^0.4.6",
54+
"iso-url": "^0.4.7",
5455
"it-tar": "^1.2.1",
5556
"it-to-buffer": "^1.0.0",
5657
"it-to-stream": "^0.1.1",

packages/ipfs-http-client/src/lib/multipart-request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
const normaliseInput = require('ipfs-utils/src/files/normalise-input')
3+
const normaliseInput = require('ipfs-core-utils/src/files/normalise-input')
44
const toStream = require('./to-stream')
55
const nanoid = require('nanoid')
66
const modeToString = require('../lib/mode-to-string')

packages/ipfs-utils/README.md

Lines changed: 0 additions & 65 deletions
This file was deleted.

packages/ipfs-utils/src/env.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)