-
Notifications
You must be signed in to change notification settings - Fork 1
feat(DAPP-7450): add typescript build command to compile #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
jeffrifwaldsmartcontract
commented
Sep 26, 2025
- Adds shared build command for deploy/simulate workflows.
409c4dc
to
8956203
Compare
|
||
// Gets a build command for either Golang or Typescript based on the filename | ||
func GetBuildCmd(inputFile string, outputFile string, rootFolder string) *exec.Cmd { | ||
isTypescriptWorkflow := strings.HasSuffix(inputFile, ".ts") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not safe after this change: https://github.com/smartcontractkit/cre-cli/pull/36/files#r2382877260
cc @timothyF95 who is working on providing a path instead of the main.go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeffrifwaldsmartcontract for typescipt, do we have to specify the x.ts file or it is okay to just give the path of the workflow directory where the x.ts lives? Relevant ticket: https://smartcontract-it.atlassian.net/browse/DEVSVCS-2420
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can adapt this to however Go wants to ultimately address figuring out what the input file is. Right now the inputFile is read from the command line, so examining that filename is the easiest.
Looking at the proposals, maybe we can instead just read the directory and see if main.go or main.ts exists in the folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if you think this is OK for now or if we want to wait on this until those other tickets are resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we go with the directory approach, what if there are multiple ts files in the directory? For go, it compiles and build the whole directory, so it doesnt matter. I am not sure about TS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'll need to see how the Go compile command will ultimately be utilized. It is certainly possible to scan a directory tree for ts files, but is there something inherently special about the file name main.go or main.ts in those directories?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, how do we figure out the workflow entry point when dealing with a directory? I might have a bunch of scripts sitting around with .ts extensions that I don't want compiled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The refactor LG. I left a minor comment on naming, and one for confirmation.
|
||
// Gets a build command for either Golang or Typescript based on the filename | ||
func GetBuildCmd(inputFile string, outputFile string, rootFolder string) *exec.Cmd { | ||
isTypescriptWorkflow := strings.HasSuffix(inputFile, ".ts") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeffrifwaldsmartcontract for typescipt, do we have to specify the x.ts file or it is okay to just give the path of the workflow directory where the x.ts lives? Relevant ticket: https://smartcontract-it.atlassian.net/browse/DEVSVCS-2420
788638c
to
a66ba9c
Compare