-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
refactor(website): Upgrade dependencies and use StarlightPage
component
#1854
Conversation
✅ Deploy Preview for biomejs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -1,40 +1,9 @@ | |||
import { netlifyStatic } from "@astrojs/netlify"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The static Netlify adapter will be deprecated, so I've removed it. Note that we technically don't even need this one, so we should feel safe to remove it as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't??? 😯🤯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, both Vercel and Netlify let you deploy just fine without an adapter, we do mention it in the docs: https://docs.astro.build/en/guides/integrations-guide/netlify/
It might enable some host-specific features but for the most part, the adapters aren't focused on the static use case.
import rehypeSlug from "rehype-slug"; | ||
import remarkToc from "remark-toc"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we weren't using "remark-toc"
anywhere, so I've removed it. Also, did the same for @astrojs/vercel
, which isn't being used anymore.
@@ -397,11 +362,10 @@ export default defineConfig({ | |||
|
|||
markdown: { | |||
syntaxHighlight: "prism", | |||
remarkPlugins: [remarkToc], | |||
rehypePlugins: [rehypeSlug, [rehypeAutolinkHeadings, autolinkConfig]], | |||
rehypePlugins: [rehypeSlug, ...rehypeAutolink()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the unified
project had breaking changes, we now have some weird behavior clashing issue when trying to apply the remarkAutolink
plugin, had to move it to an external file to make it work properly.
} | ||
|
||
const { src } = Astro.props as Props; | ||
|
||
const files = await import.meta.glob<string>("/src/assets/svg/**/*.svg", { | ||
as: "raw", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as: "raw"
was deprecated in Vite, so I've replaced it for the recommended query: "?raw"
@@ -343,7 +343,7 @@ function initState( | |||
searchParams.get("bracketSpacing") === "true" || | |||
defaultPlaygroundState.settings.bracketSpacing, | |||
bracketSameLine: | |||
searchParams.get("bracketSameLine") === "true" ?? | |||
searchParams.get("bracketSameLine") === "true" || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vite was complaining and throwing an warning about this line where the left operand would always be used, might be a false alarm from it, so that's something we can change back, probably.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should revert this change, it previously caused some issue
}, | ||
|
||
adapter: netlifyStatic(), | ||
adapter: netlify(), | ||
|
||
vite: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason Vite is complaining about some imported code by Astro's DevToolbar. Supposedly vite.server.fs.allow
the path used should fix it, but didn't work for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to disable their remote image service, because they don't support multiple remote image domains from the config file. Their alternative is to use another configuration file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There we go, the vite.server.fs.allow
issue should be fixed, Vite now has a utility to allow workspace packages to be served, which fixes the issue with serving files from dependencies.
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the playground doesn't work anymore. Unless you want to spend time understanding the issue, maybe we can revert the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue doesn't seem related to updating the React dependencies, reverting them doesn't fix, nor does loading the Playground without <StarlightPage>
- my best guess it might be Vite-related? But hard to know without context on how the Playground was built.
}, | ||
|
||
adapter: netlifyStatic(), | ||
adapter: netlify(), | ||
|
||
vite: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to disable their remote image service, because they don't support multiple remote image domains from the config file. Their alternative is to use another configuration file
@@ -343,7 +343,7 @@ function initState( | |||
searchParams.get("bracketSpacing") === "true" || | |||
defaultPlaygroundState.settings.bracketSpacing, | |||
bracketSameLine: | |||
searchParams.get("bracketSameLine") === "true" ?? | |||
searchParams.get("bracketSameLine") === "true" || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should revert this change, it previously caused some issue
@@ -1,40 +1,9 @@ | |||
import { netlifyStatic } from "@astrojs/netlify"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't??? 😯🤯
website/package.json
Outdated
@@ -34,25 +33,25 @@ | |||
"@types/node": "^18.18.0", | |||
"@types/react": "^18.2.23", | |||
"@types/react-dom": "^18.2.8", | |||
"@uiw/react-codemirror": "4.20.2", | |||
"@uiw/react-codemirror": "4.21.21", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The playground not working anymore is caused by this bump.
This version of @uiw/react-codemirror
indirectly requires the version of @codemirror/state
to be in range ^0.6.4
because of its dependencies: @codemirror/view
and @codemirror/commands
.
However @codemirror/[email protected]
is explicitly pinned in the devDependencies
, so two versions of @codemirror/state
are installed and hence the error occurs which you can find in the console, and it breaks the playground.
A simple fix is to bump the @codemirror/state
in devDepedencies
to 0.6.4
.
And IMHO a future-proof fix is to try not pinning these low-level dependencies (including other codemirror tools) but use semver ranges instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, thanks @Sec-ant - hadn't noticed the dependencies were pinned, I've moved them to ranges instead and seem to be working fine locally!
RSS link broken after this PR: https://biomejs.dev/feed.xml |
I'll give it a look, thanks for noticing @ysm-dev! |
Summary
This PR uses the new
<StarlightPage>
component instead of the custom<StarlightSplashLayout>
one, which was making it impossible for us to upgrade Starlight, Astro and its dependencies.I've added per-file comments explaining a few changes necessary due to the breaking changes from upgrading.
Test Plan
Visually expecting the website and seeing everything is working as usual