Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 99ff80c

Browse files
committed
feat: migrate init to IPLD resolver
1 parent e11d86b commit 99ff80c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/core/components/init.js

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

33
const peerId = require('peer-id')
4-
const BlockService = require('ipfs-block-service')
5-
const DagService = require('ipfs-merkle-dag').DAGService
64
const path = require('path')
75
const glob = require('glob')
86
const fs = require('fs')
@@ -90,9 +88,6 @@ module.exports = function init (self) {
9088
return callback(null, true)
9189
}
9290

93-
const blocks = new BlockService(self._repo)
94-
const dag = new DagService(blocks)
95-
9691
const initDocsPath = path.join(__dirname, '../../init-files/init-docs')
9792
const index = __dirname.lastIndexOf('/')
9893

@@ -112,7 +107,7 @@ module.exports = function init (self) {
112107
}
113108
}),
114109
pull.filter(Boolean),
115-
importer(dag),
110+
importer(self._ipldResolver),
116111
pull.through((el) => {
117112
if (el.path === 'files/init-docs/docs') {
118113
const hash = mh.toB58String(el.multihash)
@@ -123,7 +118,9 @@ module.exports = function init (self) {
123118
}
124119
}),
125120
pull.onEnd((err) => {
126-
if (err) return callback(err)
121+
if (err) {
122+
return callback(err)
123+
}
127124

128125
callback(null, true)
129126
})

0 commit comments

Comments
 (0)