Skip to content

Commit

Permalink
chore(apps/cli): update README.md template in starter boilerplate for…
Browse files Browse the repository at this point in the history
… codemod init (#1443)

* chore: update README.md boilerplate to use the new format for the codemod init command.

* fix: fix codemod technology name in README.md template in package-boilderplate
  • Loading branch information
amirabbas-gh authored Jan 10, 2025
1 parent 52a85ab commit d0c2110
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .changeset/honest-vans-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@codemod-com/utilities": minor
"codemod": minor
---

Change the README.md boilerplate to use the new format for the codemod init command.
17 changes: 10 additions & 7 deletions packages/utilities/src/package-boilerplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,26 @@ export function isAstGrepProjectFiles(
const beautify = (input: string, options?: Parameters<typeof js>[1]) =>
js(input, { brace_style: "preserve-inline", indent_size: 2, ...options });

const readme = ({ cases }: ProjectDownloadInput) => {
const readme = ({ cases, name }: ProjectDownloadInput) => {
const packageName = changeCase.kebabCase(name);

return `
This is a [codemod](https://codemod.com) created with [\`\`\`codemod init\`\`\`](https://docs.codemod.com/deploying-codemods/cli#codemod-init).
## Using this codemod
You can run this codemod with the following command:
\`\`\`bash
npx codemod ${packageName}
\`\`\`
## Example
${cases?.map(({ before, after }) => {
return `This codemod turns X into Y. It also does Z.
Note: this is a contrived example. Please modify it.
return `
### Before
\`\`\`ts
${beautify(before)}
\`\`\`
### After
\`\`\`ts
${beautify(after)}
\`\`\`
Expand Down

0 comments on commit d0c2110

Please sign in to comment.