sst / ion

SST v3
https://sst.dev
MIT License
2.11k stars 247 forks source link

Configure `sst-env.d.ts` generation #1093

Open oscartbeaumont opened 4 weeks ago

oscartbeaumont commented 4 weeks ago

It would be great to be able to disable the generation of sst-env.d.ts for a specific package or a group of packages mostly likely by having a configurable exclude pattern.

For example my monorepo at it's root has:

By the current SST logic everything in packages/* gets given an sst-env.d.ts even though I would rather it not have one.

In practice I don't want anything in packages directly touching the infrastructure as they are designed to be self-contained packages such as what would potentially be publishable to npm. Not having the types helps to force separatation and cleans up the Git diff everytime a resource with links is changed in SST.

Broken out from my comment in #1017.

paolostyle commented 3 weeks ago

We have the same problem. What would be even better if SST was somehow able to generate sst-env.d.ts tailored for each package (I guess based on handler paths and their links? I can imagine it's quite tricky to do it right) - it's pretty annoying that every change in SST config results in like 20 changed files even though it realistically only affects one package.

An alternative solution that would work for my team - make it possible to generate sst-env files without deploying anything. I don't know if it's possible, but I think it should be, sst shell seems to have all these values, but it doesn't generate sst-envs. That way I could just add sst-env.d.ts to .gitignore and run that hypothetical command in CI.