subql icon indicating copy to clipboard operation
subql copied to clipboard

`codegen:generate` Unable to bypass comments in ts manifest

Open bz888 opened this issue 1 year ago • 0 comments

Description

Generate will not be able to filter existing functions/events if there are commented code. As it is using regex to process the ts-manifest. To solve this the best solution is to move away from Regex and instead use the Typescript AST to parse and modify the code.

To do this we can use the Typescript API or possibly even better is ts-morph

Example failing test

This test will be passing once the problem is fixed https://github.com/subquery/subql/blob/f95d987d833649fd6d984df435fef21620576395/packages/cli/src/controller/generate-controller.spec.ts#L582

bz888 avatar Oct 30 '23 01:10 bz888