Skip to content

Commit 59dff7a

Browse files
committed
init monorepo
0 parents  commit 59dff7a

39 files changed

Lines changed: 4835 additions & 0 deletions

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.3/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [["@xtramaps/legend-symbols-maplibre", "@xtramaps/legend-symbols-maplibre-react", "@xtramaps/legend-symbols-maplibre-svelte", "@xtramaps/legend-symbols-maplibre-vue"]],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version-file: .nvmrc
17+
cache: npm
18+
- run: npm ci
19+
- run: npm run lint
20+
- run: npm run build
21+
- run: npm run typecheck

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
concurrency: ${{ github.workflow }}-${{ github.ref }}
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version-file: .nvmrc
20+
cache: npm
21+
registry-url: https://registry.npmjs.org
22+
- run: npm ci
23+
- run: npm run build
24+
- uses: changesets/action@v1
25+
with:
26+
publish: npm run release
27+
version: npm run version-packages
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
dist
3+
*.tsbuildinfo
4+
.turbo
5+
.DS_Store
6+
.env*
7+
*.log

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
save-exact=true

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"biomejs.biome"
4+
]
5+
}

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"editor.defaultFormatter": "biomejs.biome",
3+
"editor.formatOnSave": true,
4+
"editor.codeActionsOnSave": {
5+
"source.organizeImports.biome": "explicit"
6+
}
7+
}

AGENTS.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Agents
2+
3+
Instructions for AI coding agents working on this repo.
4+
5+
## Project
6+
7+
TypeScript monorepo for libraries enhancing web map clients (`@xtramaps` scope) with framework-specific variants. Libraries are published to npm.
8+
9+
## Structure
10+
11+
```
12+
packages/
13+
vite.config.base.ts # Shared Vite lib config factory
14+
core/<lib>/ # Plain TypeScript (no framework deps)
15+
react/<lib>/ # React variant (depends on core, peers on react)
16+
vue/<lib>/ # Vue variant (depends on core, peers on vue)
17+
svelte/<lib>/ # Svelte variant (depends on core, peers on svelte)
18+
```
19+
20+
Each library has: `package.json`, `tsconfig.json`, `vite.config.ts`, `src/index.ts`.
21+
22+
## Naming
23+
24+
- `@xtramaps/<lib>` — core package
25+
- `@xtramaps/<lib>-react` — React variant
26+
- `@xtramaps/<lib>-vue` — Vue variant
27+
- `@xtramaps/<lib>-svelte` — Svelte variant
28+
29+
## Commands
30+
31+
- `npm run build` — build all packages (via Turborepo)
32+
- `npm run lint` — lint and format check (Biome)
33+
- `npm run lint:fix` — auto-fix lint/format issues
34+
- `npm run typecheck` — type-check all packages
35+
36+
## Key Conventions
37+
38+
- All packages output ESM + CJS + `.d.ts` via Vite library mode
39+
- `vite.config.ts` uses `defineLibConfig()` from `packages/vite.config.base.ts`
40+
- `tsconfig.json` extends `tsconfig.base.json` (must specify `outDir`, `rootDir`, `include` locally)
41+
- Shared devDeps (`typescript`, `vite`, `vite-plugin-dts`) live in root only — do not add to individual packages
42+
- Framework deps (react, vue, svelte) are externalized and declared as `peerDependencies`
43+
- Core deps are listed in `dependencies` (not peers)
44+
- Biome handles formatting and linting — no Prettier or ESLint
45+
- Changesets for versioning — run `npx changeset` after changes
46+
47+
## Adding a New Library
48+
49+
1. Create `packages/core/<lib>/` with `package.json`, `tsconfig.json`, `vite.config.ts`, `src/index.ts`
50+
2. Create corresponding `packages/{react,vue,svelte}/<lib>/` variants
51+
3. Run `npm install` to link workspaces
52+
4. Run `npm run build` to verify
53+
54+
## Checks Before Committing
55+
56+
1. `npm run lint` passes
57+
2. `npm run build` succeeds
58+
3. `npm run typecheck` passes

0 commit comments

Comments
 (0)