Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC: Cli command #75

Closed
wants to merge 1 commit into from
Closed

Conversation

ChristianDavis
Copy link
Contributor

This is a rough POC for generating maps from the CLI, related to #71. Ideally we'd be able to load a file into the JS, return HTML or an SVG, then pass that to a renderer and save an image. But right now the browser is the render engine.

I tried OWM -> React -> html2canvas directly, but the browser was required.
Tried running everything in JSDOM (which could potentially work), but html2canvas doesn't support SVG, relies directly on the browser for that.

This version loads the app in a headless chromium instance and then uses chrome's screenshot tool. Didn't need to screenshot cause the html2canvas save function works this way as well, but managing the file was more involved.

This is actually a workable solution but the full chromium instance is a little overkill. The only caveat to this PR is that it needs the dev server running. The need for the local server can be eliminated with a small build step and rendering the built files (or committing some built files), but I didn't go through the webpack config for that.

to test:

yarn install
yarn start

in a new tab, run the cli command

yarn cli -f maps/example.owm -o maps/example.png

Try it out and let me know what you think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant