The original version of this was by Jef Poskanzer jef@mail.acme.com (Twitter: @jef_poskanzer) written in Pascal in 1979.
It's been translated by him into C, then by @igor_chubin into Python, and now by me into TypeScript.
I'm basing this one off of the Python version.
I'm aiming for options to be mostly similar to the Python version usage over here on pyphoon's readme.
[ ] = optional flag
[ <> ] = required arg to flag
[ <> = X ] = default value if flag is not supplied
jsphoon [--lines <LINES=23>] [--language <LANGUAGE=en>]
[--hemisphere <"north","south"=north>] [--date <DATE=now>]
[--show-hemisphere-text] [--no-text] [--no-color]supported locales: "ar", "be", "bg", "ca", "cs", "da", "de", "en", "et", "el", "es", "eo", "fi", "fr", "hr", "hy", "ia", "it", "ko", "kn", "ja", "lt", "nl", "ru", "pl", "pt", "ro", "sk", "sr", "sv", "th", "uk", "zh_TW", "nb", "nn", "cy", "tr"supported dates:
β any ISO Date
- "2021-04-24"
- "2021-04-24T05:20"
β UNIX timestamp, in ms
- 1688134732982Note that there is no help command as of v0.1.
Currently, you'll have to:git clone https://github.com/PineappleRind/jsphoon
cd jsphoon
bun i
bun src/main.tsJSPhoon uses the Bun runtime for faster installation times and TypeScript support out-of-the-box.
src/
βββ calculations/
βββ constants/
βββ frontend/
βββ moons/
βββ utils/
βββ main.ts
βββ printMoon.ts
test/
βββ *.test.tsHere's what everything does.
-
src/calculations/contains the main astronomical calculations. This was formerly in pyphoon'sastromodule. -
src/constants/contains some constants to help in variouscalculationsand determiningsettings. -
src/frontend/is honestly just an umbrella for anything user-facing. It contains things like colorization (what the user sees), parsing settings (what the user gives), and localization (how the user understands). -
src/moons/contains the raw ASCII of moons at various resolutions (column count). Sometimes, a moon won't look correct. Maybe that's because the entire thing is shifted a bit to the left or right via spaces. I just use trial and error to find the correct offset. -
src/utils/contains various helper functions and types for everyone, e.g. Julian date conversions and math shorthands. -
src/main.tsis the entry point. It ties everything together. -
src/printMoon.tsgets information from variouscalculations, applies it to amoon, and prints it along with some metadata. -
test/*.test.tsare testing files. You can run the tests withbun test. They usually correspond to the folder (or file, if it's directly in src/) they're helping to test;utils.test.tshelps with testing everything insrc/utils, andcalculations.test.tshelps with testing everything insrc/calculations.
Here's some information on contributing to Open Source in general. A lot of it applies here.
tl;dr your average open source project, you can open issues on anything pertaining to this project or PRs if you want to contribute something code-related