@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.
24 lines (18 loc) • 572 B
JavaScript
const { run } = require("jscodeshift/src/Runner.js");
const path = require("node:path");
const { existsSync, readFileSync } = require("node:fs");
const transformPath = require.resolve("../lib/cjs/index.js");
const paths = process.argv.slice(2);
let migrationOptions = {};
const migrationOptionsPath = path.resolve(
process.cwd(),
"di-tools-codemod.json",
);
if (existsSync(migrationOptionsPath)) {
migrationOptions = JSON.parse(readFileSync(migrationOptionsPath, "utf8"));
}
run(transformPath, paths, {
...migrationOptions,
cpus: 1,
});