core
core copied to clipboard
feat: add getTsMorphProject method
PR is targetting #4412 and depends on https://github.com/adonisjs/assembler/pull/74
Two things :
-
add a
getTsMorphProject()method onCodemodsclass. so that users can make their own codemods as explained in https://github.com/adonisjs/assembler/pull/74export async function configure(command: Configure) { const codemods = await command.createCodemods() const project = await codemods.getTsMorphProject() // can do whatever I want project.getSourceFileOrThrow('file.ts').addImportDeclaration({ moduleSpecifier: 'ts-morph', namedImports: ['Project'], }) } -
Refactoring the Codemods class so as to create just one instance of
ts-morphandCodeTransformer. Creating an instance ofts-morphis a costly operation