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

add "Preview in LiveCodes" github actions #25

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hatemhosny
Copy link
Contributor

@hatemhosny hatemhosny commented Jan 5, 2025

Hi @KonnorRogers

This PR adds the feature of posting a comment for every push to PR with preview links in LiveCodes (as discussed in #23 ), using the "Preview in LiveCodes" GitHub action.

This is a screenshot from racing-bars repo.

image

3 files are added:

  • .github\workflows\livecodes-preview.yml: builds the library and save the artifacts.
  • .github\workflows\livecodes-post-comment.yml: posts the playground links as PR comments.
  • .livecodes\esm.json: adds a sample project with the code you want in the playground.

Notes

  • We need 2 different workflow files, because each runs in a different context with different permissions. See GitHub Actions docs and "Preview in LiveCodes" docs. This is demo repo.
  • The workflow files need to be merged to the default branch, before they are able to run. Changes to projects can then be seen with each PR even if the projects themselves are changed.
  • You can add as many projects to .livecodes\ directory. Each JSON file represents a LiveCodes configuration object. You have full control of what you want the playgrounds to do.
  • When this PR is merged and everything is working well, we can add more projects (e.g. for different frameworks like react, vue (3/2), svelte, solid, etc) or different ninja-keys data configuration.

Edit:

  • Currently the build artifacts bundle/all.js and types/index.d.ts are converted to data urls and added in the link URL. The resulting ESM module is then used as import map in the playground to allow importing from 'konnors-ninja-keys' without having to publish it. So minifying the build can help make this more performant.

Please let me know if you have any questions or comments.
Thank you.

Closes #23

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.

Suggestions
1 participant