@codecompose/mono-ts
Advanced tools
Comparing version
{ | ||
"name": "@codecompose/mono-ts", | ||
"description": "A quest for the ideal TS monorepo setup", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"keywords": [ | ||
@@ -30,22 +30,24 @@ "typescript", | ||
"devDependencies": { | ||
"firebase-tools-with-isolate": "13.29.1-2", | ||
"firebase-tools-with-isolate": "14.10.1", | ||
"prettier": "^3.4.2", | ||
"prettier-plugin-jsdoc": "^1.3.2", | ||
"turbo": "^2.3.3", | ||
"typescript": "^5.7.3", | ||
"vercel": "^39.3.0", | ||
"vitest": "^3.0.2" | ||
"turbo": "^2.3.4", | ||
"typescript": "^5.9.2", | ||
"vercel": "^44.7.3", | ||
"vitest": "^3.0.4" | ||
}, | ||
"scripts": { | ||
"compile": "turbo run compile", | ||
"build": "turbo run build", | ||
"build:fns": "turbo run build --filter=@repo/fns", | ||
"build:api": "turbo run build --filter=@repo/api", | ||
"clean": "turbo run clean", | ||
"dev": "turbo run dev", | ||
"check-types": "turbo check-types --continue", | ||
"check-circular": "turbo check-circular --continue", | ||
"build": "turbo build", | ||
"build:fns": "turbo build --filter=@repo/fns", | ||
"build:api": "turbo build --filter=@repo/api", | ||
"clean": "turbo clean", | ||
"dev": "turbo dev", | ||
"deploy": "firebase deploy", | ||
"watch": "turbo watch build --filter=@repo/core --filter=@repo/fns --filter=@repo/api", | ||
"lint": "turbo run lint --parallel", | ||
"test": "turbo run test -- --watch false", | ||
"lint": "turbo lint", | ||
"test": "turbo test -- --watch false", | ||
"format": "prettier --write .", | ||
"check-format": "prettier --check .", | ||
"emulate": "firebase emulators:start --project demo-mono-ts", | ||
@@ -52,0 +54,0 @@ "db:get-indexes": "firebase firestore:indexes > firestore.indexes.json" |
@@ -19,2 +19,3 @@ # Mono TS | ||
- [Secrets](#secrets) | ||
- [Typed Firestore](#typed-firestore) | ||
@@ -49,6 +50,2 @@ <!-- /TOC --> | ||
> For demonstration purposes, mono-ts uses the "internal packages approach" for | ||
> `@repo/common` and a traditional built approach for `@repo/core`. Read below | ||
> for more info. | ||
## Features | ||
@@ -65,8 +62,9 @@ | ||
- ESM everything | ||
- Path aliases | ||
- Shared configurations for ESLint | ||
- Simple standard configuration for TypeScript | ||
- Typescript path aliases (that get resolved in build output) | ||
- Shared configurations for ESLint v9 with strict type-aware rules | ||
- Shared standardized configuration for TypeScript | ||
- Vitest | ||
- Clean, strongly-typed Firestore code for both React (using | ||
`@typed-firestore/react`) and Node.js (using `@typed-firestore/server`) | ||
- Clean, typed Firestore abstractions using | ||
[@typed-firestore/react](https://github.com/0x80/typed-firestore) and | ||
[@typed-firestore/server](https://github.com/0x80/typed-firestore-server) | ||
@@ -84,4 +82,4 @@ ## Install | ||
I recommended using `pnpm` over `npm` or `yarn`. Apart from being fast and | ||
efficient, I believe PNPM has better support for monorepos. | ||
I recommend using `pnpm` over `npm` or `yarn`. Apart from being fast and | ||
efficient, PNPM has better support for monorepos. | ||
@@ -118,19 +116,33 @@ You can install PNPM with `corepack` which is part of modern Node.js versions: | ||
This monorepo used to showcase the "internal packages approach" for | ||
`@repo/common`, as described in the article, which lets you link to sources | ||
directly without a build step. | ||
I removed it because I ran into some issues, and I can not really recommend it. | ||
With the right configuration of incremental builds, references, and build | ||
orchestration, modern build tools seem to work fast and smoothly enough. | ||
### Namespace | ||
Typically in a monorepo, you will never publish the packages to NPM, and because | ||
of that, the namespace you use to prefix your package names does not matter. You | ||
might as well pick a generic one that you can use in every private codebase. | ||
Often in a monorepo, you will never publish the shared packages to NPM or some | ||
other registry, and because of that, the namespace you use to prefix your | ||
package names does not matter. You might as well pick a standard one that you | ||
can use in every project. | ||
At first I used `@mono`, and later I switched to `@repo` when I discovered that | ||
At first I used `@mono`, and later I switched to `@repo` when I encountered that | ||
in the Turborepo examples. I like both, because they are equally short and | ||
clear, but I went with `@repo` because I expect it will become the standard. | ||
clear, but I went with `@repo` because I expect it might become a standard | ||
sooner. | ||
### Packages | ||
- [common](./packages/common) Code that can shared across both front-end and | ||
back-end environments. | ||
- [core](./packages/core) Code that is shared between server environments like | ||
cloud functions. | ||
- [common](./packages/common) Code that is shared across both front-end and | ||
back-end environments simultaneously. | ||
- [core](./packages/core) Code that is only shared between server environments, | ||
like cloud functions, containing mostly "core" business logic. | ||
A standard name for a package that is only shared between client-side apps is | ||
`ui`. Besides sharing UI components, I also use it to share other things that | ||
are solely relevant to the clients. | ||
### Apps | ||
@@ -211,1 +223,11 @@ | ||
file is not checked into git. | ||
## Typed Firestore | ||
This repo uses [@typed-firestore/react](https://github.com/0x80/typed-firestore) | ||
and [@typed-firestore/server](https://github.com/0x80/typed-firestore-server) to | ||
provide typed Firestore abstractions for both React and Node.js. | ||
If you're interested here is an | ||
[in-depth article](https://dev.to/0x80/how-to-write-clean-typed-firestore-code-37j2) | ||
of how they came about. |
12266
10.2%228
10.68%