Skip to content

Commit

Permalink
chore(deps): remove rimraf and mkdirp (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys authored Feb 8, 2023
1 parent d30e292 commit 587aab1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 28 deletions.
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,14 @@
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.11.3",
"mkdirp": "^1.0.4",
"mutate-fs": "^2.1.1",
"rimraf": "^3.0.2",
"tap": "^16.0.1"
},
"scripts": {
"test": "tap",
"posttest": "npm run lint",
"lint": "eslint \"**/*.js\"",
"eslint": "eslint",
"lintfix": "npm run lint -- --fix",
"npmclilint": "npmcli-lint",
"postsnap": "npm run lintfix --",
"postlint": "template-oss-check",
"template-oss-apply": "template-oss-apply --force",
"test:windows-coverage": "npm pkg set tap.statements=99 --json && npm pkg set tap.branches=98 --json && npm pkg set tap.lines=99 --json",
Expand Down
36 changes: 19 additions & 17 deletions test/00-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
// we make the sorting locale-specific, the tests will all fail, because
// it'll go ['ccc','dhc','chd'] instead of ['ccc','chd','dhc'].

var mkdirp = require('mkdirp')
var path = require('path')
var fs = require('fs')
var rimraf = require('rimraf')
var fixtures = path.resolve(__dirname, 'fixtures')
const path = require('path')
const fs = require('fs/promises')
const fixtures = path.resolve(__dirname, 'fixtures')

var chars = ['d', 'c', 'h']
var dirs = []
const chars = ['d', 'c', 'h']
const dirs = []

for (let i = 0; i < 3; i++) {
for (let j = 0; j < 3; j++) {
Expand All @@ -31,7 +29,7 @@ for (let i = 0; i < 3; i++) {
}
}

var files = []
const files = []

for (let i = 0; i < 3; i++) {
for (let j = 0; j < 3; j++) {
Expand All @@ -42,13 +40,17 @@ for (let i = 0; i < 3; i++) {
}
}

rimraf.sync(path.resolve(__dirname, 'fixtures'))
const main = async () => {
fs.rm(path.resolve(__dirname, 'fixtures'), { recursive: true, force: true })

dirs.forEach(function (dir) {
dir = path.resolve(fixtures, dir)
mkdirp.sync(dir)
files.forEach(function (file) {
file = path.resolve(dir, file)
fs.writeFileSync(file, path.basename(file))
})
})
for (let dir of dirs) {
dir = path.resolve(fixtures, dir)
await fs.mkdir(dir, { recursive: true })
for (let file of files) {
file = path.resolve(dir, file)
await fs.writeFile(file, path.basename(file))
}
}
}

main()
9 changes: 5 additions & 4 deletions test/empty-dir.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
'use strict'
const mkdirp = require('mkdirp')

const t = require('tap')
const fs = require('fs/promises')
const walk = require('..')
const Walker = walk.Walker
const WalkerSync = walk.WalkerSync
const path = require('path')
const dir = path.resolve(__dirname, 'fixtures/empty')
const rimraf = require('rimraf')
mkdirp.sync(dir)
t.teardown(_ => rimraf.sync(dir))

t.before(() => fs.mkdir(dir, { recursive: true }))
t.teardown(_ => fs.rm(dir, { recursive: true, force: true }))
process.chdir(path.resolve(__dirname, 'fixtures'))

require('./common.js').ignores({
Expand Down
9 changes: 7 additions & 2 deletions test/zz-cleanup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
const rimraf = require('rimraf')
const fs = require('fs/promises')
const path = require('path')
rimraf.sync(path.resolve(__dirname, 'fixtures'))

const main = () => {
fs.rm(path.resolve(__dirname, 'fixtures'), { recursive: true, force: true })
}

main()

0 comments on commit 587aab1

Please sign in to comment.