Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

carbon-codemod

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

carbon-codemod

carbon-codemod

  • 1.10.1
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

carbon-codemod !build npm

This is a collection of codemods that help you upgrade to a new version of carbon-react. The release notes of carbon-react will indicate which codemod you should use.

Usage

npx carbon-codemod <name-of-codemod> <target>

Note that <target> is worked out relative to the current working directory.

Development

carbon-codemod is a wrapper around jscodeshift.

Running locally

  • npm link
  • cd my-other-project
  • npm link carbon-codemod
  • npx carbon-codemod <name-of-codemod> <target>

Debugging

To debug the CLI

  • node --inspect-brk ./bin/carbon-codemod
  • Open the command palette and select "> Debug: Attach to Node Process (preview)"
  • You can add addition arguments as required e.g. node --inspect-brk ./bin/carbon-codemod --version

It's also possible to debug the tests

  • Open the spec file
  • Use Run Current Spec in the "Run" pane
  • You can use the "Debug Console" to interact with the debugger

You can use astexplorer.net to help understand the existing structure of files. You should use the following settings:

  • parser: esprima
  • transform: jscodeshift

Transformation Status

The return value of the function determines the status of the transformation:

StatusConditionSuccessful
okA string is returned and it is different from passed source:white_check_mark:
skippedIf nothing is returned, the file is not supposed to be transformed:white_check_mark:
unmodifiedIf a string is returned but it's the same as the source:x:
errorIf the transform throws an Exception:x:

Testing

  • npm test
  • It's important to test that each codemod is idempotent.
  • Use defineTest to write new tests, this will create a fixture test and an idempotent test.

Releasing

  • This project publishes using semantic-release.
  • It follows conventional commits.
  • When a pull request is merged to master Github Actions will run semantic-release.
  • semantic-release will decide, based on the commits that have been merged, if a new release is required.
  • If a new release is required, a new version will be published to npm and GitHub releases.

Keywords

FAQs

Package last updated on 18 May 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc