@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.
94 lines (68 loc) • 1.9 kB
Markdown
from Inversify to `@wroud/di` effortlessly. This codemod automates the transformation process, ensuring a smooth transition to `@wroud/di`.
- **Automated Migration**: Converts your existing Inversify code to use `@wroud/di`.
- **Configuration Support**: Allows customization through a `di-tools-codemod.json` configuration file.
```sh
npm install @wroud/di-tools-codemod
```
Install via yarn
```sh
yarn add @wroud/di-tools-codemod
```
To use the codemod, run the following command in your terminal:
```sh
yarn di-tools-codemod ./packages/*/src/**/*.{ts,tsx}
```
You can provide a `di-tools-codemod.json` configuration file in the same folder where you run the codemod to customize the migration process.
```json
{
"transformer": {
"esm": false,
"copyright": ""
},
"supportedPackages": [
{
"name": "inversify",
"replace": "@wroud/di",
"injectableDecorator": "injectable",
"injectDecorator": "inject",
"multiInjectDecorator": "multiInject"
}
],
"generateModule": true
}
```
```ts
import { injectable } from "inversify";
@injectable()
export class NotificationService {
constructor(
private readonly a: A,
private readonly b: B,
private readonly c: C,
) {}
}
```
```ts
import { injectable } from "@wroud/di";
@injectable(() => [A, B, C])
export class NotificationService {
constructor(
private readonly a: A,
private readonly b: B,
private readonly c: C,
) {}
}
```
All notable changes to this project will be documented in the [CHANGELOG](./CHANGELOG.md) file.
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
Welcome to `@wroud/di-tools-codemod`, a tool designed to help you migrate your codebase