Authoring
There are currently three approaches to authoring and publishing a hypermod package. Which one to use depends on your particular use case.
- Contribute to the public registry
- Add Hypermod to an existing package
- Create a stand-alone Hypermod package
1. Contribute to the public registry
The public registry is the public directory of codemods hosted and published directly from this repository, visible here. This directory can be compared to and treated the same as the Typescript type definition registry: DefinitelyTyped.
Please see the Contribution guide for more information.
Use this method if you want:
- Your codemods to be open source
- Build tooling, dependency management and project setup to be handled for you
- The community to help maintain and contribute to your codemods
- Documentation to be automatically generated and available on the Registry page
Do not use this method if:
- Your codemods target a closed source package/repository
- Your codemods are generic in that they do not target any particular package
- Your codemods should be close sourced or contain sensitive data
2. Add Hypermod to an existing package
For existing npm packages (like react), you have the option to expose codemods directly from the package by simply creating a hypermod.config.js
at either the root, /src
or /codemods
directory.
Given that the config and codemod files are then published and available on NPM, hypermod
will be able to find and run codemods using the --package
flag.
Use this method if you want:
- Open or closed sourced packages
- To get up and running with an existing package with very little overhead
- Control over where and how your hypermod package is hosted
- Control over tooling, dependencies and techstack
- To remove a previously created
jscodeshift
cli wrapper and instead use the generichypermod
cli
Do not use this method if:
- You want docs to be automatically generated and available on the Registry page
3. Create a stand-alone Hypermod package
Hypermod packages can be created as a stand-alone package.
Please see the External Packages guide for more information.
Use this method if you want:
- Open or closed sourced packages
- Control over where and how your hypermod package is hosted
- Control over tooling, dependencies and techstack
- The option to create completely generic codemods that don't target specific packages
Do not use this method if:
- Your codemods target a closed source package/repository