Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEPENDENCY] Switch from "rimraf" to native "fs.rm" #1098

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions lib/tasks/jsdoc/generateJsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ const log = getLogger("builder:tasks:jsdoc:generateJsdoc");
import path from "node:path";
import os from "node:os";
import fs from "graceful-fs";
import {rimraf} from "rimraf";
import {mkdirp, rmrf} from "../../utils/fs.js";
import {promisify} from "node:util";
const mkdtemp = promisify(fs.mkdtemp);
const mkdir = promisify(fs.mkdir);
import jsdocGenerator from "../../processors/jsdoc/jsdocGenerator.js";
import {createAdapter} from "@ui5/fs/resourceFactory";

Expand Down Expand Up @@ -104,19 +103,19 @@ const utils = {
const tmpDirPath = await utils.createTmpDir(projectName);

const sourcePath = path.join(tmpDirPath, "src"); // dir will be created by writing project resources below
await mkdir(sourcePath, {recursive: true});
await mkdirp(sourcePath);
const targetPath = path.join(tmpDirPath, "target"); // dir will be created by jsdoc itself
await mkdir(targetPath, {recursive: true});
await mkdirp(targetPath);

const tmpPath = path.join(tmpDirPath, "tmp"); // dir needs to be created by us
await mkdir(tmpPath, {recursive: true});
await mkdirp(tmpPath);

return {
sourcePath,
targetPath,
tmpPath,
cleanup: async () => {
return rimraf(tmpDirPath);
return rmrf(tmpDirPath);
}
};
},
Expand All @@ -132,7 +131,7 @@ const utils = {
const sanitizedProjectName = projectName.replace(/[^A-Za-z0-9]/g, "");

const tmpRootPath = path.join(os.tmpdir(), "ui5-tooling");
await mkdir(tmpRootPath, {recursive: true});
await mkdirp(tmpRootPath);

// Appending minus sign also because node docs advise to "avoid trailing X characters in prefix"
return mkdtemp(path.join(tmpRootPath, `jsdoc-${sanitizedProjectName}-`));
Expand Down
12 changes: 12 additions & 0 deletions lib/utils/fs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import fs from "graceful-fs";
import {promisify} from "node:util";
const mkdir = promisify(fs.mkdir);
const rm = promisify(fs.rm);

export async function mkdirp(dirPath) {
return mkdir(dirPath, {recursive: true});
}

export async function rmrf(dirPath) {
return rm(dirPath, {recursive: true, force: true});
}
52 changes: 45 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"version": "git-chglog --sort semver --next-tag v$npm_package_version -o CHANGELOG.md v4.0.0.. && git add CHANGELOG.md",
"prepublishOnly": "git push --follow-tags",
"release-note": "git-chglog --sort semver -c .chglog/release-config.yml v$npm_package_version",
"depcheck": "depcheck --ignores @ui5/builder,docdash,@istanbuljs/esm-loader-hook,catharsis --parsers='**/*.js:es6,**/*.cjs:es6'"
"depcheck": "depcheck --ignores @ui5/builder,docdash,@istanbuljs/esm-loader-hook,catharsis,rimraf --parsers='**/*.js:es6,**/*.cjs:es6'"
},
"files": [
"CHANGELOG.md",
Expand Down Expand Up @@ -132,7 +132,6 @@
"jsdoc": "^4.0.4",
"less-openui5": "^0.11.6",
"pretty-data": "^0.40.0",
"rimraf": "^6.0.1",
"semver": "^7.6.3",
"terser": "^5.36.0",
"workerpool": "^9.2.0",
Expand All @@ -157,6 +156,7 @@
"line-column": "^1.0.2",
"nyc": "^17.1.0",
"open-cli": "^8.0.0",
"rimraf": "^6.0.1",
"sinon": "^19.0.2",
"tap-xunit": "^2.4.1"
}
Expand Down
Loading