dreamit-de / graphql-server-base

Base package for @dreamit/graphql-server
MIT License
1 stars 1 forks source link

Use tsup as bundler #73

Closed Shinigami92 closed 8 months ago

Shinigami92 commented 8 months ago

Use https://github.com/egoist/tsup#tsup as bundler, so the bundling process is faster, more stable and provide the possibility to serve cjs + esm at the same time.

I will create a PR to demonstrate it.


I also want to introduce vitest instead of jest, and tsup and vitest share similar dependencies, which results in smaller node_modules/sub-dependencies.

However vitest doesn't make sense in this repo, because there are not tests at all 🤔

sgohlke commented 8 months ago

Use https://github.com/egoist/tsup#tsup as bundler, so the bundling process is faster, more stable and provide the possibility to serve cjs + esm at the same time.

I will create a PR to demonstrate it.

I also want to introduce vitest instead of jest, and tsup and vitest share similar dependencies, which results in smaller node_modules/sub-dependencies.

However vitest doesn't make sense in this repo, because there are not tests at all 🤔

For vitest I think https://github.com/dreamit-de/otel-json-logger might be a good project to try it out. It has just one test class but many features we use in other projects are used here.

When I think of vite or vitest I thought frontend projects might benefit most of it. I don't know if and what benefits it might provide, so a PoC/MR to try it out might give some answers. Especially points like developer experience I have to try out myself.

Shinigami92 commented 8 months ago

For vitest I think dreamit-de/otel-json-logger might be a good project to try it out. It has just one test class but many features we use in other projects are used here.

I will look into it :+1:

When I think of vite or vitest I thought frontend projects might benefit most of it. I don't know if and what benefits it might provide, so a PoC/MR to try it out might give some answers. Especially points like developer experience I have to try out myself.

You are right about Vite :+1:
Vite is a bundler for mainly frontend and additionally have the "lib"-mode with that you can create e.g. UI Component Libraries However vitest is a full replacement for jest (& mocha & chai) which even brings its compatibility layer, so if you are lucky, you can 1-to-1 replace jest with vitest and just swap the imports vitest is a highly optimized testing framework with which you can e.g. run tests in isolation and parallel out of the box jest has that too to some kind, but is slower and "more outdated" vitest uses Vite under the hood for its HMR support in watch-mode vitest is not a UI testing tool, but a JS/Node testing tool

as an example, you could have a look into some of my projects like

as you can see, non of these are frontend related and are pure Node projects