how exactly is the typescript compile triggered? I...
# typescript
f
how exactly is the typescript compile triggered? Is there any way to further configure, e.g. a script in package.json? still looking for best way to deal with referenced projects
w
how exactly is the typescript compile triggered?
Pulumi uses
ts-node
(https://www.npmjs.com/package/ts-node) by default to compile files on the fly as they are `require`d by Node.js. You can disable this - or just pre-compile your TypeScript to JavaScript and point at a JavaScript entrypoint. See https://www.pulumi.com/docs/intro/languages/javascript/#disabling-built-in-typescript-support.
Is there any way to further configure, e.g. a script in package.json?
I believe you would need to take over the compilation process yourself to support this. There is currently no way for
pulumi up
to invoke your build in this case though, so you would need separate "build" and "deploy" steps.
still looking for best way to deal with referenced projects
What exactly is the issue with referenced projects?
f
hmmm, any idea on how to get ts-node to handle referenced projects?
I have split out my infrastructure into multiple projects and a common package for shared code, using yarn workspaces, but I wanna be able to just do
pulumi up
without worrying about having referenced projects (e.g. common) build manually
w
I’m not exactly clear on what aspect of Yarn workspace referenced projects doesn’t work. Do you have some manual build step somewhere? Vanilla use of yarn workspaces should work fine here.
f
TypeScript referenced projects (unrelated to yarn workspaces): https://www.typescriptlang.org/docs/handbook/project-references.html. This allow me tell a sub-project that it depends on e.g. the common module, and then tsc will make sure common is compiled and up-to-date if invoked as
tsc -b
It was my hope that I could somehow convince pulumi to do this, so that I could just go to any sub-project and do
pulumi up
and it would automatically also compile any needed dependency projects
but maybe there is another way of handling multi projects with shared components in pulumi ts?