@wroud/di-tools-codemod
Version:
@wroud/di-tools-codemod is a codemod utility that automates the migration of your codebase from Inversify to @wroud/di. It streamlines the transformation process, allowing for effortless and customizable transitions through configuration support.
21 lines (20 loc) • 736 B
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.findSrcDir = findSrcDir;
const node_path_1 = __importDefault(require("node:path"));
function findSrcDir(filePath) {
let currentDir = filePath;
const cwdPath = process.cwd();
while (currentDir !== node_path_1.default.parse(currentDir).root &&
currentDir !== cwdPath &&
currentDir !== ".") {
if (node_path_1.default.basename(currentDir) === "src") {
return currentDir;
}
currentDir = node_path_1.default.dirname(currentDir);
}
return null;
}
;