From 5e3b8c13b7f8a4ffc73fad677c9b65cf769ce27d Mon Sep 17 00:00:00 2001 From: Espen Hovlandsdal Date: Mon, 9 Dec 2024 00:57:07 -0800 Subject: [PATCH] fix(deps): deprecation warnings due to `glob` dependency (#7977) --- dev/test-studio/package.json | 2 +- package.json | 4 +- packages/@sanity/cli/package.json | 3 +- .../cli/src/actions/init-project/git.ts | 4 +- packages/@sanity/codegen/.depcheckrc.json | 2 +- packages/@sanity/codegen/package.json | 4 +- packages/@sanity/diff/.depcheckrc.json | 2 +- packages/@sanity/diff/package.json | 2 +- packages/@sanity/migrate/.depcheckrc.json | 2 +- packages/@sanity/migrate/package.json | 2 +- packages/@sanity/mutator/.depcheckrc.json | 2 +- packages/@sanity/mutator/package.json | 2 +- packages/@sanity/schema/.depcheckrc.json | 2 +- packages/@sanity/schema/package.json | 2 +- packages/@sanity/types/.depcheckrc.json | 2 +- packages/@sanity/types/package.json | 2 +- packages/@sanity/util/.depcheckrc.json | 2 +- packages/@sanity/util/package.json | 2 +- packages/sanity/package.json | 4 +- .../cli/actions/backup/cleanupTmpDir.ts | 14 ++-- .../cli/actions/build/buildAction.ts | 5 +- .../commands/backup/downloadBackupCommand.ts | 2 +- perf/efps/package.json | 2 +- perf/tests/package.json | 2 +- pnpm-lock.yaml | 74 ++++++++----------- scripts/symlinkDependencies.js | 4 +- 26 files changed, 65 insertions(+), 85 deletions(-) diff --git a/dev/test-studio/package.json b/dev/test-studio/package.json index 267d4edba22..86181a59681 100644 --- a/dev/test-studio/package.json +++ b/dev/test-studio/package.json @@ -46,7 +46,7 @@ "@turf/points-within-polygon": "^5.1.5", "@vercel/stega": "0.1.2", "chokidar": "^3.5.3", - "globby": "^10.0.0", + "globby": "^11.1.0", "history": "^5.3.0", "lodash": "^4.17.21", "qs": "^6.10.2", diff --git a/package.json b/package.json index 8cc65b7270f..435372ea0ac 100644 --- a/package.json +++ b/package.json @@ -149,7 +149,7 @@ "eslint-plugin-unused-imports": "^3.2.0", "execa": "^2.0.0", "glob": "^11.0.0", - "globby": "^10.0.0", + "globby": "^11.1.0", "husky": "^9.0.11", "js-yaml": "^4.1.0", "lerna": "^8.1.9", @@ -160,7 +160,7 @@ "ora": "^8.0.1", "prettier": "^3.3.3", "read-package-up": "^11.0.0", - "rimraf": "^3.0.2", + "rimraf": "^5.0.10", "rxjs": "^7.8.1", "sanity": "workspace:*", "semver": "^7.3.5", diff --git a/packages/@sanity/cli/package.json b/packages/@sanity/cli/package.json index fa7f19ccd97..0323a158417 100644 --- a/packages/@sanity/cli/package.json +++ b/packages/@sanity/cli/package.json @@ -92,7 +92,6 @@ "@types/lodash": "^4.17.7", "@types/minimist": "^1.2.5", "@types/node": "^22.10.0", - "@types/rimraf": "^3.0.2", "@types/semver": "^7.5.6", "@types/semver-compare": "^1.0.1", "@types/tar": "^6.1.3", @@ -124,7 +123,7 @@ "promise-props-recursive": "^2.0.2", "recast": "^0.23.9", "resolve-from": "^5.0.0", - "rimraf": "^3.0.2", + "rimraf": "^5.0.10", "semver": "^7.3.5", "semver-compare": "^1.0.0", "tar": "^6.1.11", diff --git a/packages/@sanity/cli/src/actions/init-project/git.ts b/packages/@sanity/cli/src/actions/init-project/git.ts index 6c8093f23fe..a48928099b9 100644 --- a/packages/@sanity/cli/src/actions/init-project/git.ts +++ b/packages/@sanity/cli/src/actions/init-project/git.ts @@ -1,7 +1,7 @@ import {execFileSync, execSync, type ExecSyncOptions} from 'node:child_process' import path from 'node:path' -import rimraf from 'rimraf' +import {rimrafSync} from 'rimraf' const defaultCommitMessage = 'feat: bootstrap sanity studio' @@ -29,7 +29,7 @@ export function tryGitInit(rootDir: string, commitMessage?: string): boolean { } catch (e) { if (didInit) { try { - rimraf.sync(path.join(rootDir, '.git')) + rimrafSync(path.join(rootDir, '.git')) } catch (_) { // intentional noop } diff --git a/packages/@sanity/codegen/.depcheckrc.json b/packages/@sanity/codegen/.depcheckrc.json index 35f1b4badf9..85f2a752c57 100644 --- a/packages/@sanity/codegen/.depcheckrc.json +++ b/packages/@sanity/codegen/.depcheckrc.json @@ -1,3 +1,3 @@ { - "ignores": ["@repo/tsconfig", "@sanity/pkg-utils"] + "ignores": ["@repo/tsconfig", "@sanity/pkg-utils", "rimraf"] } diff --git a/packages/@sanity/codegen/package.json b/packages/@sanity/codegen/package.json index 86d73a9dbac..7010bd4b5a1 100644 --- a/packages/@sanity/codegen/package.json +++ b/packages/@sanity/codegen/package.json @@ -59,7 +59,7 @@ "@babel/traverse": "^7.23.5", "@babel/types": "^7.23.9", "debug": "^4.3.4", - "globby": "^10.0.0", + "globby": "^11.1.0", "groq": "workspace:*", "groq-js": "^1.14.1", "json5": "^2.2.3", @@ -74,7 +74,7 @@ "@types/babel__register": "^7.17.3", "@types/babel__traverse": "^7.20.5", "@types/debug": "^4.1.12", - "rimraf": "^3.0.2", + "rimraf": "^5.0.10", "vitest": "^2.1.1" }, "engines": { diff --git a/packages/@sanity/diff/.depcheckrc.json b/packages/@sanity/diff/.depcheckrc.json index 35f1b4badf9..85f2a752c57 100644 --- a/packages/@sanity/diff/.depcheckrc.json +++ b/packages/@sanity/diff/.depcheckrc.json @@ -1,3 +1,3 @@ { - "ignores": ["@repo/tsconfig", "@sanity/pkg-utils"] + "ignores": ["@repo/tsconfig", "@sanity/pkg-utils", "rimraf"] } diff --git a/packages/@sanity/diff/package.json b/packages/@sanity/diff/package.json index 757c705cf50..f0a830c646d 100644 --- a/packages/@sanity/diff/package.json +++ b/packages/@sanity/diff/package.json @@ -51,7 +51,7 @@ }, "devDependencies": { "@repo/package.config": "workspace:*", - "rimraf": "^3.0.2" + "rimraf": "^5.0.10" }, "engines": { "node": ">=18" diff --git a/packages/@sanity/migrate/.depcheckrc.json b/packages/@sanity/migrate/.depcheckrc.json index 35f1b4badf9..85f2a752c57 100644 --- a/packages/@sanity/migrate/.depcheckrc.json +++ b/packages/@sanity/migrate/.depcheckrc.json @@ -1,3 +1,3 @@ { - "ignores": ["@repo/tsconfig", "@sanity/pkg-utils"] + "ignores": ["@repo/tsconfig", "@sanity/pkg-utils", "rimraf"] } diff --git a/packages/@sanity/migrate/package.json b/packages/@sanity/migrate/package.json index 827ec3b9bc7..eaba53f85b0 100644 --- a/packages/@sanity/migrate/package.json +++ b/packages/@sanity/migrate/package.json @@ -65,7 +65,7 @@ "@repo/test-config": "workspace:*", "@types/arrify": "^2.0.1", "@types/debug": "^4.1.12", - "rimraf": "^3.0.2", + "rimraf": "^5.0.10", "vitest": "^2.1.1" }, "engines": { diff --git a/packages/@sanity/mutator/.depcheckrc.json b/packages/@sanity/mutator/.depcheckrc.json index 35f1b4badf9..85f2a752c57 100644 --- a/packages/@sanity/mutator/.depcheckrc.json +++ b/packages/@sanity/mutator/.depcheckrc.json @@ -1,3 +1,3 @@ { - "ignores": ["@repo/tsconfig", "@sanity/pkg-utils"] + "ignores": ["@repo/tsconfig", "@sanity/pkg-utils", "rimraf"] } diff --git a/packages/@sanity/mutator/package.json b/packages/@sanity/mutator/package.json index c8e6b9cfd11..f3314cf6150 100644 --- a/packages/@sanity/mutator/package.json +++ b/packages/@sanity/mutator/package.json @@ -60,7 +60,7 @@ "@repo/test-config": "workspace:*", "@types/debug": "^4.1.5", "@types/lodash": "^4.17.7", - "rimraf": "^3.0.2", + "rimraf": "^5.0.10", "vitest": "^2.1.1" } } diff --git a/packages/@sanity/schema/.depcheckrc.json b/packages/@sanity/schema/.depcheckrc.json index f05b0634d43..a2a2831b61e 100644 --- a/packages/@sanity/schema/.depcheckrc.json +++ b/packages/@sanity/schema/.depcheckrc.json @@ -1,3 +1,3 @@ { - "ignores": ["@repo/tsconfig", "@sanity/pkg-utils", "@types/react"] + "ignores": ["@repo/tsconfig", "@sanity/pkg-utils", "@types/react", "rimraf"] } diff --git a/packages/@sanity/schema/package.json b/packages/@sanity/schema/package.json index 4daa2c0fd57..6b640eceaf5 100644 --- a/packages/@sanity/schema/package.json +++ b/packages/@sanity/schema/package.json @@ -80,7 +80,7 @@ "@types/lodash": "^4.17.7", "@types/object-inspect": "^1.13.0", "@types/react": "^18.3.12", - "rimraf": "^3.0.2", + "rimraf": "^5.0.10", "vitest": "^2.1.1" } } diff --git a/packages/@sanity/types/.depcheckrc.json b/packages/@sanity/types/.depcheckrc.json index 10cd9026ee0..2a2450b6289 100644 --- a/packages/@sanity/types/.depcheckrc.json +++ b/packages/@sanity/types/.depcheckrc.json @@ -1,3 +1,3 @@ { - "ignores": ["@repo/tsconfig", "@sanity/pkg-utils", "@sanity/types", "react"] + "ignores": ["@repo/tsconfig", "@sanity/pkg-utils", "@sanity/types", "react", "rimraf"] } diff --git a/packages/@sanity/types/package.json b/packages/@sanity/types/package.json index 3dc1d74a0af..0c73eb697b3 100644 --- a/packages/@sanity/types/package.json +++ b/packages/@sanity/types/package.json @@ -58,7 +58,7 @@ "@sanity/insert-menu": "1.0.16", "@vitejs/plugin-react": "^4.3.3", "react": "^18.3.1", - "rimraf": "^3.0.2", + "rimraf": "^5.0.10", "vitest": "^2.1.1" } } diff --git a/packages/@sanity/util/.depcheckrc.json b/packages/@sanity/util/.depcheckrc.json index 35f1b4badf9..85f2a752c57 100644 --- a/packages/@sanity/util/.depcheckrc.json +++ b/packages/@sanity/util/.depcheckrc.json @@ -1,3 +1,3 @@ { - "ignores": ["@repo/tsconfig", "@sanity/pkg-utils"] + "ignores": ["@repo/tsconfig", "@sanity/pkg-utils", "rimraf"] } diff --git a/packages/@sanity/util/package.json b/packages/@sanity/util/package.json index af4cd315864..85464be9ccc 100644 --- a/packages/@sanity/util/package.json +++ b/packages/@sanity/util/package.json @@ -130,7 +130,7 @@ "devDependencies": { "@repo/package.config": "workspace:*", "@repo/test-config": "workspace:*", - "rimraf": "^3.0.2", + "rimraf": "^5.0.10", "vitest": "^2.1.1" }, "engines": { diff --git a/packages/sanity/package.json b/packages/sanity/package.json index 5a64a03447e..a6efad14536 100644 --- a/packages/sanity/package.json +++ b/packages/sanity/package.json @@ -250,7 +250,7 @@ "refractor": "^3.6.0", "resolve-from": "^5.0.0", "resolve.exports": "^2.0.2", - "rimraf": "^3.0.2", + "rimraf": "^5.0.10", "rxjs": "^7.8.0", "rxjs-exhaustmap-with-trailing": "^2.1.1", "sanity-diff-patch": "^4.0.0", @@ -295,7 +295,6 @@ "@types/react-dom": "^18.3.1", "@types/refractor": "^3.0.0", "@types/resolve-from": "^4.0.0", - "@types/rimraf": "^3.0.2", "@types/semver": "^6.2.3", "@types/tar-fs": "^2.0.1", "@vitejs/plugin-react": "^4.3.3", @@ -305,7 +304,6 @@ "date-fns-tz": "2.0.1", "react": "^18.3.1", "react-dom": "^18.3.1", - "rimraf": "^3.0.2", "rxjs-etc": "^10.6.2", "styled-components": "^6.1.13", "swr": "2.2.5", diff --git a/packages/sanity/src/_internal/cli/actions/backup/cleanupTmpDir.ts b/packages/sanity/src/_internal/cli/actions/backup/cleanupTmpDir.ts index f32dc4b203d..b4893245116 100644 --- a/packages/sanity/src/_internal/cli/actions/backup/cleanupTmpDir.ts +++ b/packages/sanity/src/_internal/cli/actions/backup/cleanupTmpDir.ts @@ -1,13 +1,13 @@ -import rimraf from 'rimraf' +import {rimraf} from 'rimraf' import debug from './debug' -function cleanupTmpDir(tmpDir: string): void { - rimraf(tmpDir, (err) => { - if (err) { - debug(`Error cleaning up temporary files: ${err.message}`) - } - }) +async function cleanupTmpDir(tmpDir: string): Promise { + try { + await rimraf(tmpDir) + } catch (err) { + debug(`Error cleaning up temporary files: ${err.message}`) + } } export default cleanupTmpDir diff --git a/packages/sanity/src/_internal/cli/actions/build/buildAction.ts b/packages/sanity/src/_internal/cli/actions/build/buildAction.ts index beb8e29bbc6..24e105335b5 100644 --- a/packages/sanity/src/_internal/cli/actions/build/buildAction.ts +++ b/packages/sanity/src/_internal/cli/actions/build/buildAction.ts @@ -1,11 +1,10 @@ import path from 'node:path' -import {promisify} from 'node:util' import chalk from 'chalk' import {info} from 'log-symbols' import semver from 'semver' import {noopLogger} from '@sanity/telemetry' -import rimrafCallback from 'rimraf' +import {rimraf} from 'rimraf' import type {CliCommandArguments, CliCommandContext} from '@sanity/cli' import {buildStaticFiles, ChunkModule, ChunkStats} from '../../server' @@ -18,8 +17,6 @@ import {compareStudioDependencyVersions} from '../../util/compareStudioDependenc import {getAutoUpdateImportMap} from '../../util/getAutoUpdatesImportMap' import {shouldAutoUpdate} from '../../util/shouldAutoUpdate' -const rimraf = promisify(rimrafCallback) - export interface BuildSanityStudioCommandFlags { 'yes'?: boolean 'y'?: boolean diff --git a/packages/sanity/src/_internal/cli/commands/backup/downloadBackupCommand.ts b/packages/sanity/src/_internal/cli/commands/backup/downloadBackupCommand.ts index b10d2ba77af..060c6d7e86b 100644 --- a/packages/sanity/src/_internal/cli/commands/backup/downloadBackupCommand.ts +++ b/packages/sanity/src/_internal/cli/commands/backup/downloadBackupCommand.ts @@ -189,7 +189,7 @@ const downloadBackupCommand: CliCommandDefinition = { progressSpinner.set({ step: `Cleaning up temporary files at ${chalk.cyan(`${tmpOutDir}`)}`, }) - cleanupTmpDir(tmpOutDir) + await cleanupTmpDir(tmpOutDir) progressSpinner.set({ step: `Backup download complete [${prettyMs(Date.now() - start)}]`, diff --git a/perf/efps/package.json b/perf/efps/package.json index 66e814075d1..dd703acdd13 100644 --- a/perf/efps/package.json +++ b/perf/efps/package.json @@ -27,7 +27,7 @@ "chalk": "^4.1.2", "cli-table3": "^0.6.5", "dotenv": "^16.0.3", - "globby": "^10.0.0", + "globby": "^11.1.0", "ora": "^8.0.1", "playwright": "^1.46.1", "react": "^18.3.1", diff --git a/perf/tests/package.json b/perf/tests/package.json index 2c0841dd7d8..7ab3a0af4dd 100644 --- a/perf/tests/package.json +++ b/perf/tests/package.json @@ -20,7 +20,7 @@ "@sanity/uuid": "^3.0.1", "dotenv": "^16.0.3", "execa": "^2.0.0", - "globby": "^10.0.0", + "globby": "^11.1.0", "lodash": "^4.17.21", "rxjs": "^7.8.0", "sanity": "workspace:*" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cb3da5a4295..12a96108fbb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -166,8 +166,8 @@ importers: specifier: ^11.0.0 version: 11.0.0 globby: - specifier: ^10.0.0 - version: 10.0.2 + specifier: ^11.1.0 + version: 11.1.0 husky: specifier: ^9.0.11 version: 9.1.4 @@ -199,8 +199,8 @@ importers: specifier: ^11.0.0 version: 11.0.0 rimraf: - specifier: ^3.0.2 - version: 3.0.2 + specifier: ^5.0.10 + version: 5.0.10 rxjs: specifier: ^7.8.1 version: 7.8.1 @@ -553,8 +553,8 @@ importers: specifier: ^3.5.3 version: 3.6.0 globby: - specifier: ^10.0.0 - version: 10.0.2 + specifier: ^11.1.0 + version: 11.1.0 history: specifier: ^5.3.0 version: 5.3.0 @@ -888,9 +888,6 @@ importers: '@types/node': specifier: ^22.10.0 version: 22.10.0 - '@types/rimraf': - specifier: ^3.0.2 - version: 3.0.2 '@types/semver': specifier: ^7.5.6 version: 7.5.8 @@ -985,8 +982,8 @@ importers: specifier: ^5.0.0 version: 5.0.0 rimraf: - specifier: ^3.0.2 - version: 3.0.2 + specifier: ^5.0.10 + version: 5.0.10 semver-compare: specifier: ^1.0.0 version: 1.0.0 @@ -1036,8 +1033,8 @@ importers: specifier: ^4.3.4 version: 4.3.7(supports-color@9.4.0) globby: - specifier: ^10.0.0 - version: 10.0.2 + specifier: ^11.1.0 + version: 11.1.0 groq: specifier: workspace:* version: link:../../groq @@ -1076,8 +1073,8 @@ importers: specifier: ^4.1.12 version: 4.1.12 rimraf: - specifier: ^3.0.2 - version: 3.0.2 + specifier: ^5.0.10 + version: 5.0.10 vitest: specifier: ^2.1.1 version: 2.1.1(@types/node@22.10.0)(jsdom@23.2.0)(terser@5.32.0) @@ -1092,8 +1089,8 @@ importers: specifier: workspace:* version: link:../../@repo/package.config rimraf: - specifier: ^3.0.2 - version: 3.0.2 + specifier: ^5.0.10 + version: 5.0.10 packages/@sanity/migrate: dependencies: @@ -1138,8 +1135,8 @@ importers: specifier: ^4.1.12 version: 4.1.12 rimraf: - specifier: ^3.0.2 - version: 3.0.2 + specifier: ^5.0.10 + version: 5.0.10 vitest: specifier: ^2.1.1 version: 2.1.1(@types/node@22.10.0)(jsdom@23.2.0)(terser@5.32.0) @@ -1175,8 +1172,8 @@ importers: specifier: ^4.17.7 version: 4.17.13 rimraf: - specifier: ^3.0.2 - version: 3.0.2 + specifier: ^5.0.10 + version: 5.0.10 vitest: specifier: ^2.1.1 version: 2.1.1(@types/node@22.10.0)(jsdom@23.2.0)(terser@5.32.0) @@ -1230,8 +1227,8 @@ importers: specifier: ^18.3.12 version: 18.3.13 rimraf: - specifier: ^3.0.2 - version: 3.0.2 + specifier: ^5.0.10 + version: 5.0.10 vitest: specifier: ^2.1.1 version: 2.1.1(@types/node@22.10.0)(jsdom@23.2.0)(terser@5.32.0) @@ -1261,8 +1258,8 @@ importers: specifier: ^18.3.1 version: 18.3.1 rimraf: - specifier: ^3.0.2 - version: 3.0.2 + specifier: ^5.0.10 + version: 5.0.10 vitest: specifier: ^2.1.1 version: 2.1.1(@types/node@22.10.0)(jsdom@23.2.0)(terser@5.32.0) @@ -1292,8 +1289,8 @@ importers: specifier: workspace:* version: link:../../@repo/test-config rimraf: - specifier: ^3.0.2 - version: 3.0.2 + specifier: ^5.0.10 + version: 5.0.10 vitest: specifier: ^2.1.1 version: 2.1.1(@types/node@22.10.0)(jsdom@23.2.0)(terser@5.32.0) @@ -1737,8 +1734,8 @@ importers: specifier: ^2.0.2 version: 2.0.2 rimraf: - specifier: ^3.0.2 - version: 3.0.2 + specifier: ^5.0.10 + version: 5.0.10 rxjs: specifier: ^7.8.0 version: 7.8.1 @@ -1866,9 +1863,6 @@ importers: '@types/resolve-from': specifier: ^4.0.0 version: 4.0.0 - '@types/rimraf': - specifier: ^3.0.2 - version: 3.0.2 '@types/semver': specifier: ^6.2.3 version: 6.2.7 @@ -1978,8 +1972,8 @@ importers: specifier: ^16.0.3 version: 16.4.5 globby: - specifier: ^10.0.0 - version: 10.0.2 + specifier: ^11.1.0 + version: 11.1.0 ora: specifier: ^8.0.1 version: 8.0.1 @@ -2053,8 +2047,8 @@ importers: specifier: ^2.0.0 version: 2.1.0 globby: - specifier: ^10.0.0 - version: 10.0.2 + specifier: ^11.1.0 + version: 11.1.0 lodash: specifier: ^4.17.21 version: 4.17.21 @@ -5110,9 +5104,6 @@ packages: '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} - '@types/rimraf@3.0.2': - resolution: {integrity: sha512-F3OznnSLAUxFrCEu/L5PY8+ny8DtcFRjx7fZZ9bycvXRi3KPTRS9HOitGZwvPg0juRhXFWIeKX58cnX5YqLohQ==} - '@types/semver-compare@1.0.3': resolution: {integrity: sha512-mVZkB2QjXmZhh+MrtwMlJ8BqUnmbiSkpd88uOWskfwB8yitBT0tBRAKt+41VRgZD9zr9Sc+Xs02qGgvzd1Rq/Q==} @@ -15556,11 +15547,6 @@ snapshots: '@types/resolve@1.20.2': {} - '@types/rimraf@3.0.2': - dependencies: - '@types/glob': 7.2.0 - '@types/node': 22.10.0 - '@types/semver-compare@1.0.3': {} '@types/semver@6.2.7': {} diff --git a/scripts/symlinkDependencies.js b/scripts/symlinkDependencies.js index d0daa31a3b9..decb27d9f92 100755 --- a/scripts/symlinkDependencies.js +++ b/scripts/symlinkDependencies.js @@ -11,7 +11,7 @@ const fs = require('node:fs') const path = require('node:path') const minimist = require('minimist') -const rimraf = require('rimraf') +const {rimrafSync} = require('rimraf') const argv = minimist(process.argv.slice(2), {boolean: ['all']}) @@ -71,7 +71,7 @@ const removeFolders = sharedPackages console.log('Removing dependencies from node_modules:') console.log(`\n ${sharedPackages.join('\n ')}\n`) -removeFolders.forEach((dir) => rimraf.sync(dir)) +removeFolders.forEach((dir) => rimrafSync(dir)) // Secondly, symlink into node_modules, but only the dependencies declared in package.json console.log('Symlinking dependencies to node_modules:\n')