28 lines
595 B
JavaScript
28 lines
595 B
JavaScript
// @ts-check
|
|
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const ignorePattern = /node_modules/;
|
|
|
|
const searchMatchPattern = {
|
|
pattern: /\"\/admin\/(.*?)\"/,
|
|
replace: "'/b/$1'",
|
|
};
|
|
|
|
/**
|
|
*
|
|
* @param {object} param0
|
|
* @param {string} param0.dir
|
|
*/
|
|
function replaceDir({ dir }) {
|
|
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 });
|
|
}
|
|
});
|
|
}
|