Skip to content

Commit f49ebff

Browse files
committed
chore(release): merge v0.0.2 to main
This release includes monorepo architecture, comprehensive documentation infrastructure, CI automation, and pre-release governance tooling. See RELEASE-v0.0.2.md for detailed changelog.
2 parents 07e2ea3 + 8d12979 commit f49ebff

File tree

99 files changed

+10280
-1289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+10280
-1289
lines changed

.agents/AGENTS.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Repository Guidelines
2+
3+
This repository is a JavaScript/TypeScript monorepo for front.js. Keep changes small, security-minded, and aligned with the size budget of the core runtime.
4+
5+
## Project Structure & Module Organization
6+
- `packages/core/src/` — core runtime; public API re-exported via `packages/core/src/index.js`.
7+
- `packages/actions/src/` — RPC/actions layer (`client.js`, `server.js`).
8+
- `src/` — legacy/root entry points used by the website/KB builds.
9+
- `tests/` and `packages/core/tests/` — Vitest suites; mirror core behavior and security checks.
10+
- `website/` and `docs/` — marketing site, KB, and generated API docs; `website/examples/` for manual verification.
11+
- `scripts/` — utility tasks (filename validation, API docs generation).
12+
13+
## Build, Test, and Development Commands
14+
- `npm install` (Node >= 18) — install workspace deps.
15+
- `npm run build` — build all workspaces; `npm run build -w @frontjs/core` for the core only.
16+
- `npm test` — run Vitest suites across workspaces; `npm run test:watch -w @frontjs/core` for watch mode.
17+
- `npm run lint` / `npm run format` — enforce ESLint and Prettier on JS and Markdown.
18+
- `npm run validate` — lint + filename checks; run before PRs.
19+
- `npm run size-check -w @frontjs/core` — ensure gzipped core stays under the 5KB budget.
20+
- `npm run docs:generate` / `npm run types:generate` — refresh API docs and d.ts outputs.
21+
22+
## Coding Style & Naming Conventions
23+
- ES modules everywhere; 2-space indentation; prefer small, pure functions.
24+
- Keep public APIs documented with JSDoc; avoid implicit globals and side effects in module scope.
25+
- Filenames are lower-kebab-case; tests use `*.test.js`.
26+
- Security first: never use `eval`/`new Function`; sanitize/serialize via JSON only; respect Islands hydration model.
27+
28+
## Testing Guidelines
29+
- Framework: Vitest (`jsdom`, globals enabled). Tests live in `tests/` and `packages/core/tests/`.
30+
- Naming: match subject (`reactivity.test.js`, `security.test.js`); colocate fixtures near suites.
31+
- Run `npm test` before pushing; add regression tests for every bug fix and new public API.
32+
- For manual verification, load `website/examples/index.html` via a static server to confirm hydration and XSS protections.
33+
34+
## Commit & Pull Request Guidelines
35+
- Conventional Commits are expected (e.g., `feat(reactivity): add cleanup support`); keep scopes meaningful.
36+
- Branch names: `feat/<slug>`, `fix/<slug>`, `chore/<slug>`, etc., as in existing history.
37+
- PRs should describe motivation, testing performed (`npm test`, `npm run validate`, `npm run size-check -w @frontjs/core`), and link issues. Include screenshots/GIFs for UI-affecting changes in `website/` or examples.
38+
- Keep diffs minimal; update docs (`docs/`, `website/docs/`) and types when APIs change.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Node.js CI
22

33
on:
44
push:
5-
branches: [ "main", "master" ]
5+
branches: [ "main" ]
66
pull_request:
7-
branches: [ "main", "master" ]
7+
branches: [ "main" ]
88

99
jobs:
1010
build:

.github/workflows/deploy-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Deploy to GitHub Pages
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
workflow_dispatch:
88

99
permissions:

.github/workflows/docs.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Generate Documentation
2+
3+
on:
4+
push:
5+
branches: [main, dev]
6+
paths:
7+
- 'packages/*/src/**/*.js'
8+
- '.github/workflows/docs.yml'
9+
- 'scripts/generate-api-docs.js'
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
generate-docs:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '18'
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Generate API documentation
34+
run: npm run docs:api
35+
36+
- name: Generate TypeScript definitions
37+
run: npm run types:generate
38+
39+
- name: Check for changes
40+
id: git-check
41+
run: |
42+
git diff --exit-code website/docs/api/ || echo "docs_changed=true" >> $GITHUB_OUTPUT
43+
git diff --exit-code packages/*/types/ || echo "types_changed=true" >> $GITHUB_OUTPUT
44+
45+
- name: Commit updated docs
46+
if: steps.git-check.outputs.docs_changed == 'true' || steps.git-check.outputs.types_changed == 'true'
47+
run: |
48+
git config user.name "frontjs-bot"
49+
git config user.email "bot@frontjs.dev"
50+
git add website/docs/api/ packages/*/types/ || true
51+
git commit -m "docs: auto-generate API docs and TypeScript definitions [skip ci]" || exit 0
52+
git push

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ node_modules/
33

44
# Build outputs
55
dist/
6+
types/
67
*.map
78

89
# Test coverage
@@ -54,3 +55,4 @@ pnpm-lock.yaml
5455
yarn.lock
5556

5657
.agents/
58+
notes/

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Validate documentation placement
2+
node scripts/validate-docs-placement.js
3+
4+
# Run tests
5+
npm test

CLAUDE.md

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
99
## Key Commands
1010

1111
### Development
12+
1213
```bash
1314
npm install # Install dependencies
1415
npm test # Run all tests with Vitest
@@ -20,11 +21,36 @@ npm run lint # Lint code with ESLint
2021
```
2122

2223
### Running Examples
24+
2325
```bash
2426
npx serve .
2527
# Navigate to http://localhost:3000/examples/index.html
2628
```
2729

30+
### Website Build Scripts (Optional)
31+
32+
The framework itself has **zero build step**, but the website uses optional build scripts for progressive enhancement:
33+
34+
```bash
35+
npm run navbar:generate # Generate server-rendered navbar HTML
36+
npm run navbar:validate # Validate navbar islands match config
37+
npm run docs:api # Generate API documentation from JSDoc
38+
```
39+
40+
**NavBar Generation**: Keeps server-rendered HTML in sync with props across all pages.
41+
42+
- **Config**: `website/navbar-config.json` defines links for each page
43+
- **How it works**: Reads `NavBar.server.js` renderer → generates HTML → updates HTML files in-place
44+
- **Philosophy**: Generated HTML is committed to git (site works without building)
45+
- **When to use**: After editing navbar links or adding new pages with navbar
46+
47+
To update navbar links:
48+
1. Edit `website/navbar-config.json`
49+
2. Run `npm run navbar:generate`
50+
3. Commit the updated HTML files
51+
52+
**Why this works**: The framework ships as ES modules (no build). The website build is OPTIONAL and only for SEO/performance optimization (pre-rendering). This follows the same pattern as `generate-initial-doc.js` for docs.
53+
2854
## Architecture Overview
2955

3056
### Core Principles (see wiki/STANDARDS.md)
@@ -69,11 +95,13 @@ src/
6995
### Hydration System (src/core/client.js)
7096

7197
**Component Registration**:
98+
7299
```javascript
73-
register(name, componentFn) // name must match /^[a-zA-Z0-9_-]+$/
100+
register(name, componentFn); // name must match /^[a-zA-Z0-9_-]+$/
74101
```
75102

76103
**Hydration Algorithm**:
104+
77105
1. Query all `[data-island]` elements
78106
2. For each island:
79107
- Extract `data-component` name and validate (alphanumeric only)
@@ -88,6 +116,7 @@ register(name, componentFn) // name must match /^[a-zA-Z0-9_-]+$/
88116
### Component Model (src/core/component.js)
89117

90118
Components are higher-order functions:
119+
91120
```javascript
92121
function MyComponent(props) {
93122
// Setup phase: create values, calculated values
@@ -101,6 +130,7 @@ function MyComponent(props) {
101130
`defineComponent(renderFn, container)` wraps the render function in a run that auto-reruns on value changes, passing the template to uhtml's render function for efficient DOM diffing.
102131

103132
**Lifecycle Cleanup**: Components can use runs with cleanup functions for side effects:
133+
104134
```javascript
105135
function MyComponent(props) {
106136
const tick = val(0);
@@ -120,6 +150,7 @@ function MyComponent(props) {
120150
## Critical Constraints
121151

122152
### Size Budget
153+
123154
- **Hard limit**: <5KB minified + gzipped (excluding uhtml peer dependency)
124155
- Enforced via `npm run size-check` which fails CI if exceeded
125156
- Build config: `build.config.js` uses esbuild with target es2020
@@ -163,34 +194,34 @@ hydrate();
163194
### Server-Rendered HTML
164195

165196
```html
166-
<div
167-
data-island
168-
data-component="Counter"
169-
data-props='{"start": 10}'
170-
></div>
197+
<div data-island data-component="Counter" data-props='{"start": 10}'></div>
171198
```
172199

173200
### Testing
174201

175202
Tests use Vitest with jsdom environment. Key test files:
203+
176204
- `tests/reactivity.test.js` - val/run/calc behavior
177205
- `tests/component.test.js` - Component lifecycle
178206
- `tests/client.test.js` - Hydration algorithm
179207
- `tests/security.test.js` - XSS protection, injection attacks
180208

181209
Run single test file:
210+
182211
```bash
183212
npm test -- tests/reactivity.test.js
184213
```
185214

186215
## Alignment with Standards
187216

188217
When making changes, verify against:
218+
189219
1. **docs/BLUEPRINT.md** - Detailed architecture and implementation specs
190220
2. **wiki/STANDARDS.md** - "North Star" principles (Headless Reactivity, Standard Schema alignment, Platform First)
191221
3. **wiki/PRD.md** - Original product requirements
192222

193223
Major architectural changes require:
224+
194225
1. Discussion in GitHub issue first
195226
2. Update to docs/BLUEPRINT.md
196227
3. Alignment with wiki/STANDARDS.md

CODE-OF-CONDUCT.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
1717
Examples of behavior that contributes to a positive environment for our
1818
community include:
1919

20-
* Demonstrating empathy and kindness toward other people
21-
* Being respectful of differing opinions, viewpoints, and experiences
22-
* Giving and gracefully accepting constructive feedback
23-
* Accepting responsibility and apologizing to those affected by our mistakes,
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
2424
and learning from the experience
25-
* Focusing on what is best not just for us as individuals, but for the
25+
- Focusing on what is best not just for us as individuals, but for the
2626
overall community
2727

2828
Examples of unacceptable behavior include:
2929

30-
* The use of sexualized language or imagery, and sexual attention or
30+
- The use of sexualized language or imagery, and sexual attention or
3131
advances of any kind
32-
* Trolling, insulting or derogatory comments, and personal or political attacks
33-
* Public or private harassment
34-
* Publishing others' private information, such as a physical or email
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
3535
address, without their explicit permission
36-
* Other conduct which could reasonably be considered inappropriate in a
36+
- Other conduct which could reasonably be considered inappropriate in a
3737
professional setting
3838

3939
## Enforcement Responsibilities

CONTRIBUTING.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,33 @@ We welcome contributions! Please read the [Blueprint](./docs/BLUEPRINT.md) and [
1313
## Development Setup
1414

1515
1. **Clone the repo:**
16+
1617
```bash
1718
git clone https://github.com/your-username/front-js.git
1819
cd front-js
1920
```
2021

2122
2. **Install dependencies:**
23+
2224
```bash
2325
npm install
2426
```
2527

2628
3. **Run examples:**
29+
2730
```bash
2831
npx serve .
2932
# Navigate to http://localhost:3000/examples/index.html
3033
```
3134

3235
4. **Build:**
36+
3337
```bash
3438
npm run build
3539
```
3640

3741
5. **Check bundle size:**
42+
3843
```bash
3944
npm run size-check
4045
```
@@ -54,10 +59,11 @@ We welcome contributions! Please read the [Blueprint](./docs/BLUEPRINT.md) and [
5459
- [`wiki/PRD.md`](./wiki/PRD.md) - Product requirements
5560

5661
2. **Create a feature branch:**
62+
5763
```bash
5864
git checkout -b feat/your-feature-name
5965
```
60-
66+
6167
**Branch Naming Convention:**
6268
- `feat/` - New features
6369
- `fix/` - Bug fixes
@@ -77,18 +83,20 @@ We welcome contributions! Please read the [Blueprint](./docs/BLUEPRINT.md) and [
7783
- Verify bundle size with `npm run size-check`
7884

7985
5. **Format code:**
86+
8087
```bash
8188
npm run format
8289
```
8390

8491
6. **Commit with Conventional Commits:**
92+
8593
```bash
8694
# Format: <type>(<scope>): <subject>
8795
git commit -m "feat(reactivity): add cleanup support to run"
8896
git commit -m "fix(hydration): handle invalid JSON gracefully"
8997
git commit -m "docs(readme): add table of contents"
9098
```
91-
99+
92100
**Commit Types:**
93101
- `feat:` - New feature
94102
- `fix:` - Bug fix
@@ -154,12 +162,12 @@ npm run test:watch # Watch mode
154162

155163
## Pull Request Guidelines
156164

157-
* **Follow the Blueprint:** Changes to the architecture must be discussed in `docs/BLUEPRINT.md` first.
158-
* **Keep it Dependency-Free:** Do not add NPM dependencies to the runtime. `uhtml` is the only allowed exception (peer dependency).
159-
* **Test Thoroughly:** Run tests and verify examples work.
160-
* **Check Size:** Ensure bundle size stays under 5KB.
161-
* **Update Docs:** Update wiki/API.md and README if adding/changing APIs.
162-
* **Security Review:** All changes are reviewed for security implications.
165+
- **Follow the Blueprint:** Changes to the architecture must be discussed in `docs/BLUEPRINT.md` first.
166+
- **Keep it Dependency-Free:** Do not add NPM dependencies to the runtime. `uhtml` is the only allowed exception (peer dependency).
167+
- **Test Thoroughly:** Run tests and verify examples work.
168+
- **Check Size:** Ensure bundle size stays under 5KB.
169+
- **Update Docs:** Update wiki/API.md and README if adding/changing APIs.
170+
- **Security Review:** All changes are reviewed for security implications.
163171

164172
## Architecture Decisions
165173

@@ -174,4 +182,4 @@ Major architectural decisions should be:
174182

175183
- Open an issue for bugs or feature requests
176184
- Check existing documentation first
177-
- Review the Blueprint for architecture questions
185+
- Review the Blueprint for architecture questions

0 commit comments

Comments
 (0)