Anyone using microstacks and common code in a type...
# general
i
Anyone using microstacks and common code in a typescript monorepo? e.g. we have common code across stacks that should be reused. Are you using yarn workspaces? yarn link? tsconfig paths?
I’m attempting to use tsconfig paths, it appears I needed to yarn install with:
Copy code
"resolutions": {
    "cloud-common": "workspace:*"
  }
tsc was unhappy without the
yarn install
first, just wondering what others are doing with common code that is unpublished…
I’m still trying to iron out tsc/path errors, but curious if others are using separated project/common code amongst stacks and the method used
l
tsconfig paths are working, for the versions from the last couple of months iirc.
👍 1
b
We are using Turborepo with yarn workspaces to manage our monorepo. It currently has close to 10 Pulumi stacks, each implemented as a distinct Node package and most of them consume a shared "utilities" library.
👍 1
i
I did figure out a trick, setting up the
package.json
like this works for
lint
,
tsc
, and
pulumi
without having to run an explicit build (use src ts only), making it far more convenient:
Copy code
"main": "src/index.ts",
  "typings": "src/index.ts",
^^ also doing it this way with yarn workspaces, I did not need any tsconfig paths. I add a top level
resolutions: { "my-shared-pkg": "workspace:*" }
and good to go
321 Views