From 16e5044bf8d8026febe08a57f496abc87e0deb5f Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Sat, 6 Jun 2020 20:03:12 +0300 Subject: [PATCH] chore(deps): remove fs-extra --- packages/headless/package.json | 1 - packages/headless/test/index.ts | 36 ++++++++++++++++----------------- packages/supi/package.json | 1 - pnpm-lock.yaml | 15 -------------- 4 files changed, 18 insertions(+), 35 deletions(-) diff --git a/packages/headless/package.json b/packages/headless/package.json index e76dd5b289..4b31448766 100644 --- a/packages/headless/package.json +++ b/packages/headless/package.json @@ -31,7 +31,6 @@ "@types/sinon": "^9.0.4", "@types/tape-promise": "^4.0.1", "@zkochan/rimraf": "1.0.0", - "fs-extra": "9.0.0", "is-windows": "1.0.2", "isexe": "2.0.0", "load-json-file": "6.2.0", diff --git a/packages/headless/test/index.ts b/packages/headless/test/index.ts index f4bc7e99f4..7f7e8db4ac 100644 --- a/packages/headless/test/index.ts +++ b/packages/headless/test/index.ts @@ -14,8 +14,8 @@ import { fromDir as readPackageJsonFromDir } from '@pnpm/read-package-json' import readprojectsContext from '@pnpm/read-projects-context' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import rimraf = require('@zkochan/rimraf') -import fse = require('fs-extra') import loadJsonFile = require('load-json-file') +import fs = require('mz/fs') import path = require('path') import exists = require('path-exists') import readYamlFile from 'read-yaml-file' @@ -287,15 +287,15 @@ test('orphan packages are removed', async (t) => { const simpleWithMoreDepsDir = path.join(fixtures, 'simple-with-more-deps') const simpleDir = path.join(fixtures, 'simple') - fse.copySync(path.join(simpleWithMoreDepsDir, 'package.json'), destPackageJsonPath) - fse.copySync(path.join(simpleWithMoreDepsDir, WANTED_LOCKFILE), destLockfileYamlPath) + await fs.copyFile(path.join(simpleWithMoreDepsDir, 'package.json'), destPackageJsonPath) + await fs.copyFile(path.join(simpleWithMoreDepsDir, WANTED_LOCKFILE), destLockfileYamlPath) await headless(await testDefaults({ lockfileDir: projectDir, })) - fse.copySync(path.join(simpleDir, 'package.json'), destPackageJsonPath) - fse.copySync(path.join(simpleDir, WANTED_LOCKFILE), destLockfileYamlPath) + await fs.copyFile(path.join(simpleDir, 'package.json'), destPackageJsonPath) + await fs.copyFile(path.join(simpleDir, WANTED_LOCKFILE), destLockfileYamlPath) const reporter = sinon.spy() await headless(await testDefaults({ @@ -328,13 +328,13 @@ test('available packages are used when node_modules is not clean', async (t) => const hasGlobDir = path.join(fixtures, 'has-glob') const hasGlobAndRimrafDir = path.join(fixtures, 'has-glob-and-rimraf') - fse.copySync(path.join(hasGlobDir, 'package.json'), destPackageJsonPath) - fse.copySync(path.join(hasGlobDir, WANTED_LOCKFILE), destLockfileYamlPath) + await fs.copyFile(path.join(hasGlobDir, 'package.json'), destPackageJsonPath) + await fs.copyFile(path.join(hasGlobDir, WANTED_LOCKFILE), destLockfileYamlPath) await headless(await testDefaults({ lockfileDir: projectDir })) - fse.copySync(path.join(hasGlobAndRimrafDir, 'package.json'), destPackageJsonPath) - fse.copySync(path.join(hasGlobAndRimrafDir, WANTED_LOCKFILE), destLockfileYamlPath) + await fs.copyFile(path.join(hasGlobAndRimrafDir, 'package.json'), destPackageJsonPath) + await fs.copyFile(path.join(hasGlobAndRimrafDir, WANTED_LOCKFILE), destLockfileYamlPath) const reporter = sinon.spy() await headless(await testDefaults({ lockfileDir: projectDir, reporter })) @@ -368,13 +368,13 @@ test('available packages are relinked during forced install', async (t) => { const hasGlobDir = path.join(fixtures, 'has-glob') const hasGlobAndRimrafDir = path.join(fixtures, 'has-glob-and-rimraf') - fse.copySync(path.join(hasGlobDir, 'package.json'), destPackageJsonPath) - fse.copySync(path.join(hasGlobDir, WANTED_LOCKFILE), destLockfileYamlPath) + await fs.copyFile(path.join(hasGlobDir, 'package.json'), destPackageJsonPath) + await fs.copyFile(path.join(hasGlobDir, WANTED_LOCKFILE), destLockfileYamlPath) await headless(await testDefaults({ lockfileDir: projectDir })) - fse.copySync(path.join(hasGlobAndRimrafDir, 'package.json'), destPackageJsonPath) - fse.copySync(path.join(hasGlobAndRimrafDir, WANTED_LOCKFILE), destLockfileYamlPath) + await fs.copyFile(path.join(hasGlobAndRimrafDir, 'package.json'), destPackageJsonPath) + await fs.copyFile(path.join(hasGlobAndRimrafDir, WANTED_LOCKFILE), destLockfileYamlPath) const reporter = sinon.spy() await headless(await testDefaults({ lockfileDir: projectDir, reporter, force: true })) @@ -404,10 +404,10 @@ test(`fail when ${WANTED_LOCKFILE} is not up-to-date with package.json`, async ( t.comment(projectDir) const simpleDir = path.join(fixtures, 'simple') - fse.copySync(path.join(simpleDir, 'package.json'), path.join(projectDir, 'package.json')) + await fs.copyFile(path.join(simpleDir, 'package.json'), path.join(projectDir, 'package.json')) const simpleWithMoreDepsDir = path.join(fixtures, 'simple-with-more-deps') - fse.copySync(path.join(simpleWithMoreDepsDir, WANTED_LOCKFILE), path.join(projectDir, WANTED_LOCKFILE)) + await fs.copyFile(path.join(simpleWithMoreDepsDir, WANTED_LOCKFILE), path.join(projectDir, WANTED_LOCKFILE)) try { await headless(await testDefaults({ lockfileDir: projectDir })) @@ -448,8 +448,8 @@ test('installing using passed in lockfile files', async (t) => { t.comment(prefix) const simplePkgPath = path.join(fixtures, 'simple') - fse.copySync(path.join(simplePkgPath, 'package.json'), path.join(prefix, 'package.json')) - fse.copySync(path.join(simplePkgPath, WANTED_LOCKFILE), path.join(prefix, WANTED_LOCKFILE)) + await fs.copyFile(path.join(simplePkgPath, 'package.json'), path.join(prefix, 'package.json')) + await fs.copyFile(path.join(simplePkgPath, WANTED_LOCKFILE), path.join(prefix, WANTED_LOCKFILE)) const wantedLockfile = await readWantedLockfile(simplePkgPath, { ignoreIncompatible: false }) @@ -667,7 +667,7 @@ test.skip('using side effects cache and hoistPattern=*', async (t) => { await project.has('.pnpm/node_modules/es6-promise') // verifying that a flat node_modules was created const cacheBuildDir = path.join(opts.storeDir, `localhost+${REGISTRY_MOCK_PORT}/diskusage@1.1.3/side_effects/${ENGINE_DIR}/package/build`) - fse.writeFileSync(path.join(cacheBuildDir, 'new-file.txt'), 'some new content') + fs.writeFileSync(path.join(cacheBuildDir, 'new-file.txt'), 'some new content') await rimraf(path.join(lockfileDir, 'node_modules')) await headless(opts) diff --git a/packages/supi/package.json b/packages/supi/package.json index 9953a05f1c..4e373d73ee 100644 --- a/packages/supi/package.json +++ b/packages/supi/package.json @@ -98,7 +98,6 @@ "dir-is-case-sensitive": "1.0.2", "execa": "^4.0.2", "exists-link": "2.0.0", - "fs-extra": "9.0.0", "is-ci": "2.0.0", "is-windows": "1.0.2", "ncp": "2.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b75d65f132..8ec9c3c226 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -636,7 +636,6 @@ importers: '@types/sinon': 9.0.4 '@types/tape-promise': 4.0.1 '@zkochan/rimraf': 1.0.0 - fs-extra: 9.0.0 is-windows: 1.0.2 isexe: 2.0.0 load-json-file: 6.2.0 @@ -684,7 +683,6 @@ importers: '@types/tape-promise': ^4.0.1 '@zkochan/rimraf': 1.0.0 dependency-path: 'workspace:4.0.7' - fs-extra: 9.0.0 is-windows: 1.0.2 isexe: 2.0.0 load-json-file: 6.2.0 @@ -2637,7 +2635,6 @@ importers: dir-is-case-sensitive: 1.0.2 execa: 4.0.2 exists-link: 2.0.0 - fs-extra: 9.0.0 is-ci: 2.0.0 is-windows: 1.0.2 ncp: 2.0.0 @@ -2716,7 +2713,6 @@ importers: encode-registry: 2.0.2 execa: ^4.0.2 exists-link: 2.0.0 - fs-extra: 9.0.0 get-npm-tarball-url: 2.0.1 graceful-fs: 4.2.1 graph-sequencer: 2.0.0 @@ -6709,17 +6705,6 @@ packages: node: '>=6 <7 || >=8' resolution: integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== - /fs-extra/9.0.0: - dependencies: - at-least-node: 1.0.0 - graceful-fs: 4.2.4 - jsonfile: 6.0.1 - universalify: 1.0.0 - dev: true - engines: - node: '>=10' - resolution: - integrity: sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g== /fs-extra/9.0.1: dependencies: at-least-node: 1.0.0