
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
codemod-cli
Advanced tools
codemod-cli is a command line tool for generating, testing, and publishing codemods.
npm install --global codemod-cli
# OR
yarn global add codemod-cli
The codemod-cli
workflow is focused on managing a group of codemods.
To get started you first need a project. You can generate a new codemod-cli project via:
codemod-cli new <project-name>
This will create a small project structure (README.md
, package.json
, etc) which is
ready to help you manage your codemods.
Once you have a project, you can generate a new codemod:
codemod-cli generate codemod <name of codemod>
This will setup a new jscodeshift codemod within your project at transforms/<name of codemod>/index.js
along with a test harness, README, fixture directory, and an initial set of input/output fixtures.
Once you have tweaked your codemod and its fixtures to your liking, it is time to run your tests:
codemod-cli test
As you develop your codemod you may need additional fixtures (e.g. to test various combinations of inputs). To generate a new fixture, run the following:
codemod-cli generate fixture <name of codemod> <name of fixture>
This sets up two new files in transforms/<name of codemod>/__testfixtures__/
using the fixture name
you provided. These fixtures are used by the testing harness to verify that your codemod is working properly.
Once you have things just how you like them with your new codemod (and your tests are passing :wink:) you can update your project's README and your transforms README via:
codemod-cli update-docs
By default the bin script that is generated for your codemod-cli
project will run against .js
and .ts
files.
If you'd like to change that (e.g. to run against .hbs
or .jsx
files) you can tweak your projects bin/cli.js
script
to add --extensions=hbs,jsx
:
#!/usr/bin/env node
'use strict';
require('codemod-cli').runTransform(
__dirname,
process.argv[2], /* transform name */,
process.argv.slice(3), /* paths or globs */
'hbs,jsx'
)
git clone git@github.com:rwjblue/codemod-cli.git
cd codemod-cli
yarn
yarn lint:js
yarn lint:js --fix
yarn test
This project is licensed under the MIT License.
FAQs
a command line tool for generating, testing, and publishing codemods
We found that codemod-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.