dsql-admin/dsql-app/utils/findAndReplace.ts
Benjamin Toby e0a030f10d Updates
2025-01-13 09:00:21 +01:00

28 lines
602 B
TypeScript

// @ts-check
import fs from "fs";
import path from "path";
const ignorePattern = /node_modules/;
const searchMatchPattern = {
pattern: /\"\/admin\/(.*?)\"/,
replace: "'/b/$1'",
};
/**
*
* @param {object} param0
* @param {string} param0.dir
*/
function replaceDir({ dir }: { dir: string }) {
const dirContent = fs.readdirSync(dir);
dirContent.forEach((fileFolder, index) => {
const fileFolderPath = path.join(dir, fileFolder);
const fsStat = fs.statSync(fileFolderPath);
if (!fsStat.isFile()) {
return replaceDir({ dir });
}
});
}