upleveled / preflight

Preflight checks for your UpLeveled projects before you submit 🚀
https://www.npmjs.com/package/@upleveled/preflight
MIT License
14 stars 3 forks source link

Migrate off tsdx #126

Closed karlhorky closed 1 month ago

karlhorky commented 3 years ago

tsdx was a nice idea, but it's no longer maintained.

Time to come up with our own solution for this, maybe using:

karlhorky commented 2 years ago

Wonder if this starter could offer us any tips: https://github.com/egoist/ts-lib-starter

karlhorky commented 2 years ago

Or, also consider moving to one of:

Some all-in-one solutions like scaffoldres may offer some inspiration as well (although I guess moving completely to them may have problems similar to tsdx, if they become less maintained):

karlhorky commented 2 years ago

Maybe just use tsc alone: https://cmdcolin.github.io/posts/2022-05-27-youmaynotneedabundler

karlhorky commented 2 years ago

Maybe another example, this one using esbuild (and Turborepo!): https://github.com/mmazzarolo/tangerine-monorepo

karlhorky commented 1 year ago

Examples of switching to tsup:

karlhorky commented 1 year ago

Another reason to switch:

During the switch from Yarn to pnpm (#379 ), we also had to add some additional weird configuration:

.github/workflows/build-lint-test.yml

      - name: Check types
        run: |
          pnpm tsc --project __tests__/tsconfig.json
          pnpm tsc --project bin/tsconfig.json
          pnpm tsc --project docker/tsconfig.json
          pnpm tsc --project tsconfig.config.json
Screenshot 2023-04-14 at 10 27 31
ProchaLu commented 1 year ago

My reason for switching: After encountering issues with TSDX and switching to pnpm in PR https://github.com/upleveled/preflight/pull/379, we must consider migrating away from TSDX as a solution. Currently, we are using node-linker=hoisted as a temporary workaround, but this may not be a long-term solution.

Different solutions without switching what I tried were to use rollup-plugin-typescript2 package to version 0.32.0 in my package.json file using PNPM's overrides feature.

  "pnpm": {
    "overrides": {
      "rollup-plugin-typescript2": "^0.32.0"
    }
  }

However, this approach resulted in a semantic error. I also explored other workarounds, such as using shamefully-hoist=true with pnpm, but this caused another error related to untyped function calls not accepting type arguments.

I have described these different solutions in detail in this comment

karlhorky commented 1 month ago

Another option would be to just publish TypeScript, and use node --experimental-strip-types to run Preflight (no build step)