Skip to content

Commit 17005be

Browse files
committed
setup vitest and first pkg
1 parent 19ab636 commit 17005be

File tree

13 files changed

+1468
-31
lines changed

13 files changed

+1468
-31
lines changed

.github/actions/quality-check/action.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/quality-check.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ jobs:
2828
env:
2929
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3030

31-
- name: 'Check code quality'
32-
uses: ./.github/actions/quality-check
33-
env:
34-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
- name: 'Lint'
32+
run: pnpm lint
33+
34+
- name: 'Run tests'
35+
run: pnpm test
3536

3637
- name: 'Build project'
3738
run: pnpm build

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
This is a template for a monorepo library.
44

5-
## Requirements
5+
This stack uses:
66

77
- Node.js (runtime)
8-
- Bun (tests, scripts)
9-
- pnpm (package manager)
8+
- Bundler: tsup + esbuild
9+
- Package manager: pnpm
10+
- Testing: vitest
11+
- Linting and formatting: stricter tsconfig rules, prettier, sort-package-json, publint
12+
- Circular dependency detection: madge
1013

1114
## Features
1215

package.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,26 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6-
"build": "echo 'TODO'",
7-
"dev": "echo 'TODO'",
6+
"build": "pnpm -r run build",
7+
"dev": "pnpm -r --parallel run dev",
88
"format": "bun run --bun prettier --write README.md .github/ ./packages && bun run format:pkg",
9-
"format:lint": "bun run --bun prettier --check README.md .github/ ./packages",
10-
"format:pkg": "sort-package-json package.json packages/*/package.json",
11-
"lint": "bun run --run typecheck && bun run --run format:lint && bun run lint:circular-deps",
12-
"lint:circular-deps": "bun run --bun madge --circular --extensions ts,tsx packages/",
9+
"format:pkg": "bun run --bun sort-package-json package.json packages/*/package.json",
10+
"lint": "bun run --run typecheck && bun run --run lint:prettier && bun run lint:madge",
11+
"lint:madge": "bun run --bun madge --circular --extensions ts,tsx packages/",
12+
"lint:prettier": "bun run --bun prettier --check README.md .github/ ./packages",
1313
"prepare": "bun run format:pkg",
14-
"test": "echo 'TODO: bun test packages/'",
15-
"typecheck": "echo 'TODO: bun run --bun tsc'",
14+
"test": "vitest --run",
15+
"test:watch": "vitest",
16+
"typecheck": "pnpm -r run typecheck",
1617
"update-deps": "pnpm -r up --latest --save",
1718
"postupdate-deps": "pnpm install && echo 'Installed dependencies again to apply overrides.'"
1819
},
1920
"devDependencies": {
2021
"madge": "^8.0.0",
2122
"prettier": "^3.5.3",
2223
"sort-package-json": "^3.0.0",
23-
"typescript": "^5.8.2"
24+
"typescript": "^5.8.2",
25+
"vitest": "^3.0.9"
2426
},
2527
"packageManager": "pnpm@10.7.0",
2628
"engines": {

packages/.gitkeep

Whitespace-only changes.

packages/demo/package.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "@pizzajs/demo-pkg",
3+
"version": "0.0.1",
4+
"description": "Demo package",
5+
"homepage": "https://github.com/pizzajsdev/template-monorepo-libs#readme",
6+
"bugs": {
7+
"url": "https://github.com//pizzajsdev/template-monorepo-lib/issues"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/pizzajsdev/template-monorepo-lib.git"
12+
},
13+
"license": "MIT",
14+
"type": "module",
15+
"exports": {
16+
".": {
17+
"types": "./dist/index.d.ts",
18+
"import": "./dist/index.js",
19+
"default": "./dist/index.js"
20+
}
21+
},
22+
"main": "./dist/index.js",
23+
"types": "./dist/index.d.ts",
24+
"files": [
25+
"dist"
26+
],
27+
"scripts": {
28+
"build": "rm -rf dist && tsup --clean",
29+
"postbuild": "publint",
30+
"dev": "tsup --watch",
31+
"typecheck": "tsc --noEmit"
32+
},
33+
"dependencies": {},
34+
"devDependencies": {
35+
"@types/node": "^22.13.13",
36+
"publint": "^0.3.9",
37+
"tsup": "^8.4.0",
38+
"typescript": "^5.8.2"
39+
},
40+
"publishConfig": {
41+
"access": "public",
42+
"registry": "https://npm.pkg.github.com"
43+
}
44+
}

packages/demo/src/demo.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { expect, it } from 'vitest'
2+
import { pizzajsDemoPkg } from './index'
3+
4+
it('pizzajsDemoPkg', () => {
5+
expect(pizzajsDemoPkg()).toBe('Hello, world!')
6+
})

packages/demo/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function pizzajsDemoPkg(): string {
2+
return 'Hello, world!'
3+
}

packages/demo/tsconfig.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"include": ["src/**/*"],
4+
"compilerOptions": {
5+
"rootDirs": ["."],
6+
"baseUrl": ".",
7+
"paths": {
8+
"@/*": ["./src/*"]
9+
}
10+
}
11+
}

packages/demo/tsup.config.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { type Options, defineConfig } from 'tsup'
2+
3+
const config: Options = {
4+
entry: {
5+
index: './src/index.ts',
6+
},
7+
outDir: './dist',
8+
format: ['esm'],
9+
target: 'es2020',
10+
ignoreWatch: ['**/dist/**', '**/node_modules/**', '*.test.ts'],
11+
// clean: true,
12+
dts: true,
13+
sourcemap: true,
14+
splitting: true,
15+
treeshake: true,
16+
minify: false,
17+
skipNodeModulesBundle: true,
18+
external: ['node_modules'],
19+
}
20+
21+
export default defineConfig([config])

0 commit comments

Comments
 (0)