From 4a7382f5e6c72c59587d45167346c1b6e81a3cde Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Thu, 3 Nov 2022 14:08:45 -0700 Subject: [PATCH] fix: replace @npmcli/move-file with @npmcli/fs --- lib/entry-index.js | 2 +- lib/util/move-file.js | 2 +- package.json | 3 +-- test/entry-index.js | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/entry-index.js b/lib/entry-index.js index e81ef52..add15e3 100644 --- a/lib/entry-index.js +++ b/lib/entry-index.js @@ -17,7 +17,7 @@ const uniqueFilename = require('unique-filename') const contentPath = require('./content/path') const hashToSegments = require('./util/hash-to-segments') const indexV = require('../package.json')['cache-version'].index -const moveFile = require('@npmcli/move-file') +const { moveFile } = require('@npmcli/fs') module.exports.NotFoundError = class NotFoundError extends Error { constructor (cache, key) { diff --git a/lib/util/move-file.js b/lib/util/move-file.js index 2d4de41..eb3ba76 100644 --- a/lib/util/move-file.js +++ b/lib/util/move-file.js @@ -1,7 +1,7 @@ 'use strict' const fs = require('fs/promises') -const move = require('@npmcli/move-file') +const { moveFile: move } = require('@npmcli/fs') const pinflight = require('promise-inflight') module.exports = moveFile diff --git a/package.json b/package.json index 3bc0289..b6f8a72 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,7 @@ ], "license": "ISC", "dependencies": { - "@npmcli/fs": "^3.0.0", - "@npmcli/move-file": "^3.0.0", + "@npmcli/fs": "^3.1.0", "fs-minipass": "^2.1.0", "glob": "^8.0.1", "lru-cache": "^7.7.1", diff --git a/test/entry-index.js b/test/entry-index.js index 24382a4..744b2ea 100644 --- a/test/entry-index.js +++ b/test/entry-index.js @@ -141,7 +141,7 @@ t.test('compact: error in moveFile removes temp', async (t) => { ]) const { compact } = getEntryIndex(t, { - '@npmcli/move-file': () => Promise.reject(new Error('foo')), + '@npmcli/fs': { moveFile: () => Promise.reject(new Error('foo')) }, }) const filter = (entryA, entryB) => entryA.metadata.rev === entryB.metadata.rev await t.rejects(compact(cache, KEY, filter), { message: 'foo' }, 'promise rejected')