-
-
Notifications
You must be signed in to change notification settings - Fork 90
Description
Is your feature request related to a problem? Please describe.
No.
Describe the solution you'd like
I have a working prototype of generating an SVG on the server side via a new CLI functionality. It uses jsdom to fake a DOM, and then extracts the SVG string, outputting it to stdout, where you can (for example) redirect it to a file.
The current API accepts a few JSON blobs as command line arguments -- it's not really intended to be used directly by humans, but more by other programs. We could of course later add more granular options which could be more human friendly if desired.
Example of current use:
bin/astrochart \
--radix '{"planets":{"Sun":[60],"Moon":[120]},"cusps":[0,30,60,90,120,150,180,210,240,270,300,330]}' \
--transits '{"planets":{"Mars":[0],"Venus":[180]},"cusps":[0,30,60,90,120,150,180,210,240,270,300,330]}' \
> chart.svg( note that --settings '{some json}' is not yet in the prototype, but will be soon.
This command generates a standalone SVG that can be opened directly in a browser. Example SVG generated from the command above:
There are multiple options for how this feature could be integrated (or not) here:
- Directly into this repo.
- The current prototype uses
tsmto execute typescript directly, which is useful only if you clone the repo - If we wanted to go npx (think
npx astrochart --options ...) we would probably move to nodejs using the webpack transpiled output
- The current prototype uses
- In a separate repo that uses this one as a dependency.
- This one is interesting if we want to keep this repo as purely client side, but still want the CLI functionality to exist elsewhere.
- Not at all. If this is not of general interest, I'll just use it in my project, which would be fine 😄