Skip to main content

Built and signed on GitHub Actions

CodeMod Toolkit is a powerful utility for applying modifications to files, specifically designed for JavaScript and TypeScript projects.

This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
82%
Published
2 weeks ago (0.3.4)

jsr  

# CodeMod Toolkit

CodeMod Toolkit is a powerful utility designed to streamline file modifications in JavaScript and TypeScript projects. Whether you're rewriting import statements, modifying JSON configuration files, or transforming TypeScript files, this toolkit offers a comprehensive API to apply changes efficiently. With support for multiple runtimes (Node.js, Deno, browsers, etc.), it provides flexibility across environments and ensures compatibility with modern ecosystems.

Features

  • Flexible File Patching: Modify text, JSON, and TypeScript files with ease.
  • Cross-Runtime Compatibility: Works in Node.js, Deno, and browser environments.
  • TypeScript Support: Use the ts-morph library to safely modify TypeScript files.
  • Contextual File System Operations: Integrated file system helpers to manage file changes.
  • Custom CodeMod Context: Use a context-aware API to add custom operations and patches.

Usage

import { codeMod, rewriteImports } from "@deco/codemod-toolkit";

const symbolMap = {
  "old-module": {
    "oldExport": {
      moduleSpecifier: "new-module",
    },
  },
};

await codeMod({
  name: "Rewrite Imports",
  description: "Rewrites import statements based on a symbol map",
  targets: [rewriteImports(symbolMap)],
});
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add jsr:@deco/codemod-toolkit

Import symbol

import * as mod from "@deco/codemod-toolkit";

---- OR ----

Import directly with a jsr specifier

import * as mod from "jsr:@deco/codemod-toolkit";

Add Package

npx jsr add @deco/codemod-toolkit

Import symbol

import * as mod from "@deco/codemod-toolkit";

Add Package

yarn dlx jsr add @deco/codemod-toolkit

Import symbol

import * as mod from "@deco/codemod-toolkit";

Add Package

pnpm dlx jsr add @deco/codemod-toolkit

Import symbol

import * as mod from "@deco/codemod-toolkit";

Add Package

bunx jsr add @deco/codemod-toolkit

Import symbol

import * as mod from "@deco/codemod-toolkit";