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

feat(renderer): renderer package #595

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

therealtimhawkins
Copy link
Contributor

@therealtimhawkins therealtimhawkins commented Mar 29, 2023

PR for the renderer package to headlessly render projects.

Thought I would make a PR for this to get some feedback and make sure I've not been barking up the wrong tree 😅

I thought it would be a better idea to make the changes to the create package in a different PR.

Also, not sure how package deployments work in lerna but happy to update after feedback 👍

Changes:

  1. The vite-plugin package is updated to load the renderer package when /project/renderer is visited.
  2. The renderer package loads the renderer in puppeteer then renders to /output.

Closes #415

@therealtimhawkins therealtimhawkins marked this pull request as draft March 29, 2023 09:22
@therealtimhawkins therealtimhawkins changed the title Renderer package feat(renderer): Renderer package Mar 29, 2023
@therealtimhawkins therealtimhawkins changed the title feat(renderer): Renderer package feat(renderer): renderer package Mar 29, 2023
Copy link
Contributor

@aarthificial aarthificial left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the renderer package provides its own editor, I think we can get away without modifying vite-plugin. Simply change renderer.html to editor.html and from main.ts export an editor function instead of render. Puppeteer can then simply visit /projectName.

root: Root,
configFile: path.resolve(Root, '../vite.config.ts'),
server: {
port: 9000,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this port number be configurable?

Not exactly sure if this is related, but I noticed that running npm run serve offers the following convenience: will start on port 9000, and if it's not available, use the next available e.g. 9001.

Perhaps the port number here could follow a similar approach?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choosing the next available port is a Vite functionality. It will do it automatically.
Tho it may be a good idea to actually check what port Vite picked using:

server.httpServer.address().port

and redirect Puppeteer there.

Right now we're using a hardcoded 9000 which will work most of the time but will fail if something is already running on 9000.

@aarthificial aarthificial added the d-adopt-me Looks like this PR has been abandoned :( label Oct 4, 2023
@dcsan
Copy link

dcsan commented Nov 18, 2023

since this library is rendering to a canvas surface, is it not possible to just dump every frame to a file and then use something like ffmpeg to generate a video?

@aarthificial
Copy link
Contributor

aarthificial commented Nov 19, 2023

@dcsan This is a draft for #415 which aims to give people the ability to

render a project from a shell script or in CI, without a human to operate a web browser

We already have an ffmpeg exporter (It even comes preinstalled by default when bootstrapping a new project)
CLI rendering is agnostic of the exporter logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d-adopt-me Looks like this PR has been abandoned :(
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Render projects headlessly
4 participants