Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 616d909

Browse files
committed
refactor: use fs-extra instead of ncp and rimraf
fs-extra has promised based APIs, hence use it instead of promisifying ncp and rimraf.
1 parent 4803679 commit 616d909

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@
3434
"chai": "^4.2.0",
3535
"cids": "~0.5.7",
3636
"dirty-chai": "^2.0.1",
37+
"fs-extra": "^8.0.1",
3738
"ipfs-block": "~0.8.0",
3839
"ipfs-repo": "~0.27.0",
3940
"lodash": "^4.17.11",
40-
"multihashing-async": "~0.7.0",
41-
"ncp": "^2.0.0",
42-
"promisify-es6": "^1.0.3",
43-
"rimraf": "^2.6.3"
41+
"multihashing-async": "~0.7.0"
4442
},
4543
"engines": {
4644
"node": ">=6.0.0",

test/node.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/* eslint-env mocha */
22
'use strict'
33

4-
var promisify = require('promisify-es6')
5-
const ncp = require('ncp').ncp
6-
const rimraf = require('rimraf')
4+
const fs = require('fs-extra')
75
const path = require('path')
86
const IPFSRepo = require('ipfs-repo')
97

@@ -16,13 +14,13 @@ describe('IPFS Block Tests on Node.js', () => {
1614
const repo = new IPFSRepo(repoPath)
1715

1816
before(async () => {
19-
await promisify(ncp)(testRepoPath, repoPath)
17+
await fs.copy(testRepoPath, repoPath)
2018
await repo.open()
2119
})
2220

2321
after(async () => {
2422
await repo.close()
25-
await promisify(rimraf)(repoPath)
23+
await fs.remove(repoPath)
2624
})
2725

2826
tests(repo)

0 commit comments

Comments
 (0)