https://pulumi.com logo
#typescript
Title
# typescript
f

famous-jelly-72366

06/02/2020, 3:39 PM
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

white-balloon-205

06/02/2020, 3:47 PM
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

famous-jelly-72366

06/02/2020, 5:55 PM
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

white-balloon-205

06/03/2020, 2:12 AM
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

famous-jelly-72366

06/03/2020, 6:42 AM
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?