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

chore(hub-embed): auto-build & embed hub instead of pulling from releases #1966

Conversation

NathanFlurry
Copy link
Member

Changes

Copy link

cloudflare-workers-and-pages bot commented Jan 30, 2025

Deploying rivet-hub with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4bce14d
Status: ✅  Deploy successful!
Preview URL: https://27662316.rivet-hub-7jb.pages.dev
Branch Preview URL: https://01-29-chore-hub-embed-auto-b.rivet-hub-7jb.pages.dev

View logs

Copy link
Member Author

NathanFlurry commented Jan 30, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR modifies the hub-embed package to build and embed the hub UI directly from source during compilation, replacing the previous approach of pulling from releases.

  • Changed packages/common/hub-embed/build.rs to build hub UI using yarn/turbo instead of downloading pre-built releases
  • Added new build:embedded task in frontend/apps/hub/turbo.json and package.json with /ui/ base path
  • Updated placeholder from %VITE_APP_API_URL% to __VITE_APP_API_URL__ in packages/api/ui/src/route.rs for API URL injection
  • Security concern: Removed .env* from .gitignore which could expose sensitive information
  • Added fs_extra build dependency in packages/common/hub-embed/Cargo.toml for directory operations

6 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -61,7 +61,6 @@ tests/basic-game/.env
# Added by cargo

/target
Copy link

Choose a reason for hiding this comment

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

style: Duplicate /target entry - already covered by **/target on line 48

Suggested change
/target

@@ -61,7 +61,6 @@ tests/basic-game/.env
# Added by cargo

/target
.env*
.yarn/cache
.yarn/install-state.gz
.turbo
Copy link

Choose a reason for hiding this comment

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

style: Duplicate .turbo entry - already defined on line 56

Suggested change
.turbo

Comment on lines +9 to +10
let project_root = PathBuf::from(manifest_dir.clone()).join("../../..");
let hub_path = project_root.join("frontend/apps/hub");
Copy link

Choose a reason for hiding this comment

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

logic: Path traversal could fail if manifest_dir is at root. Consider using canonicalize() to resolve the absolute path.

Comment on lines +31 to +37
let dist_path = hub_path.join("dist");
fs::create_dir_all(out_dir)?;
fs_extra::dir::copy(
dist_path,
out_dir,
&fs_extra::dir::CopyOptions::new().overwrite(true),
)?;
Copy link

Choose a reason for hiding this comment

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

logic: No check if dist_path exists before copying. Build could silently fail if dist directory wasn't created.

Suggested change
let dist_path = hub_path.join("dist");
fs::create_dir_all(out_dir)?;
fs_extra::dir::copy(
dist_path,
out_dir,
&fs_extra::dir::CopyOptions::new().overwrite(true),
)?;
let dist_path = hub_path.join("dist");
if !dist_path.exists() {
return Err("Build failed: dist directory not created".into());
}
fs::create_dir_all(out_dir)?;
fs_extra::dir::copy(
dist_path,
out_dir,
&fs_extra::dir::CopyOptions::new().overwrite(true),
)?;

Copy link

Deploying rivet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4bce14d
Status: ✅  Deploy successful!
Preview URL: https://025b14f6.rivet.pages.dev
Branch Preview URL: https://01-29-chore-hub-embed-auto-b.rivet.pages.dev

View logs

Copy link
Contributor

graphite-app bot commented Jan 30, 2025

Merge activity

  • Jan 30, 3:38 AM EST: A user added this pull request to the Graphite merge queue.
  • Jan 30, 3:43 AM EST: CI is running for this PR on a draft PR: #1974
  • Jan 30, 3:45 AM EST: A user merged this pull request with the Graphite merge queue via draft PR: #1974.

NathanFlurry added a commit that referenced this pull request Jan 30, 2025
…ases (#1966)

<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
@graphite-app graphite-app bot closed this Jan 30, 2025
@graphite-app graphite-app bot deleted the 01-29-chore_hub-embed_auto-build_embed_hub_instead_of_pulling_from_releases branch January 30, 2025 08:45
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.

1 participant