reads a script from source and transforms it with jscodeshift and then writes the file.
The https://astexplorer.net/ REPL can be used to inspect and test out how to transform javascript and typescript files.
For javascript, the babel parser is used. For typescript, the ts parser is used.
babel
ts
to the file to transform
Optional
import { js } from 'ember-apply';await js.transform('path/to/file.js', ({ root, j }) => { root .find(j.Identifier) .forEach(path => { j(path).replaceWith( j.identifier(path.node.name.split('').reverse().join('')) ); }) }); Copy
import { js } from 'ember-apply';await js.transform('path/to/file.js', ({ root, j }) => { root .find(j.Identifier) .forEach(path => { j(path).replaceWith( j.identifier(path.node.name.split('').reverse().join('')) ); }) });
reads a script from source and transforms it with jscodeshift and then writes the file.
The https://astexplorer.net/ REPL can be used to inspect and test out how to transform javascript and typescript files.
For javascript, the
babel
parser is used. For typescript, thets
parser is used.