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
35 changes: 35 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# AGENTS.md

## Environment
- Node: use `nvm use 24` if node commands fail
- Website sub-project lives in `website/` with its own `package.json`; run npm commands from there

## Build / Lint / Test
- Install: `npm ci`
- Build: `npm run build` (webpack UMD bundle → `dist/astrochart.js`)
- Lint: `npm run lint` (ESLint, TypeScript source files only)
- Test all: `npm test` (Jest + ts-jest, jsdom environment)
- Test single file: `npx jest project/src/utils.test.ts`
- Test with coverage: `npm run test:coverage`

## Code Style
- **Formatting:** 2-space indent, single quotes, no semicolons, unix line endings, no trailing commas, no `var`
- **Functions:** class methods have a space before parens (`radix (data: AstroData) {`); standalone functions use `export const fn = (...) => { ... }`
- **Naming:** Classes/interfaces PascalCase, methods/variables camelCase, settings keys UPPER_SNAKE_CASE, files lowercase single-word
- **Imports:** default imports for classes, named imports for functions, `import type` for type-only; relative `./` paths, no extensions, no aliases
- **Types:** interfaces/types live in the file where primarily used — no separate types file
- **Tests:** co-located (`foo.test.ts` next to `foo.ts`), use `describe`/`test` (not `it`), prefer `toStrictEqual`, never commit `.only`
- **Errors:** throw plain `Error('descriptive message')`, no custom error classes; null checks use loose equality (`== null`)
- **Docs:** JSDoc on public methods/classes with `@param`, `@return` tags
- **⚠️ Breaking changes:** this is a production library with many consumers — never change public API (exported types, method names, function signatures)

## Adding New Dependencies
- Never write import paths or config shapes from memory for fast-moving packages (Astro, Starlight, etc.)
- After `npm install`, verify real exports: `cat node_modules/<pkg>/package.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(list(d.get('exports',{}).keys()))"`
- Run `npm run build` (or `dev`) after creating the first file — don't build 30 files then discover the config is wrong
- Use `legacy-peer-deps=true` in `.npmrc` when a package's peer range lags behind the latest patch

## Sub-projects isolation (⚠️ hard rule)
- `website/` is a completely separate project — it must **never** affect the library build or tests
- Any new sub-project directory **must** be added to the root `tsconfig.json` `exclude` list AND to the `exclude` regex in `webpack.config.js` before committing
- After adding a sub-project, always run `npm run build` and `npm test` from the **root** to verify isolation
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"declaration": true,
"strictNullChecks": true
},
"exclude": ["project/src/**/*.test.ts", "dist"]
"exclude": ["project/src/**/*.test.ts", "dist", "website"]
}
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: [/node_modules/, /.test.ts/],
exclude: [/node_modules/, /.test.ts/, /website/],
},
],
},
Expand Down
27 changes: 27 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# dependencies
node_modules/
.pnp
.pnp.js

# testing
coverage/

# astro
dist/
.astro/

# misc
.DS_Store
*.log
.env
.env.local
.env.*.local

# IDE
.vscode/
.idea/
.sublime-project
.sublime-workspace
*.swp
*.swo
*~
1 change: 1 addition & 0 deletions website/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
71 changes: 71 additions & 0 deletions website/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { defineConfig } from 'astro/config'
import starlight from '@astrojs/starlight'
import sitemap from '@astrojs/sitemap'

export default defineConfig({
site: 'https://astrodraw.github.io/',
integrations: [
starlight({
title: 'AstroChart',
description: 'Pure SVG astrology charts for the web',
favicon: '/favicon.svg',
logo: {
src: './public/img/logo.svg',
alt: 'AstroChart Logo'
},
social: [
{ icon: 'github', label: 'GitHub', href: 'https://github.com/AstroDraw/AstroChart' }
],
sidebar: [
{
label: 'Getting Started',
items: [
{ label: 'Introduction', slug: 'introduction' },
{ label: 'Installation', slug: 'installation' },
{ label: 'Quick Start', slug: 'quickstart' }
]
},
{
label: 'Guides',
items: [
{ label: 'Radix Chart', slug: 'guides/radix-chart' },
{ label: 'Transit Chart', slug: 'guides/transit-chart' },
{ label: 'Animation', slug: 'guides/animation' },
{ label: 'Custom Settings', slug: 'guides/custom-settings' },
{ label: 'Custom Symbols', slug: 'guides/custom-symbols' },
{ label: 'Multiple Charts', slug: 'guides/multiple-charts' },
{ label: 'Click Events', slug: 'guides/click-events' },
{
label: 'Framework Integrations',
items: [
{ label: 'React', slug: 'guides/frameworks/react' },
{ label: 'Vue', slug: 'guides/frameworks/vue' },
{ label: 'Angular', slug: 'guides/frameworks/angular' }
]
}
]
},
{
label: 'API Reference',
items: [
{ label: 'Chart', slug: 'api/chart' },
{ label: 'Radix', slug: 'api/radix' },
{ label: 'Transit', slug: 'api/transit' },
{ label: 'Aspect Calculator', slug: 'api/aspect-calculator' },
{ label: 'Zodiac', slug: 'api/zodiac' },
{ label: 'Settings Reference', slug: 'api/settings' },
{ label: 'Types', slug: 'api/types' }
]
},
{
label: 'Project',
items: [
{ label: 'Changelog', slug: 'changelog' },
{ label: 'Contributing', slug: 'contributing' }
]
}
]
}),
sitemap()
]
})
Loading
Loading