From 3a200dbc7952fcbc30fe9a4bbc97577e0b5fa12a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Wed, 17 Jul 2024 04:05:51 +0800 Subject: [PATCH] refactor: upgrade fs-extra --- package.json | 4 +-- pnpm-lock.yaml | 86 +++++++++++++++++++++++++++------------------- test/index.test.ts | 2 +- vitest-global.ts | 4 +-- 4 files changed, 56 insertions(+), 40 deletions(-) diff --git a/package.json b/package.json index c766b5212..214855f77 100644 --- a/package.json +++ b/package.json @@ -50,13 +50,13 @@ "@swc/core": "1.2.218", "@types/debug": "4.1.7", "@types/flat": "5.0.2", - "@types/fs-extra": "9.0.13", + "@types/fs-extra": "11.0.4", "@types/node": "14.18.12", "@types/resolve": "1.20.1", "colorette": "2.0.16", "consola": "2.15.3", "flat": "5.0.2", - "fs-extra": "10.0.0", + "fs-extra": "11.2.0", "postcss": "8.4.12", "postcss-simple-vars": "6.0.3", "prettier": "3.3.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab410b0dd..86c51f267 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -67,8 +67,8 @@ importers: specifier: 5.0.2 version: 5.0.2 '@types/fs-extra': - specifier: 9.0.13 - version: 9.0.13 + specifier: 11.0.4 + version: 11.0.4 '@types/node': specifier: 14.18.12 version: 14.18.12 @@ -85,8 +85,8 @@ importers: specifier: 5.0.2 version: 5.0.2 fs-extra: - specifier: 10.0.0 - version: 10.0.0 + specifier: 11.2.0 + version: 11.2.0 postcss: specifier: 8.4.12 version: 8.4.12 @@ -113,7 +113,7 @@ importers: version: 3.46.4 svelte-preprocess: specifier: 5.0.3 - version: 5.0.3(postcss-load-config@4.0.1)(postcss@8.4.12)(sass@1.62.1)(svelte@3.46.4)(typescript@5.0.2) + version: 5.0.3(postcss-load-config@4.0.1(postcss@8.4.12))(postcss@8.4.12)(sass@1.62.1)(svelte@3.46.4)(typescript@5.0.2) terser: specifier: ^5.16.0 version: 5.16.0 @@ -704,28 +704,24 @@ packages: engines: {node: '>=10'} cpu: [arm64] os: [linux] - libc: [glibc] '@swc/core-linux-arm64-musl@1.2.218': resolution: {integrity: sha512-IETYHB6H01NmVmlw+Ng8nkjdFBv1exGQRR74GAnHis1bVx1Uq14hREIF6XT3I1Aj26nRwlGkIYQuEKnFO5/j3Q==} engines: {node: '>=10'} cpu: [arm64] os: [linux] - libc: [musl] '@swc/core-linux-x64-gnu@1.2.218': resolution: {integrity: sha512-PK39Zg4/YZbfchQRw77iVfB7Qat7QaK58sQt8enH39CUMXlJ+GSfC0Fqw2mtZ12sFGwmsGrK9yBy3ZVoOws5Ng==} engines: {node: '>=10'} cpu: [x64] os: [linux] - libc: [glibc] '@swc/core-linux-x64-musl@1.2.218': resolution: {integrity: sha512-SNjrzORJYiKTSmFbaBkKZAf5B/PszwoZoFZOcd86AG192zsvQBSvKjQzMjT5rDZxB+sOnhRE7wH/bvqxZishQQ==} engines: {node: '>=10'} cpu: [x64] os: [linux] - libc: [musl] '@swc/core-win32-arm64-msvc@1.2.218': resolution: {integrity: sha512-lVXFWkYl+w8+deq9mgGsfvSY5Gr1RRjFgqZ+0wMZgyaonfx7jNn3TILUwc7egumEwxK0anNriVZCyKfcO3ZIjA==} @@ -765,12 +761,15 @@ packages: '@types/flat@5.0.2': resolution: {integrity: sha512-3zsplnP2djeps5P9OyarTxwRpMLoe5Ash8aL9iprw0JxB+FAHjY+ifn4yZUuW4/9hqtnmor6uvjSRzJhiVbrEQ==} - '@types/fs-extra@9.0.13': - resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} + '@types/fs-extra@11.0.4': + resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} '@types/json5@0.0.29': resolution: {integrity: sha1-7ihweulOEdK4J7y+UnC86n8+ce4=} + '@types/jsonfile@6.1.4': + resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} + '@types/ms@0.7.31': resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==} @@ -1006,9 +1005,9 @@ packages: resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} hasBin: true - fs-extra@10.0.0: - resolution: {integrity: sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==} - engines: {node: '>=12'} + fs-extra@11.2.0: + resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} + engines: {node: '>=14.14'} fs-extra@7.0.1: resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==} @@ -1047,6 +1046,9 @@ packages: resolution: {integrity: sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==} engines: {node: '>=10'} + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + graceful-fs@4.2.8: resolution: {integrity: sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==} @@ -1624,8 +1626,8 @@ packages: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} - universalify@2.0.0: - resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} + universalify@2.0.1: + resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} uri-js@4.4.1: @@ -1976,6 +1978,7 @@ snapshots: '@rollup/plugin-json@6.0.1(rollup@4.0.2)': dependencies: '@rollup/pluginutils': 5.0.2(rollup@4.0.2) + optionalDependencies: rollup: 4.0.2 '@rollup/pluginutils@5.0.2(rollup@4.0.2)': @@ -1983,6 +1986,7 @@ snapshots: '@types/estree': 1.0.0 estree-walker: 2.0.2 picomatch: 2.3.1 + optionalDependencies: rollup: 4.0.2 '@rollup/rollup-android-arm-eabi@4.0.2': @@ -2071,7 +2075,6 @@ snapshots: '@rushstack/node-core-library@3.61.0(@types/node@14.18.12)': dependencies: - '@types/node': 14.18.12 colors: 1.2.5 fs-extra: 7.0.1 import-lazy: 4.0.0 @@ -2079,6 +2082,8 @@ snapshots: resolve: 1.22.1 semver: 7.5.4 z-schema: 5.0.5 + optionalDependencies: + '@types/node': 14.18.12 '@rushstack/rig-package@0.5.1': dependencies: @@ -2159,12 +2164,17 @@ snapshots: '@types/flat@5.0.2': {} - '@types/fs-extra@9.0.13': + '@types/fs-extra@11.0.4': dependencies: + '@types/jsonfile': 6.1.4 '@types/node': 14.18.12 '@types/json5@0.0.29': {} + '@types/jsonfile@6.1.4': + dependencies: + '@types/node': 14.18.12 + '@types/ms@0.7.31': {} '@types/node@14.18.12': {} @@ -2452,11 +2462,11 @@ snapshots: flat@5.0.2: {} - fs-extra@10.0.0: + fs-extra@11.2.0: dependencies: - graceful-fs: 4.2.8 + graceful-fs: 4.2.11 jsonfile: 6.1.0 - universalify: 2.0.0 + universalify: 2.0.1 fs-extra@7.0.1: dependencies: @@ -2499,6 +2509,8 @@ snapshots: merge2: 1.4.1 slash: 3.0.0 + graceful-fs@4.2.11: {} + graceful-fs@4.2.8: {} has-flag@3.0.0: @@ -2570,9 +2582,9 @@ snapshots: jsonfile@6.1.0: dependencies: - universalify: 2.0.0 + universalify: 2.0.1 optionalDependencies: - graceful-fs: 4.2.8 + graceful-fs: 4.2.11 lilconfig@2.1.0: {} @@ -2702,8 +2714,9 @@ snapshots: postcss-load-config@4.0.1(postcss@8.4.12): dependencies: lilconfig: 2.1.0 - postcss: 8.4.12 yaml: 2.3.1 + optionalDependencies: + postcss: 8.4.12 postcss-simple-vars@6.0.3(postcss@8.4.12): dependencies: @@ -2900,17 +2913,18 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - svelte-preprocess@5.0.3(postcss-load-config@4.0.1)(postcss@8.4.12)(sass@1.62.1)(svelte@3.46.4)(typescript@5.0.2): + svelte-preprocess@5.0.3(postcss-load-config@4.0.1(postcss@8.4.12))(postcss@8.4.12)(sass@1.62.1)(svelte@3.46.4)(typescript@5.0.2): dependencies: '@types/pug': 2.0.6 detect-indent: 6.1.0 magic-string: 0.27.0 - postcss: 8.4.12 - postcss-load-config: 4.0.1(postcss@8.4.12) - sass: 1.62.1 sorcery: 0.11.0 strip-indent: 3.0.0 svelte: 3.46.4 + optionalDependencies: + postcss: 8.4.12 + postcss-load-config: 4.0.1(postcss@8.4.12) + sass: 1.62.1 typescript: 5.0.2 svelte@3.46.4: {} @@ -2963,7 +2977,6 @@ snapshots: tsup@7.1.0(@swc/core@1.2.218)(postcss@8.4.12)(typescript@5.0.2): dependencies: - '@swc/core': 1.2.218 bundle-require: 4.0.0(esbuild@0.18.2) cac: 6.7.14 chokidar: 3.5.2 @@ -2972,13 +2985,15 @@ snapshots: execa: 5.1.1 globby: 11.0.4 joycon: 3.0.1 - postcss: 8.4.12 postcss-load-config: 4.0.1(postcss@8.4.12) resolve-from: 5.0.0 rollup: 3.25.0 source-map: 0.8.0-beta.0 sucrase: 3.20.3 tree-kill: 1.2.2 + optionalDependencies: + '@swc/core': 1.2.218 + postcss: 8.4.12 typescript: 5.0.2 transitivePeerDependencies: - supports-color @@ -2990,7 +3005,7 @@ snapshots: universalify@0.1.2: {} - universalify@2.0.0: {} + universalify@2.0.1: {} uri-js@4.4.1: dependencies: @@ -3017,19 +3032,18 @@ snapshots: vite@5.3.4(@types/node@14.18.12)(sass@1.62.1)(terser@5.16.0): dependencies: - '@types/node': 14.18.12 esbuild: 0.21.4 postcss: 8.4.39 rollup: 4.18.1 - sass: 1.62.1 - terser: 5.16.0 optionalDependencies: + '@types/node': 14.18.12 fsevents: 2.3.3 + sass: 1.62.1 + terser: 5.16.0 vitest@2.0.3(@types/node@14.18.12)(sass@1.62.1)(terser@5.16.0): dependencies: '@ampproject/remapping': 2.3.0 - '@types/node': 14.18.12 '@vitest/expect': 2.0.3 '@vitest/pretty-format': 2.0.3 '@vitest/runner': 2.0.3 @@ -3048,6 +3062,8 @@ snapshots: vite: 5.3.4(@types/node@14.18.12)(sass@1.62.1)(terser@5.16.0) vite-node: 2.0.3(@types/node@14.18.12)(sass@1.62.1)(terser@5.16.0) why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 14.18.12 transitivePeerDependencies: - less - lightningcss diff --git a/test/index.test.ts b/test/index.test.ts index 7933137bd..85d23a997 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -1,6 +1,6 @@ import { test, expect } from 'vitest' import path from 'path' -import fs from 'fs-extra' +import fs from 'fs' import waitForExpect from 'wait-for-expect' import { debouncePromise } from '../src/utils' import { getTestName, run } from './utils' diff --git a/vitest-global.ts b/vitest-global.ts index 1e267cc30..e38b1b72a 100644 --- a/vitest-global.ts +++ b/vitest-global.ts @@ -1,11 +1,11 @@ import execa from 'execa' import path from 'path' -import fs from 'fs-extra' +import fs from 'fs/promises' export default async function setup() { const testDir = path.resolve(__dirname, 'test') const cacheDir = path.resolve(testDir, '.cache') - await fs.remove(cacheDir) + await fs.rm(cacheDir, { recursive: true, force: true }) console.log(`Installing dependencies in ./test folder`) await execa('pnpm', ['i'], { cwd: testDir }) console.log(`Done... start testing..`)