Skip to content

Commit

Permalink
Merge pull request #1560 from DataDog/corentin.girard/bump-deps-rimraf
Browse files Browse the repository at this point in the history
[dep] Drop rimraf in production code
  • Loading branch information
Drarig29 authored Feb 25, 2025
2 parents 4ee948d + bdcf633 commit c204c8a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 36 deletions.
3 changes: 1 addition & 2 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Component,Origin,Licence,Copyright
@types/jest,dev,MIT,Copyright Microsoft Corporation
@types/js-yaml,dev,MIT,Bart van der Schoor
@types/node,dev,MIT,Copyright Microsoft Corporation
@types/rimraf,dev,MIT,Copyright Carlos Ballesteros Velasco <https://github.com/soywiz> and contributors
@types/semver,dev,MIT,Copyright Microsoft Corporation
@types/ssh2,dev,MIT,Copyright Microsoft Corporation
@types/ssh2-streams,dev,MIT,Copyright Microsoft Corporation
Expand Down Expand Up @@ -54,7 +53,7 @@ pkg,dev,MIT,"Copyright (c) 2021 Vercel, Inc."
prettier,dev,MIT,Copyright © James Long and contributors
proxy,dev,MIT,Copyright (c) 2013 Nathan Rajlich <[email protected]>
proxy-agent,import,MIT,Copyright (c) 2013 Nathan Rajlich <[email protected]>
rimraf,import,ISC,Copyright (c) 2011-2022 Isaac Z. Schlueter and Contributors
rimraf,dev,ISC,Copyright (c) 2011-2022 Isaac Z. Schlueter and Contributors
semver,import,ISC,Copyright (c) Isaac Z. Schlueter and Contributors
simple-git,import,MIT,Copyright (c) 2015 Steve King
ssh2,import,MIT,Copyright (c) Brian White
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
"ora": "5.4.1",
"packageurl-js": "^2.0.1",
"proxy-agent": "^6.4.0",
"rimraf": "^3.0.2",
"semver": "^7.5.3",
"simple-git": "3.16.0",
"ssh2": "^1.15.0",
Expand All @@ -121,7 +120,6 @@
"@types/jest": "29.5.3",
"@types/js-yaml": "^4.0.5",
"@types/node": "^18.19.76",
"@types/rimraf": "^3.0.2",
"@types/semver": "^7.3.12",
"@types/ssh2": "1.11.6",
"@types/ssh2-streams": "0.1.9",
Expand All @@ -147,6 +145,7 @@
"pkg": "5.8.1",
"prettier": "2.0.5",
"proxy": "^2.1.1",
"rimraf": "^5.0.0",
"ts-jest": "29.1.1",
"ts-node": "8.8.1",
"typescript": "5.1.6"
Expand Down
15 changes: 7 additions & 8 deletions src/commands/dsyms/utils.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import {promises} from 'fs'
import fs from 'fs/promises'
import {tmpdir} from 'os'
import path from 'path'

import rimraf from 'rimraf'

import {buildPath, execute} from '../../helpers/utils'

export const isZipFile = async (filepath: string) => {
try {
const stats = await promises.stat(filepath)
const stats = await fs.stat(filepath)

return stats.size !== 0 && path.extname(filepath) === '.zip'
} catch (error) {
Expand All @@ -20,13 +18,14 @@ export const isZipFile = async (filepath: string) => {
export const createUniqueTmpDirectory = async (): Promise<string> => {
const uniqueValue = Math.random() * Number.MAX_SAFE_INTEGER
const directoryPath = buildPath(tmpdir(), uniqueValue.toString())
await promises.mkdir(directoryPath, {recursive: true})
await fs.mkdir(directoryPath, {recursive: true})

return directoryPath
}

export const deleteDirectory = async (directoryPath: string): Promise<void> =>
new Promise((resolve, reject) => rimraf(directoryPath, () => resolve()))
export const deleteDirectory = async (directoryPath: string): Promise<void> => {
await fs.rm(directoryPath, {recursive: true})
}

export const zipDirectoryToArchive = async (directoryPath: string, archivePath: string) => {
const cwd = path.dirname(directoryPath)
Expand All @@ -35,7 +34,7 @@ export const zipDirectoryToArchive = async (directoryPath: string, archivePath:
}

export const unzipArchiveToDirectory = async (archivePath: string, directoryPath: string) => {
await promises.mkdir(directoryPath, {recursive: true})
await fs.mkdir(directoryPath, {recursive: true})
await execute(`unzip -o '${archivePath}' -d '${directoryPath}'`)
}

Expand Down
38 changes: 14 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1937,7 +1937,6 @@ __metadata:
"@types/jest": 29.5.3
"@types/js-yaml": ^4.0.5
"@types/node": ^18.19.76
"@types/rimraf": ^3.0.2
"@types/semver": ^7.3.12
"@types/ssh2": 1.11.6
"@types/ssh2-streams": 0.1.9
Expand Down Expand Up @@ -1985,7 +1984,7 @@ __metadata:
prettier: 2.0.5
proxy: ^2.1.1
proxy-agent: ^6.4.0
rimraf: ^3.0.2
rimraf: ^5.0.0
semver: ^7.5.3
simple-git: 3.16.0
ssh2: ^1.15.0
Expand Down Expand Up @@ -3563,16 +3562,6 @@ __metadata:
languageName: node
linkType: hard

"@types/glob@npm:*":
version: 8.1.0
resolution: "@types/glob@npm:8.1.0"
dependencies:
"@types/minimatch": ^5.1.2
"@types/node": "*"
checksum: 9101f3a9061e40137190f70626aa0e202369b5ec4012c3fabe6f5d229cce04772db9a94fa5a0eb39655e2e4ad105c38afbb4af56a56c0996a8c7d4fc72350e3d
languageName: node
linkType: hard

"@types/glob@npm:7.1.1":
version: 7.1.1
resolution: "@types/glob@npm:7.1.1"
Expand Down Expand Up @@ -3676,7 +3665,7 @@ __metadata:
languageName: node
linkType: hard

"@types/minimatch@npm:*, @types/minimatch@npm:^5.1.2":
"@types/minimatch@npm:*":
version: 5.1.2
resolution: "@types/minimatch@npm:5.1.2"
checksum: 0391a282860c7cb6fe262c12b99564732401bdaa5e395bee9ca323c312c1a0f45efbf34dce974682036e857db59a5c9b1da522f3d6055aeead7097264c8705a8
Expand Down Expand Up @@ -3720,16 +3709,6 @@ __metadata:
languageName: node
linkType: hard

"@types/rimraf@npm:^3.0.2":
version: 3.0.2
resolution: "@types/rimraf@npm:3.0.2"
dependencies:
"@types/glob": "*"
"@types/node": "*"
checksum: b47fa302f46434cba704d20465861ad250df79467d3d289f9d6490d3aeeb41e8cb32dd80bd1a8fd833d1e185ac719fbf9be12e05ad9ce9be094d8ee8f1405347
languageName: node
linkType: hard

"@types/semver@npm:^7.3.12":
version: 7.5.8
resolution: "@types/semver@npm:7.5.8"
Expand Down Expand Up @@ -6491,7 +6470,7 @@ __metadata:
languageName: node
linkType: hard

"glob@npm:^10.2.2, glob@npm:^10.3.10":
"glob@npm:^10.2.2, glob@npm:^10.3.10, glob@npm:^10.3.7":
version: 10.4.5
resolution: "glob@npm:10.4.5"
dependencies:
Expand Down Expand Up @@ -9582,6 +9561,17 @@ jschardet@latest:
languageName: node
linkType: hard

"rimraf@npm:^5.0.0":
version: 5.0.10
resolution: "rimraf@npm:5.0.10"
dependencies:
glob: ^10.3.7
bin:
rimraf: dist/esm/bin.mjs
checksum: 50e27388dd2b3fa6677385fc1e2966e9157c89c86853b96d02e6915663a96b7ff4d590e14f6f70e90f9b554093aa5dbc05ac3012876be558c06a65437337bc05
languageName: node
linkType: hard

"run-async@npm:^2.4.0":
version: 2.4.1
resolution: "run-async@npm:2.4.1"
Expand Down

0 comments on commit c204c8a

Please sign in to comment.