adorable-gpu-98268
03/02/2022, 6:16 PMmain
option in the config but this changes the whole directory, which I don’t want (as then e.g. my tsconfig.json
also has to live in that directory, etc.)
I just want to put my .ts
files under src
to reduce the clutter in the project. Using "main": "src/index.ts"
in package.json
seems to work but that’s rather non-standard, isn’t it?great-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#rootDirmain:
setting in the config is for)adorable-gpu-98268
03/02/2022, 9:10 PM../../
hmmmpulumi
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./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]
*ts
and `*.test.ts`source files
• call npm
jest
and pulumi
at the top level directory{
"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.npm 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.cdk
and have the full invocation in the config. I think that would actually be the best option"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.