Skip to content

Pass custom parameters to mutator #1610

Answered by mbwestphal
mbwestphal asked this question in Q&A
Discussion options

You must be logged in to vote

We have accomplished this using jscodeshift (GitHub).

You pass all files to your jscodeshift transform (e.g. transform.cjs) using orvals afterAllFilesWrite setting:

import {run} from 'jscodeshift/src/Runner.js';
// snip
afterAllFilesWrite: [paths => run('./transform.cjs', paths, {parser: 'ts'})]

And in your transform.cjs you find the callee ending with Mutator and you add another argument.

It is kind of rough, but it works and it is not too much additional source code.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mbwestphal
Comment options

Answer selected by mbwestphal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
workaround A workaround has been provided
2 participants