Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
// manually bumping
"node",
"@types/node",
"pnpm"
],
"postUpdateOptions": [
"pnpmDedupe"
"bun"
],
"packageRules": [
{
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v6

- uses: pnpm/action-setup@v6
name: Install pnpm
id: pnpm-install
- uses: oven-sh/setup-bun@v2
name: Install bun
with:
run_install: false
bun-version: 1.3.11
Comment thread
magne4000 marked this conversation as resolved.

- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'

- name: mkdir temp folder
run: mkdir -p ${{ runner.temp }}/bati-cache
Expand All @@ -49,13 +47,13 @@ jobs:
${{ runner.os }}-${{ matrix.node }}-nx-

- name: Install dependencies
run: pnpm install
run: bun install

- name: Build packages
run: pnpm run build
run: bun run build

- name: Run check types
run: pnpm run check-types
run: bun run check-types

- name: Run lint
run: pnpm run lint
run: bun run lint
14 changes: 6 additions & 8 deletions .github/workflows/publish-widget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,28 @@ jobs:
git fetch --tags origin
git pull origin ${{ github.ref_name }}

- uses: pnpm/action-setup@v6
name: Install pnpm
id: pnpm-install
- uses: oven-sh/setup-bun@v2
name: Install bun
with:
run_install: false
bun-version: 1.3.11
Comment thread
magne4000 marked this conversation as resolved.

# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v6
with:
# Note: Trusted publishing requires npm CLI version 11.5.1 or later and Node version 22.14.0 or higher.
node-version: '24'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install
run: bun install

- name: Build dependencies
run: pnpm build
run: bun run build

- name: Configure git before publish
run: |
git config --global user.name "Joël Charles"
git config --global user.email "joel.charles91@gmail.com"

- run: pnpm run release-widget:ci
- run: bun run release-widget:ci
working-directory: website
12 changes: 5 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,24 @@ jobs:
git fetch --tags origin
git pull origin ${{ github.ref_name }}

- uses: pnpm/action-setup@v6
name: Install pnpm
id: pnpm-install
- uses: oven-sh/setup-bun@v2
name: Install bun
with:
run_install: false
bun-version: 1.3.11
Comment thread
magne4000 marked this conversation as resolved.

# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v6
with:
# Note: Trusted publishing requires npm CLI version 11.5.1 or later and Node version 22.14.0 or higher.
node-version: '24'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install
run: bun install

- name: Configure git before publish
run: |
git config --global user.name "Joël Charles"
git config --global user.email "joel.charles91@gmail.com"

- run: pnpm run release:ci
- run: bun run release:ci
21 changes: 10 additions & 11 deletions .github/workflows/reusable.init-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ concurrency:

env:
NODE_VERSION: 22
BUN_VERSION: "1.3.11"

jobs:
suite:
Expand All @@ -22,29 +23,27 @@ jobs:
- name: Checkout
uses: actions/checkout@v6

- uses: pnpm/action-setup@v6
name: Install pnpm
id: pnpm-install
- uses: oven-sh/setup-bun@v2
name: Install bun
with:
run_install: false
bun-version: ${{ env.BUN_VERSION }}
Comment thread
magne4000 marked this conversation as resolved.

- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'

- name: Install dependencies
run: pnpm install
run: bun install

- name: Build packages
run: pnpm run build
run: bun run build

- name: Run tests
run: pnpm run test
run: bun run test

- name: Deploy CLI locally
run: pnpm deploy --prod --filter=./packages/cli ./bati-cli
run: bun run scripts/deploy.ts ./packages/cli ./bati-cli

- name: Archive Bati CLI
uses: actions/upload-artifact@v7
Expand All @@ -57,7 +56,7 @@ jobs:
path: ./bati-cli/*

- name: Deploy tests locally
run: pnpm deploy --prod --filter=./packages/tests ./bati-tests
run: bun run scripts/deploy.ts ./packages/tests ./bati-tests

- name: Archive Bati tests
uses: actions/upload-artifact@v7
Expand All @@ -70,7 +69,7 @@ jobs:
path: ./bati-tests/dist/*

- name: Pack tests-utils
run: pnpm pack
run: bun pm pack
working-directory: ./packages/tests-utils

- name: Archive tests-utils
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/reusable.run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ concurrency:

env:
NODE_VERSION: 22
BUN_VERSION: "1.3.11"

jobs:
reusable_workflow_job:
Expand Down Expand Up @@ -48,12 +49,6 @@ jobs:
with:
bun-version: ${{ env.BUN_VERSION }}

- uses: pnpm/action-setup@v6
name: Install pnpm
id: pnpm-install
with:
run_install: false

- name: Download Bati CLI
uses: actions/download-artifact@v8
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests-entry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
needs: init-ubuntu
strategy:
matrix:
# pnpm run test:e2e workflow-write
# bun run test:e2e:workflow-write
Comment thread
magne4000 marked this conversation as resolved.
destination:
- react--plausible.io--eslint--biome--oxlint
- react--google-analytics--eslint--biome--oxlint
Expand Down Expand Up @@ -248,7 +248,7 @@ jobs:
- react--ts-rest--hono--eslint
- react--ts-rest--hono--biome
- react--ts-rest--hono--oxlint
# pnpm run test:e2e workflow-write
# bun run test:e2e:workflow-write
include:
- destination: react--plausible.io--eslint--biome--oxlint
flags: --react --plausible.io --eslint --biome --oxlint
Expand Down
57 changes: 27 additions & 30 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
Bati is a next-generation scaffolding CLI tool for the Vike (Vite-based) ecosystem. It generates fully-functional starter apps by combining boilerplates for different features (React/Vue/Solid, servers, databases, auth, etc.).

**Repository Structure:**
- **TypeScript monorepo** managed with **pnpm workspaces** and **Turborepo**
- Node.js ≥20 required, pnpm 10.24.0 (as specified in package.json `packageManager`)
- **TypeScript monorepo** managed with **bun workspaces** and **Nx**
- Node.js ≥22 required, Bun 1.3.11 (as specified in package.json `packageManager`)
- Workspaces across `/packages/` (~11 packages) and `/boilerplates/` (~42 feature templates)

## Build Commands (Execute in Order)
Expand All @@ -15,38 +15,37 @@ Bati is a next-generation scaffolding CLI tool for the Vike (Vite-based) ecosyst

```bash
# 1. Install dependencies (required before any build)
pnpm install
bun install

# 2. Build all packages (~55 seconds)
pnpm run build
bun run build

# 3. Run unit tests (~15 seconds)
pnpm run test
bun run test

# 4. Run type checking (~60 seconds)
pnpm run check-types
bun run check-types

# 5. Run linting (Biome)
pnpm run lint
bun run lint
```

**Important Notes:**
- `pnpm install` triggers `@batijs/compile` prepublish build automatically
- `pnpm run build` must complete before running tests or CLI
- Build uses Turborepo caching; use `pnpm run build:force` to rebuild without cache
- `bun run build` must be run after `bun install` and before tests or CLI
- Build uses Nx caching; use `bun run build:force` to rebuild without cache
- The `format` step runs automatically after build via Biome

## Testing

```bash
# Unit tests (fast, ~15s)
pnpm run test
bun run test

# E2E tests (extensive, run on CI - not recommended locally due to time)
pnpm run test:e2e
bun run test:e2e

# Filter E2E tests
pnpm run test:e2e --filter solid,authjs
bun run test:e2e --filter solid,authjs
```

## Adding E2E Tests for New Features
Expand Down Expand Up @@ -113,7 +112,7 @@ await describeBati(({ test, expect, fetch, testMatch }) => {
2. **Use `exclude` array**: Reduce test permutations by excluding unnecessary combinations
3. **Add to existing matrix when possible**: If your feature fits an existing test category
4. **Create new spec file only if needed**: For truly unique features
5. **Regenerate workflow matrix**: Run `pnpm run test:e2e workflow-write` to auto-generate entries in `tests-entry.yml` (do NOT edit manually)
5. **Regenerate workflow matrix**: Run `bun run test:e2e workflow-write` to auto-generate entries in `tests-entry.yml` (do NOT edit manually)

### Test Modes

Expand All @@ -127,7 +126,7 @@ Tests can run in different modes via `describeBati` options:

After adding a new test file or modifying matrices, regenerate workflow entries:
```bash
pnpm run test:e2e workflow-write
bun run test:e2e workflow-write
```
This auto-generates the matrix entries in `.github/workflows/tests-entry.yml`. Never edit this file manually.

Expand All @@ -151,20 +150,18 @@ This auto-generates the matrix entries in `.github/workflows/tests-entry.yml`. N
│ ├── hono/ # Hono server
│ └── ... # Other features (auth, db, hosting, etc.)
├── website/ # batijs.dev website
├── turbo.json # Turborepo configuration
├── nx.json # Nx task definitions and caching
├── biome.json # Biome linter/formatter config
├── pnpm-workspace.yaml
└── tsconfig.json # Root TypeScript config
```

## Key Configuration Files

| File | Purpose |
|------|---------|
| `turbo.json` | Turborepo task definitions and caching |
| `nx.json` | Nx task definitions and caching |
| `biome.json` | Linting and formatting rules (extends `@vikejs/biome-config`) |
| `pnpm-workspace.yaml` | Workspace package locations and hoisting config |
| `packages/cli/turbo.json` | CLI-specific build dependencies |
| `package.json` `workspaces` field | Workspace package locations |
| `packages/features/src/features.ts` | Feature flag definitions |
| `packages/features/src/rules/rules.ts` | Feature compatibility rules |

Expand All @@ -174,7 +171,7 @@ This auto-generates the matrix entries in `.github/workflows/tests-entry.yml`. N

### When to Create a New Boilerplate

Use `pnpm run new-boilerplate <name>` when:
Use `bun run new-boilerplate <name>` when:
- The feature is **UI-framework independent** (e.g., `sentry`, `tailwindcss`, `auth0`)

Create **UI-specific boilerplates** when the feature requires framework-specific code:
Expand All @@ -196,7 +193,7 @@ Create **UI-specific boilerplates** when the feature requires framework-specific

### Boilerplate Setup Steps

1. Create: `pnpm run new-boilerplate <name>` then `pnpm install`
1. Create: `bun run new-boilerplate <name>` then `bun install`
2. Configure `boilerplates/<name>/bati.config.ts`:
```ts
export default defineConfig({
Expand Down Expand Up @@ -329,23 +326,23 @@ Uses [SquirellyJS](https://squirrelly.js.org/docs/syntax/overview) with custom `

**On Pull Requests:**
1. **Checks workflow** (`checks.yml`): Runs on Node 20 & 22
- `pnpm install` → `pnpm run build` → `pnpm run check-types` → `pnpm run lint`
- `bun install` → `bun run build` → `bun run check-types` → `bun run lint`
2. **Tests workflow** (`tests-entry.yml`): Matrix of E2E tests across OS/features

**To replicate CI locally:**
```bash
pnpm install && pnpm run build && pnpm run check-types && pnpm run lint && pnpm run test
bun install && bun run build && bun run check-types && bun run lint && bun run test
```

## Common Issues & Solutions

| Issue | Solution |
|-------|----------|
| Build fails with missing deps | Run `pnpm install` first |
| Type errors after changes | Run `pnpm run build` to regenerate dist files |
| Lint errors | Run `pnpm run check` to auto-fix (includes format) |
| Stale turbo cache | Use `pnpm run build:force` |
| Full reset needed | Run `pnpm run reset` (cleans, reinstalls, rebuilds) |
| Build fails with missing deps | Run `bun install` first |
| Type errors after changes | Run `bun run build` to regenerate dist files |
| Lint errors | Run `bun run check` to auto-fix (includes format) |
| Stale Nx cache | Use `bun run build:force` |
| Full reset needed | Run `bun run reset` (cleans, reinstalls, rebuilds) |

## Code Style

Expand All @@ -358,7 +355,7 @@ pnpm install && pnpm run build && pnpm run check-types && pnpm run lint && pnpm

```bash
# Build and run CLI to generate test app
pnpm run cli # Creates /tmp/bati-app with default options
bun run cli # Creates /tmp/bati-app with default options

# Or manually after build:
node packages/cli/dist/index.js --react --hono /tmp/my-app
Expand Down
2 changes: 1 addition & 1 deletion BOILERPLATES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ some others are split into several ones.
## Anatomy of a boilerplate

> [!TIP]
> Create a new boilerplate with `pnpm run new-boilerplate <name>`
> Create a new boilerplate with `bun run new-boilerplate <name>`

Each boilerplate contains at least:
- `files` folder, which contains files that will be used by Bati CLI to scaffold a new app. This is where all code related to features must be placed.
Expand Down
Loading
Loading