Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
beerose committed Jan 15, 2025
1 parent 7ca3cda commit 166d13d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
9 changes: 4 additions & 5 deletions packages/codemod/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# Codemod

- Main codemod script is `transform.ts`
- `transforms` contains different codemod scripts (imported and used in `transform.ts`)
- CLI entry point is `cli.ts`
- `scripts` has custom scripts like changing file names, etc.
- `transforms` contains different codemod scripts (imported and used in `transforms/index.ts`)
- `__tests__` contains tests for the codemod
- `__testfixtures__` contains test fixtures

## Usage

```
yarn jscodeshift -t transform.ts <path>
yarn codemod <path-to-directory>
```

TODO: We can wrap this in a CLI and pass options to the transforms.

## Tests

```
Expand Down
2 changes: 1 addition & 1 deletion packages/codemod/__tests__/package-json-update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ describe('Package JSON Update Script', () => {
expect(mockFs.readFile).not.toHaveBeenCalled();
expect(mockFs.writeFile).not.toHaveBeenCalled();
});
});
});
4 changes: 2 additions & 2 deletions packages/codemod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
},
"scripts": {
"typecheck": "tsc --project tsconfig.json --noEmit",
"codemod": "tsx src/index.ts",
"codemod": "node ./dist/cli.js",
"jscodeshift": "jscodeshift",
"build": "tsc",
"test": "jest",
"lint": "eslint --quiet",
"lint:fix": "eslint --fix"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as glob from 'glob';

async function updateTomlContent(content: string): Promise<string> {
return content
.replace(/\[edgedb\]/g, '[gel]')
.replace(/\[edgedb\]/g, '[gel]');
}

async function processTomlFile(filePath: string): Promise<string[]> {
Expand Down
2 changes: 1 addition & 1 deletion packages/codemod/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"transforms/recipes/**/template/**/*",
"__testfixtures__/**/*"
]
}
}

0 comments on commit 166d13d

Please sign in to comment.