From 886b06dae2c09a77f92816345710a0aaa8ddc438 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 3 Apr 2020 11:06:18 +0100 Subject: [PATCH] fix: cleanup and remove deps --- .eslintignore | 1 - .npmignore | 34 ---------------------------------- CHANGELOG.md | 2 +- package.json | 27 +++++++++++++++------------ test/browser.js | 6 +----- test/dag-node-test.js | 23 ++++++++++++++++------- 6 files changed, 33 insertions(+), 60 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .npmignore diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index ca486e5..0000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -src/dag.proto.js \ No newline at end of file diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 59335fd..0000000 --- a/.npmignore +++ /dev/null @@ -1,34 +0,0 @@ -**/node_modules/ -**/*.log -test/repo-tests* - -# Logs -logs -*.log - -coverage - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -build - -# Dependency directory -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git -node_modules - -test diff --git a/CHANGELOG.md b/CHANGELOG.md index aab96ca..48fe5d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -496,7 +496,7 @@ to ### Features -* upgrade to new ipfs-block and blockservice ([1dd4dd2](https://github.com/ipld/js-ipld-dag-pb/commit/1dd4dd2)) +* upgrade to new ipld-block and blockservice ([1dd4dd2](https://github.com/ipld/js-ipld-dag-pb/commit/1dd4dd2)) diff --git a/package.json b/package.json index 7698011..d7fdec7 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,10 @@ "coverage": "aegir coverage", "coverage-publish": "aegir coverage publish" }, + "files": [ + "src", + "dist" + ], "pre-push": [ "lint-commits", "lint", @@ -66,24 +70,23 @@ "npm": ">=3.0.0" }, "dependencies": { - "cids": "~0.8.0", "buffer": "^5.5.0", + "cids": "~0.8.0", "class-is": "^1.1.0", - "multicodec": "^1.0.0", - "multihashing-async": "~0.8.0", - "protons": "^1.1.0", - "stable": "~0.1.8" + "multicodec": "^1.0.1", + "multihashing-async": "~0.8.1", + "protons": "^1.0.2" }, "devDependencies": { - "aegir": "^21.0.1", - "bs58": "^4.0.1", + "aegir": "^21.4.5", "chai": "^4.2.0", - "detect-node": "^2.0.4", "dirty-chai": "^2.0.1", "fs-extra": "^9.0.0", - "ipfs-block": "~0.8.1", - "ipfs-block-service": "~0.17.0", - "ipfs-repo": "^1.0.0", - "multihashes": "~0.4.15" + "ipfs-block-service": "~0.16.0", + "ipfs-repo": "ipfs/js-ipfs-repo#fix/remove-node-globals", + "ipfs-utils": "^1.2.1", + "ipld-block": "~0.9.1", + "multibase": "^0.7.0", + "multihashes": "~0.4.19" } } diff --git a/test/browser.js b/test/browser.js index 13f2be0..e8e8ef8 100644 --- a/test/browser.js +++ b/test/browser.js @@ -7,11 +7,7 @@ const IPFSRepo = require('ipfs-repo') const basePath = 'ipfs' + Math.random() -const idb = self.indexedDB || - self.mozIndexedDB || - self.webkitIndexedDB || - self.msIndexedDB - +const idb = self.indexedDB idb.deleteDatabase(basePath) idb.deleteDatabase(basePath + '/blocks') diff --git a/test/dag-node-test.js b/test/dag-node-test.js index 4565871..52b51d7 100644 --- a/test/dag-node-test.js +++ b/test/dag-node-test.js @@ -10,14 +10,15 @@ chai.use(dirtyChai) const dagPB = require('../src') const DAGLink = dagPB.DAGLink const DAGNode = dagPB.DAGNode -const isNode = require('detect-node') +const { isNode } = require('ipfs-utils/src/env') const multihash = require('multihashes') const multicodec = require('multicodec') const multihashing = require('multihashing-async') const BlockService = require('ipfs-block-service') -const Block = require('ipfs-block') +const Block = require('ipld-block') const CID = require('cids') +const multibase = require('multibase') const bs58 = require('bs58') const loadFixture = require('aegir/fixtures') @@ -472,11 +473,19 @@ module.exports = (repo) => { Hash: 'QmP7SrR76KHK9A916RbHG1ufy2TzNABZgiE23PjZDMzZXy', Size: 262158 } - - const link1 = new DAGLink(l1.Name, l1.Tsize, - Buffer.from(bs58.decode(l1.Hash))) - const link2 = new DAGLink(l2.Name, l2.Tsize, - Buffer.from(bs58.decode(l2.Hash))) + console.log(multibase.decode('z' + l1.Hash), bs58.decode(l1.Hash)) + const link1 = new DAGLink( + l1.Name, + l1.Tsize, + multibase.decode('z' + l1.Hash) + // Buffer.from(bs58.decode(l1.Hash)) + ) + const link2 = new DAGLink( + l2.Name, + l2.Tsize, + multibase.decode('z' + l2.Hash) + // Buffer.from(bs58.decode(l2.Hash)) + ) const node = new DAGNode(Buffer.from('hiya'), [link1, link2]) expect(node.Links).to.have.lengthOf(2)