Skip to content

Commit 0d0938e

Browse files
authored
Codebase Refactoring (#4)
* remove unused function * remove imports from next * dedupe isStringOrURL * remove any in resolveArray * prefer _metaFilter * rename functions in utils * fix naming inconsistency * remove next dependency * remove React type * remove any * add tests for normalize * add more tests for normalize * add AGENTS.md * update README.md * changeset * add sharp-baboons-rest.md
1 parent 4c49d15 commit 0d0938e

27 files changed

Lines changed: 1333 additions & 412 deletions

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{ "repo": "morinokami/tanstack-meta" }
6+
],
7+
"commit": false,
8+
"fixed": [],
9+
"linked": [],
10+
"access": "public",
11+
"baseBranch": "main",
12+
"updateInternalDependencies": "patch",
13+
"ignore": ["playground"]
14+
}

.changeset/sharp-baboons-rest.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tanstack-meta": patch
3+
---
4+
5+
Codebase Refactoring

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ jobs:
2525
- name: Install dependencies
2626
run: bun install --frozen-lockfile
2727

28+
- name: Type check
29+
run: bun meta typecheck
30+
31+
- name: Lint
32+
run: bun meta lint
33+
2834
- name: Test
2935
run: bun test
3036

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
id-token: write
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
release:
15+
name: Release
16+
if: ${{ github.repository_owner == 'morinokami' }}
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v5
21+
22+
- name: Install Bun
23+
uses: oven-sh/setup-bun@v2
24+
with:
25+
bun-version: latest
26+
27+
- name: Install dependencies
28+
run: bun install --frozen-lockfile
29+
30+
- name: Build
31+
run: bun meta build
32+
33+
- name: Create Release Pull Request
34+
uses: changesets/action@v1
35+
with:
36+
version: bunx changeset version
37+
publish: bunx changeset publish
38+
commit: "[ci] release"
39+
title: "[ci] release"
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

AGENTS.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Repository Guidelines
2+
3+
This repo is a Bun workspace for `tanstack-meta`, a TypeScript utility that turns structured metadata into TanStack Router/Start-compatible head tags. Use the notes below to stay consistent and ship safe changes.
4+
5+
## Project Structure & Module Organization
6+
- Root manages workspaces; primary package lives in `packages/meta`.
7+
- Library source is in `packages/meta/src` with focused folders such as `generate`, `normalize`, and `types`; unit tests sit next to implementations as `.test.ts`.
8+
- Built artifacts are written to `packages/meta/dist` via `tsdown` and are the only exported files.
9+
- `playground/` is a TanStack Start app wired to the workspace build for manual validation; keep it in sync when changing public APIs.
10+
11+
## Build, Test, and Development Commands
12+
```bash
13+
bun install # install all workspace deps
14+
bun meta build # bundle to dist/ with tsdown
15+
bun test # run bun:test suite in src/**
16+
bun meta lint # biome lint + format check
17+
bun meta typecheck # tsc via tsgo --noEmit
18+
bun meta publint # sanity-check published surface
19+
20+
bun playground dev # optional: preview changes in the demo app
21+
```
22+
23+
## Coding Style & Naming Conventions
24+
- Biome enforces tabs for indentation and double quotes; run `bun run lint` before pushing.
25+
- Code is TypeScript-first; prefer typed helpers over `any`, keep exports small and pure, and mirror the existing `generate*` and `normalize*` naming patterns.
26+
- Tests follow `bun:test`’s `describe/test/expect` style and reside beside the code they cover.
27+
28+
## Testing Guidelines
29+
- Add or update `*.test.ts` alongside new logic; extend existing fixtures in `src/generate`/`src/normalize` to cover edge cases.
30+
- Favor deterministic inputs and explicit expectations; ensure new behavior is exercised in both metadata generation and normalization paths when relevant.
31+
- Run `bun test` locally; for public API changes, also sanity-check the playground to catch integration regressions.
32+
33+
## Commit & Pull Request Guidelines
34+
- Use short, imperative commits (e.g., “add more tests for normalize” as seen in the log); group unrelated changes separately.
35+
- PRs should include a clear summary, rationale, and scope of impact; link issues when applicable.
36+
- Demonstrate safety: include test results, note playground updates or screenshots for UI-facing tweaks, and update docs when the API or behavior changes.

bun.lock

Lines changed: 189 additions & 79 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
},
1414
"devDependencies": {
1515
"@biomejs/biome": "2.3.7",
16+
"@changesets/changelog-github": "0.5.1",
17+
"@changesets/cli": "2.29.7",
1618
"@types/bun": "1.3.3",
1719
"pkg-pr-new": "0.0.60"
1820
}

packages/meta/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ While it makes the code slightly longer, it improves readability and clarity, an
77

88
| Without `tanstack-meta` | With `tanstack-meta` |
99
| ----------------------- | -------------------- |
10-
| ![Screenshot](./.github/assets/before.webp) | ![Screenshot](./.github/assets/after.webp) |
10+
| ![Screenshot](https://github.com/morinokami/tanstack-meta/blob/main/.github/assets/before.webp?raw=true) | ![Screenshot](https://github.com/morinokami/tanstack-meta/blob/main/.github/assets/after.webp?raw=true) |
1111

1212
## Usage
1313

packages/meta/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@
2828
],
2929
"scripts": {
3030
"build": "tsdown",
31+
"lint": "biome ci",
32+
"typecheck": "tsgo --noEmit",
3133
"publint": "publint"
3234
},
3335
"devDependencies": {
3436
"@tanstack/react-router": "1.139.3",
35-
"next": "16.0.3",
37+
"@typescript/native-preview": "7.0.0-dev.20251125.1",
3638
"publint": "0.3.15",
3739
"tsdown": "0.16.6"
3840
}

0 commit comments

Comments
 (0)