ascii-side-of-the-moon 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -3
- package/dist/cli.cjs +665 -0
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/cli.js +0 -579
package/README.md
CHANGED
|
@@ -15,18 +15,24 @@ You can use this package directly from the command line:
|
|
|
15
15
|
npx ascii-side-of-the-moon
|
|
16
16
|
|
|
17
17
|
# Show moon for a specific date
|
|
18
|
-
npx ascii-side-of-the-moon 2025-
|
|
18
|
+
npx ascii-side-of-the-moon 2025-09-21
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
The CLI will display the ASCII moon art along with information about the moon's phase, illumination percentage, distance, and angular diameter.
|
|
22
|
+
|
|
21
23
|
## Example
|
|
22
24
|
|
|
23
25
|
```js
|
|
24
|
-
import { getMoonState, renderMoon } from 'ascii-side-of-the-moon';
|
|
26
|
+
import { getMoonState, renderMoon, getMoonPhase } from 'ascii-side-of-the-moon';
|
|
25
27
|
|
|
26
28
|
// Get moon state for January 1st, 2025
|
|
27
29
|
const date = new Date(2025, 0, 1); // Note: month is 0-based in JavaScript
|
|
28
30
|
const moonState = getMoonState(date);
|
|
29
31
|
|
|
32
|
+
// Get the moon phase name
|
|
33
|
+
const phaseName = getMoonPhase(moonState);
|
|
34
|
+
console.log(`Moon Phase: ${phaseName}`); // e.g., "Waxing Crescent"
|
|
35
|
+
|
|
30
36
|
// Render the moon's ASCII representation
|
|
31
37
|
const moonAscii = renderMoon(moonState);
|
|
32
38
|
|
|
@@ -34,6 +40,17 @@ const moonAscii = renderMoon(moonState);
|
|
|
34
40
|
console.log(moonAscii);
|
|
35
41
|
```
|
|
36
42
|
|
|
43
|
+
## API Reference
|
|
44
|
+
|
|
45
|
+
### `getMoonState(date: Date): MoonState`
|
|
46
|
+
Returns detailed moon information including phase, size, and libration data.
|
|
47
|
+
|
|
48
|
+
### `renderMoon(moonState: MoonState, options?: RenderOptions): string`
|
|
49
|
+
Renders the moon as ASCII art. Returns a 29×60 character string.
|
|
50
|
+
|
|
51
|
+
### `getMoonPhase(moonState: MoonState): string`
|
|
52
|
+
Returns the English name of the moon phase (e.g., "New Moon", "Waxing Crescent", "First Quarter", "Waxing Gibbous", "Full Moon", "Waning Gibbous", "Last Quarter", "Waning Crescent").
|
|
53
|
+
|
|
37
54
|
## Local Demo
|
|
38
55
|
Inside of repository for `ascii-side-of-the-moon`.
|
|
39
56
|
|
|
@@ -47,10 +64,11 @@ Render an animation:
|
|
|
47
64
|
pnpm run render:demo_animate 2025-01-01 2025-12-30
|
|
48
65
|
```
|
|
49
66
|
|
|
67
|
+
Both demo scripts now include the moon phase name in their output.
|
|
68
|
+
|
|
50
69
|
## Char aspect ratio.
|
|
51
70
|
This package assumes a character ratio of 10/22.
|
|
52
71
|
|
|
53
|
-
|
|
54
72
|
## Preview image
|
|
55
73
|
The preview svg was generated with these commands:
|
|
56
74
|
```sh
|