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: Add support for deploying Telescope using spa-tools #273

Merged
merged 7 commits into from
Feb 7, 2025

Conversation

macko911
Copy link
Contributor

@macko911 macko911 commented Feb 6, 2025

https://linear.app/pleo/issue/WEB-1796/fix-telescope-feature-deploys

We want to fix Telescope website feature deploys by using spa-tools for build and deploy.

What's changed

  1. Telescope build relies on having NOTION_API_KEY env variable.

  2. Add support for having multiple nested index.html files in the app by using a new variable serve_nested_index_html in the Terraform module.
    Telescope uses Gatsby SSG (static site generation) and pre-renderes static index.html for each route.
    Before this change if we go to https://telescope.pleo.io/components/overview/overview.about, we get the root /index.html file served from the S3 bucket.
    After these changes we get /components/overview/overview.about/index.html from the S3 bucket.

  3. We now use mime-type library to detect if a requested URL is for a file. Until now we were naively checking that the last part of a pathname has a dot . in it, so URL /components/overview/overview.about was considered to request a static file.

  4. Output "permanent" preview url from the deploy reusable workflow. This is used to update PR description with the preview link in a custom way compared to the way we do it in Web repo.

@macko911 macko911 requested a review from a team as a code owner February 6, 2025 11:59
Copy link

linear bot commented Feb 6, 2025

@macko911 macko911 force-pushed the web-1796-fix-telescope-feature-deploys branch from 09ebf39 to 7536cf3 Compare February 6, 2025 12:25
// - true, we append index.html to the original request URI
// - false, we serve the top-level index.html file, as all the routing is handled client-side.
if (serveNestedIndexHtml) {
return request.uri.replace(/\/$/, '') + '/index.html'
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we need to consider the json files generated by gatsby (or other SSGs) for navigation after initial load?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wouldn't those be handled by the previous condition isFileRequest?
Frankly I'm not loving that we are handling this ourselves this way but is seems to have served us well so far.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah you're right, didn't make a lot of sense what I wrote - this is only for rewriting paths where we don't have a file.

@macko911 macko911 added this pull request to the merge queue Feb 7, 2025
Merged via the queue into main with commit 8992257 Feb 7, 2025
9 checks passed
@macko911 macko911 deleted the web-1796-fix-telescope-feature-deploys branch February 7, 2025 13:15
@github-actions github-actions bot mentioned this pull request Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants