Skip to content

Commit

Permalink
feat(scaffolding): update README
Browse files Browse the repository at this point in the history
  • Loading branch information
jkomyno committed Sep 16, 2024
1 parent 411bcae commit 24d3247
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Github Actions](https://github.com/jkomyno/pnpm-monorepo-example/actions/workflows/ci.yaml/badge.svg?branch=master)](https://github.com/jkomyno/pnpm-monorepo-example/actions/workflows/ci.yaml)

> Practical example of a `TypeScript` monorepo with [`pnpm`](https://pnpm.io), [`turborepo`](https://turborepo.org), and [`jest`](https://jestjs.io).
> Practical example of a `TypeScript` monorepo with [`pnpm`](https://pnpm.io), [`turborepo`](https://turborepo.org), and [`vitest`](https://vitest.dev/).
---------------------------------------------

Expand All @@ -11,18 +11,18 @@
- `pnpm` workspace, whose configuration is stored in [`pnpm-workspace.yaml`](/pnpm-workspace.yaml). Two example packages are included, [`common-utils`](packages/common-utils) and [`example`](packages/example), with the latter importing `common-utils` as a dependency. All local packages are decorated with a `@jkomyno/*` scope (you may want to substitute these instances in the `name` entries of any `package.json` with yours or your company's name).
- `turborepo`, whose configuration is stored in [`turbo.json`](./turbo.json)
- an example [`Dockerfile`](./Dockerfile.pnpm) that can be built and used as a base image for your Node.js Docker containers.
- the `jest` test engine, whose configuration is stored in the [`packages/jest`](./packages/jest) folder.
- opinionated [`prettier`](https://prettier.io) and [`eslint`](https://eslint.org) setups.
- the `vitest` test engine, whose configuration is stored in [`vitest.workspace.ts`](./vitest.workspace.ts).
- opinionated linting setups via [`biome`](https://biomejs.dev/), whose configuration is defined in the [`biome.jsonc`](./biome.jsonc) file.

## Available Scripts

- `pnpm install`: install the dependencies needed for each package.
- `pnpm build`: transpile the local TypeScript packages to JavaScript.
- `pnpm lint:ci`: check that the code follows the `eslint` guidelines.
- `pnpm prettier-check`: check that the code follows the `prettier` guidelines.
- `pnpm prettier-write`: override the code to follow the `prettier` guidelines.
- `pnpm lint:ci`: check that the code follows the `biome` guidelines.
- `pnpm lint`: check that the code follows the `biome` guidelines, and override it to follow them if possible.
- `pnpm test:unit`: run unit tests.
- `pnpm test:integration`: run integration tests.
- `pnpm test`: run all tests.

## Test Structure

Expand All @@ -31,8 +31,6 @@ All tests should be written in the `__tests__` directory of a local package.
Moreover, unit tests should be placed in the `__tests__/unit` folder; similarly, integration tests should be placed in the `__tests__/integration` folder.
This allows for easily running groups of tests (for instance, you might want to run unit tests locally, while deferring integration tests - that will probably need access to external services like Docker containers - to the CI only).

In each local package's `package.json` file, make sure to replace the `JEST_LIB_UNDER_TEST` environment variable declaration with the local package name, for each `test*` command in the `scripts` section.

## FAQ

1. How do I add a new package to the local workspace?
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"packageManager": "[email protected]",
"pre-commit": "lint-staged",
"lint-staged": {
"*.{js,ts,cjs,mjs,md,json,jsonc}": "biome ci"
"*.{js,ts,cjs,mjs,md,json,jsonc}": "biome ci --no-errors-on-unmatched"
}
}

0 comments on commit 24d3247

Please sign in to comment.