reads a script from source and allows analysis via jscodeshift. This does not write to the file afterwards.
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
the transformed source
import { js } from 'ember-apply';await js.analyze('path/to/file.js', ({ root, j }) => { root .find(j.ImportDeclaration) .forEach(path => { // do some analysis on the found AST Nodes }) }); Copy
import { js } from 'ember-apply';await js.analyze('path/to/file.js', ({ root, j }) => { root .find(j.ImportDeclaration) .forEach(path => { // do some analysis on the found AST Nodes }) });
reads a script from source and allows analysis via jscodeshift. This does not write to the file afterwards.
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.