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 automated frontend build to v2.0dev #77

Merged
merged 4 commits into from
May 10, 2024

Conversation

mmalecki
Copy link
Contributor

@mmalecki mmalecki commented May 9, 2024

Use inline-source npm package, run index.html through it in order to inline all the scripts and styles we wish to bundle.

Extract the dronebridge.css into separate file to have it enjoy the same automation.

Run npm run build in frontend_src in order to build into ../frontend (considered building into build/frontend as well).

Remove unused meta-set content-type header, as we set one in the ESP32 static server.

I tested the frontend out on this one (without a real FC yet) and it appears to work, no styling changes or JS breakage.

Pending questions: now that frontend directory is a build artifact, should we remove it from the repository, and if so, rename frontend_src into just frontend?

Happy to tweak anything here to your liking :)

mmalecki added 3 commits May 9, 2024 13:11
Our content type actually is `text/html`, as set by the ESP32 static
content server.
Use [`inline-source` npm package](https://www.npmjs.com/package/inline-source),
run `index.html` through it in order to inline all the scripts and
styles we wish to bundle.

Extract the `dronebridge.css` into separate file to have it enjoy the
same automation.

Run `npm run build` in `frontend_src` in order to build into
`../frontend` (considered building into `build/frontend` as well).
I tested the frontend out on this one (without a real FC yet) and it
appears to work, no styling changes or JS breakage.
@seeul8er
Copy link
Contributor

seeul8er commented May 9, 2024

Looks great, thank you!
Does it make sense to add the npm build process as part of the cmake build process so it gets triggered automatically?

Pending questions: now that frontend directory is a build artifact, should we remove it from the repository, and if so, rename frontend_src into just frontend?

I agree. If we can add the npm as part of the cmake process move it to the build directory for now (adjust cmake here to set new relative path). We can document the build process in the readme as part of frontend_src and in the Wiki.
If we decided to keep npm build separately then we should keep the artifact and only update it manually on changes

@mmalecki
Copy link
Contributor Author

mmalecki commented May 9, 2024

Does it make sense to add the npm build process as part of the cmake build process so it gets triggered automatically?

I think it does! Let me take a stab at it, thanks for linking these resources.

Move `frontend_src` to `frontend`.
Add a dependency between `spiffs_create_partition_image` and frontend
build.

Extract the build output directory to a variable in the `package.json`
script.
@mmalecki
Copy link
Contributor Author

@seeul8er I think ^ should do it. It rebuilds the frontend on every build, but the build is so quick I don't think it should matter.

@seeul8er
Copy link
Contributor

Let's merge! Thank you so much!

@seeul8er seeul8er merged commit fa72088 into DroneBridge:v2.0dev May 10, 2024
@seeul8er seeul8er mentioned this pull request May 10, 2024
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.

2 participants