CLI - codegen command now supports the --watch option#1584
CLI - codegen command now supports the --watch option#1584dOrgJelli merged 3 commits intoorigin-devfrom
--watch option#1584Conversation
krisbitney
left a comment
There was a problem hiding this comment.
This is a great feature! Very cool stuff. 😁
| const execute = async (): Promise<boolean> => { | ||
| let result = false; | ||
|
|
||
| try { |
There was a problem hiding this comment.
There is already a try-catch block within codeGenerator.generate() that catches and logs any errors, so the try-catch block in codegen.ts will log the errors a second time.
https://github.com/polywrap/toolchain/blob/origin-dev/packages/cli/src/lib/codegen/CodeGenerator.ts
There was a problem hiding this comment.
Hmmm, this try/catch logic is also in the build command. Honestly I think it's alright to log more than once, and it might be best to remove the try/catch from within the lib layer. Thoughts?
There was a problem hiding this comment.
Yeah, either way is good. I prefer removing the try-catch from the lib layer if there are no side effects from doing that, but I'd also be happy merging this as-is.
dOrgJelli
left a comment
There was a problem hiding this comment.
Looks great! Waiting for @krisbitney's approval regarding logging practices.
Resolves #1459
You can now run
npx polywrap codegen --watchwhich will automatically watch files within your project directory and re-run codegen whenever changes are detected.