Registry / devops / forest-codemod

forest-codemod

JSON →
library1.0.0-beta.1jsnpmunverified

Forest Codemod is a tool for automated migration of ForestAdmin agent configurations, currently at version 1.0.0-beta.1. It is designed to assist in transitioning between major ForestAdmin agent versions by applying codemod transformations. The package is in beta, meaning APIs may change. It differentiates itself by focusing specifically on ForestAdmin agent migrations, providing a streamlined CLI experience for developers upgrading their ForestAdmin backend setups.

npm install forest-codemod
INSTALL
IMPORT
SIG · FOREST-CODEMOD
F
forest-codemod
devopsjavascriptv1.0.0-beta.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import forestCodemod from 'forest-codemod'
const forestCodemod = require('forest-codemod')
ESM-only package since v1.0.0-beta.1
ForestCodemod
import { ForestCodemod } from 'forest-codemod'
import ForestCodemod from 'forest-codemod'
Named export for class-based usage
runMigration
import { runMigration } from 'forest-codemod'
Utility function for programmatic migration

Demonstrates programmatic migration of a ForestAdmin agent configuration file from v1 to v2 using the runMigration function.

import { runMigration } from 'forest-codemod'; import path from 'path'; const config = { source: path.resolve('./agent-config.js'), dest: path.resolve('./agent-config-v2.js'), transform: 'v1-to-v2', }; runMigration(config) .then(() => { console.log('Migration completed successfully'); }) .catch((err) => { console.error('Migration failed:', err); });
Debug
Known issues
deprecatedThe 'transform' option 'v1-to-v2' is deprecated and will be removed in version 2.0.0. Use 'upgrade-v1' instead.
fix
Replace 'v1-to-v2' with 'upgrade-v1' in the transform option.
affects: >=1.0.0-beta.1 <1.3.0
breakingThe 'source' and 'dest' options are now required. In older beta versions, they were optional and defaulted to current directory.
fix
Ensure both 'source' and 'dest' are provided when calling runMigration.
affects: >=1.0.0-beta.1
gotchaThe codemod modifies files in-place if 'dest' is not specified. Always provide a 'dest' to prevent data loss.
fix
Always set the 'dest' option to a different file path.
affects: >=1.0.0-beta.1
Errors
Common errors & fixes
Error: Cannot find module 'jscodeshift'
jscodeshift is a peer dependency not installed
fix
npm install jscodeshift --save-dev
TypeError: runMigration is not a function
Importing incorrectly, using default import instead of named import
fix
Use 'import { runMigration } from 'forest-codemod''
Error: Unknown transform 'v1-to-v2'
Using deprecated transform name that has been removed
fix
Use 'upgrade-v1' instead
Upgrade
Version history
1.0.0-beta.1latest on npm
Audit
Dependencies
jscodeshiftrequiredcore transformation engine
Agent activity
6 hits · last 30 days
node
6
Resources
forest-codemod — npm install forest-codemod · libregistry