sparse-intern-71089
03/02/2022, 6:16 PMgreat-queen-39697
03/02/2022, 8:54 PMmain
option in the config really does expect the code to be in the same directory (it's following where Pulumi.yaml
is, if I remember correctly). I'm double-checking to find out if there's a different way.agreeable-eye-87399
03/02/2022, 9:02 PMPulumi.yaml
(and associated stack config files) in the root directory, and set the main:
option in Pulumi.yaml
to point to a subdirectory.
however, Simon is right that the tsconfig.json
, etc, would all be in the subdirectory.
I think that ultimately this is just the same way you would configure a typescript program.
I haven’t played with this yet, but perhaps this is a path to success?
https://www.typescriptlang.org/tsconfig#rootDiragreeable-eye-87399
03/02/2022, 9:04 PMagreeable-eye-87399
03/02/2022, 9:09 PMmain:
setting in the config is for)adorable-gpu-98268
03/02/2022, 9:10 PMadorable-gpu-98268
03/02/2022, 9:10 PMadorable-gpu-98268
03/02/2022, 9:10 PMadorable-gpu-98268
03/02/2022, 9:12 PMadorable-gpu-98268
03/02/2022, 9:13 PMadorable-gpu-98268
03/02/2022, 9:15 PMadorable-gpu-98268
03/02/2022, 9:15 PM../../
hmmmadorable-gpu-98268
03/02/2022, 9:17 PMpulumi
from my toplevel folder
• I have other code in the repo (non-typescript)
• I have pulumi helper and test filesagreeable-eye-87399
03/02/2022, 10:50 PMmain:
pattern works. I am actually working on some docs and a blog post about this.
I'll get you some examples tomorrow if that's okay? I'm heading to dinner now :)adorable-gpu-98268
03/03/2022, 6:19 AMsrc
folder under which your index.ts
and other code lives. That doesn’t seem possible with pulumi.adorable-gpu-98268
03/03/2022, 6:20 AMadorable-gpu-98268
03/03/2022, 6:22 AM/Pulumi.yaml
/Pulumi.prod.yaml
/package.json
/package-lock.json
/tsconfig.json
/jest.config.js
/src/index.ts
/src/index.test.js
/src/helper.ts
/src/helper.test.ts
/src/....[etc]
adorable-gpu-98268
03/03/2022, 6:25 AM*ts
and `*.test.ts`source files
• call npm
jest
and pulumi
at the top level directoryadorable-gpu-98268
03/03/2022, 6:32 AM{
"app": "npx ts-node bin/hello-cdk.ts"
}
and also in pulumi for go
I could specify a binary
or know that it’s run with go run
but for typescript my options seem limited: It’s not documented how typescript is invoked by pulumi and I seem only to have the option to change the directory with main
, not change what is actually invoked.adorable-gpu-98268
03/03/2022, 6:36 AMnpm run
” and when creating a typescript template then pulumi could have "run": "ts-node ./index.ts"
in the "scripts"
section in "package.json"
. This way it would be very clear what is happening.adorable-gpu-98268
03/03/2022, 6:45 AMcdk
and have the full invocation in the config. I think that would actually be the best optionadorable-gpu-98268
03/03/2022, 7:02 AM"main": "bin/index.js"
in package.json
and compiling with tsc
before using pulumi. That seems to defeat the purpose of using ts-node
though, as I now have an extra build step.