moon-cycle/README.md
Aric Camarata 09079091ae
Some checks failed
CI / Test (Node 20) (push) Failing after 34s
CI / Test (Node 22) (push) Failing after 38s
CI / Test (Node 24) (push) Failing after 27s
CI / Lint & Format (push) Failing after 39s
CI / Typecheck (push) Failing after 35s
CI / Pack check (push) Failing after 31s
CI / Coverage (push) Failing after 3s
add opt-in anonymous telemetry (#1)
* add Forgejo CI mirror and telemetry disclosure

Mirrors .github/workflows/ci.yml to .forgejo/workflows/ for self-hosted
runner on git.ariccamarata.com. Adds failure-reporting hook stub (server
registration via nself sentry ci enable is a server-side step). Adds
telemetry disclosure section to README.

* add opt-in telemetry via @acamarata/telemetry (off by default)

* chore: update lockfile for @acamarata/telemetry devDep

* chore: fix prettier formatting on telemetry import
2026-06-30 15:56:57 -04:00

64 lines
No EOL
2.4 KiB
Markdown

# moon-cycle
[![CI](https://github.com/acamarata/moon-cycle/actions/workflows/ci.yml/badge.svg)](https://github.com/acamarata/moon-cycle/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
Maps any JavaScript `Date` to the correct NASA moon phase image filename. Two algorithms: synodic-cycle mapping (708 images) and calendar-year mapping (8,760 images).
Not published to npm. The image dataset (~438 MB of hourly WebP photos from NASA's Scientific Visualization Studio) lives in this repository. Use CDN or clone.
## Install
```bash
# Clone to get code and images together
git clone https://github.com/acamarata/moon-cycle.git
# Or add the code-only package via git
pnpm add github:acamarata/moon-cycle
```
## Quick Start
```ts
import { cycleMonth, cdnUrl } from 'moon-cycle';
const filename = cycleMonth(); // e.g. "354.webp"
const url = cdnUrl(filename, 'mm', 256, 75);
// => 'https://cdn.jsdelivr.net/gh/acamarata/moon-cycle@main/mm-256-75/354.webp'
```
CommonJS:
```js
const { cycleMonth, cdnUrl } = require('moon-cycle');
```
## Documentation
Full reference: [GitHub Wiki](https://github.com/acamarata/moon-cycle/wiki)
- [API Reference](https://github.com/acamarata/moon-cycle/wiki/API-Reference)
- [Architecture](https://github.com/acamarata/moon-cycle/wiki/Architecture)
- [Examples](https://github.com/acamarata/moon-cycle/wiki/examples/basic-usage)
## Related
- [nrel-spa](https://github.com/acamarata/nrel-spa): Pure JS NREL Solar Position Algorithm
- [pray-calc](https://github.com/acamarata/pray-calc): Islamic prayer times
- [moon-sighting](https://github.com/acamarata/moon-sighting): Lunar crescent visibility
## Acknowledgments
Moon phase imagery from NASA's Scientific Visualization Studio:
> Ernie Wright (2023). *Moon Phase and Libration, 2023* [Data set]. NASA Scientific Visualization Studio. [https://svs.gsfc.nasa.gov/5187](https://svs.gsfc.nasa.gov/5187)
Images are in the public domain per NASA's [media usage guidelines](https://www.nasa.gov/nasa-brand-center/images-and-media/).
## License
MIT. See [LICENSE](LICENSE) for the full text.
## Telemetry
This package supports optional, anonymous usage telemetry via [`@acamarata/telemetry`](https://github.com/acamarata/telemetry). It is **off by default**. See [TELEMETRY.md](https://github.com/acamarata/telemetry/blob/main/TELEMETRY.md) for what is collected and how to enable or disable it.