diff --git a/.changeset/honest-vans-hope.md b/.changeset/honest-vans-hope.md new file mode 100644 index 000000000..6047ea322 --- /dev/null +++ b/.changeset/honest-vans-hope.md @@ -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. diff --git a/packages/utilities/src/package-boilerplate.ts b/packages/utilities/src/package-boilerplate.ts index 7b8cc08d3..3ba616ef8 100644 --- a/packages/utilities/src/package-boilerplate.ts +++ b/packages/utilities/src/package-boilerplate.ts @@ -87,23 +87,26 @@ export function isAstGrepProjectFiles( const beautify = (input: string, options?: Parameters[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)} \`\`\`