Skip to content

Commit

Permalink
refactor(docs): more elaborate writing for the build packages doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ixahmedxi committed Jun 12, 2024
1 parent a7787f8 commit 3381cc7
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions apps/docs/decision-reasoning/why-all-built.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ Typically, a package using this approach would be called an "Internal package".

- **Slow TS LSP**: Let's imagine you have an `api` package that uses TS heavy libraries like `tRPC`, `drizzle-orm` add a bit of `zod` here and there. As your API grows more complex, the TS LSP (Language Server Protocol) will start taking hits. This is because TypeScript is so much faster at evaluating the `.js` and `.d.ts` combination than pure source `.ts` files.

<Note>
If your package is being used in any way by a consumer that references the TS
source files, for example even using the `paths` option in the `tsconfig.json`
file, you will be taking an LSP hit.
</Note>
<Warning>
It is not uncommon to see the TS LSP taking 1.5-3 seconds for every
autocompletion suggestion to come up, the same goes for error reporting. This
absolutely kills your productivity, and switching to building those packages
immediately fixes it.
</Warning>

**In essence, if your consumer is referring to your package's TS source files, there will be a ceiling to hit where the TS LSP will start slowing down.**

### Transpiling the TS code to JS

Expand Down Expand Up @@ -86,15 +89,15 @@ To minimise the amount of processes running during dev we can do something like:
This looks something like this, if we were to be making api changes for example:

```bash
bun turbo dev --filter=!./packages/config/* --filter=!@orbitkit/docs --filter=!@orbitkit/marketing --filter=!@orbitkit/ui --only
bun turbo dev --filter=@orbitkit/web... --filter=!./packages/config/* --filter=!@orbitkit/ui --only
```

It is true that this is a really long command, but we can make it shorter by adding it to the root `package.json` scripts like so:

```json
{
"scripts": {
"dev:web:api": "bun turbo dev --filter=!./packages/config/* --filter=!@orbitkit/docs --filter=!@orbitkit/marketing --filter=!@orbitkit/ui --file --only"
"dev:web:api": "bun turbo dev --filter=@orbitkit/web... --filter=!./packages/config/* --filter=!@orbitkit/ui --only"
}
}
```
Expand Down

0 comments on commit 3381cc7

Please sign in to comment.