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

Simplify Local Frontend Development Workflow #313

Merged
merged 11 commits into from
Jun 5, 2024

Conversation

jbouder
Copy link
Collaborator

@jbouder jbouder commented May 30, 2024

This PR is intended to provide updates to simplify frontend development in jhub-apps. The current workflow involves developing initially through the standalone React App, then running a build and copy script, then starting JupyterHub to validate changes.

This change updates the build process and adds a watch script to allow the developer to run both JupyterHub and the watch script. Then as changes are made to the frontend (react app), the watch will cause a new build and copy of assets. From there, the developer needs only to perform a browser refresh from the JupyterHub app.

This PR also includes a husky pre-push hook to ensure a fresh build is always completed prior to a push.

Note: the developer can still work in the standalone React app.

Reference Issues or PRs

N/A

What does this implement/fix?

Put a x in the boxes that apply

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds a feature)
  • Breaking change (fix or feature that would cause existing features not to work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Other (please describe):

Testing

  • Did you test the pull request locally?
  • Did you add new tests?

Any other comments?

  • Adds an npm watch script and custom vite build script to handle rebuild and copy
  • Adds husky pre-push script to ensure react app is built before push
  • Updates intended to simplify and streamline the local frontend development process
    • Allows the developer to see React-based changes in JupyterHub without having to manually run scripts and restart JupyterHub

Copy link

vercel bot commented May 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
jhub-apps ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 5, 2024 1:13pm
jhub-apps-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 5, 2024 1:13pm

@jbouder jbouder changed the title Dev Improvements Local Development Improvements May 30, 2024
@jbouder jbouder changed the title Local Development Improvements Simplify Local Frontend Development Workflow May 30, 2024
Copy link
Contributor

@kildre kildre left a comment

Choose a reason for hiding this comment

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

Tested npm run build command, works as expected.

Great work! Simplicity is nice.

@aktech
Copy link
Member

aktech commented Jun 5, 2024

Then as changes are made to the frontend (react app), the watch will cause a new build and copy of assets. From there, the developer needs only to perform a browser refresh from the JupyterHub app.

Do you mean changes will visible in the "jupyterhub" as well?

I didn't change for me in the JupyterHub:

Frontend: http://localhost:8080/hub

Screenshot 2024-06-05 at 11 09 31 am

JupyterHub http://127.0.0.1:8000/hub/home

Screenshot 2024-06-05 at 11 09 44 am

@jbouder
Copy link
Collaborator Author

jbouder commented Jun 5, 2024

Then as changes are made to the frontend (react app), the watch will cause a new build and copy of assets. From there, the developer needs only to perform a browser refresh from the JupyterHub app.

Do you mean changes will visible in the "jupyterhub" as well?

I didn't change for me in the JupyterHub:

Frontend: http://localhost:8080/hub

Screenshot 2024-06-05 at 11 09 31 am ## JupyterHub http://127.0.0.1:8000/hub/home Screenshot 2024-06-05 at 11 09 44 am

I’m guessing you actually started the frontend. With this new setup you perform an ‘npm run watch’ on the ui and start Jupyterhub in another tab. Then as changes are made you’ll see them in Jupyterhub (after a refresh). No meed to have the ui actually running in dev mode with this setup…that said you can still run the ui separately if you just want to work in that environment.

And these are code changes, not changes to some specific app.

@aktech
Copy link
Member

aktech commented Jun 5, 2024

Ah, I ran npm run watch now and got what I expected. This is excellent work. Can you add a line in the docs about it?

@jbouder jbouder merged commit fe72db5 into nebari-dev:main Jun 5, 2024
25 checks passed
@jbouder jbouder deleted the dev-improvements branch June 5, 2024 13:25
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.

3 participants