Skip to content

Conversation

@KianNH
Copy link
Member

@KianNH KianNH commented Jan 28, 2025

Summary

Upgrades to Astro 5 and all related Astro dependencies like Starlight.

Comment on lines +19 to +39
async function autogenSections() {
const sections = (
await readdir("./src/content/docs/", {
withFileTypes: true,
})
)
.filter((x) => x.isDirectory())
.map((x) => x.name);
return sections.map((x) => {
return {
label: x,
autogenerate: {
directory: x,
collapsed: true,
},
};
});
}

const sidebar = await autogenSections();
Copy link
Member Author

Choose a reason for hiding this comment

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

We had to move this back into astro.config.ts since this file cannot use Astro or Vite specific imports, like astro:content which we now use in sidebar.ts.

Comment on lines -38 to -39
contentLayer: true,
directRenderScript: true,
Copy link
Member Author

Choose a reason for hiding this comment

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

These flags are now defaults.

Comment on lines +21 to +23
if (!entry) {
throw new Error(`[AvailableNotifications] Unable to fetch notifications`);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a common change as the types for getEntry now include undefined.

---
import { z } from "astro:schema";
import { getCollection } from "astro:content";
import { getCollection, render } from "astro:content";
Copy link
Member Author

Choose a reason for hiding this comment

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

render is no-longer on an entry.

Comment on lines +28 to +32
const markdown = (content: any) => {
if (typeof content !== "string") return content;
return marked.parse(content);
};
Copy link
Member Author

Choose a reason for hiding this comment

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

Moving this down stopped the type Props from being reported as unused.

Comment on lines -2 to -6
_build:
publishResources: false
render: never
list: never

Copy link
Member Author

Choose a reason for hiding this comment

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

Tabs are not valid YAML and this is now enforced strictly.

Copy link
Member

@WalshyDev WalshyDev Jan 30, 2025

Choose a reason for hiding this comment

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

We have editorconfig enforcing tabs... are editors smart enough to treat this section as yaml and not tab as per editorconfig?

Copy link
Contributor

Choose a reason for hiding this comment

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

From my experience with prettier, it won't fix tabs to spaces (in MDX frontmatter), but at least it won't break spaces into tabs again.

@@ -1 +0,0 @@
/// <reference path="../.astro/types.d.ts" />
Copy link
Member Author

Choose a reason for hiding this comment

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


export const getStaticPaths = (async () => {
const entries = await getCollection("docs");
const entries = await getCollection("docs", (e) => Boolean(e.body));
Copy link
Member Author

Choose a reason for hiding this comment

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

Stops a getStaticPaths warning that an endpoint returned an empty response.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that there are collection entries that are empty? Do they correspond to "empty files" (or equivalent) that we should fix?

Copy link
Member Author

Choose a reason for hiding this comment

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

export const GET: APIRoute = async () => {
const notes = await getCollection("changelogs-next");

notes.sort((a, b) => a.data.date.getTime() - b.data.date.getTime());
Copy link
Member Author

Choose a reason for hiding this comment

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

getCollection now returns with a non-deterministic order.

type SidebarEntry = Link | Group;
type Badge = Link["badge"];

const sidebars = new Map<string, Group>();
Copy link
Member Author

Choose a reason for hiding this comment

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

We're now caching the result of filtering and sorting a per-product sidebar, and each request will only update the current entry in the cached sidebar instead.

[]
---

While user tokens act on behalf of a particular user and inherit a subset of that user's permissions, account owned tokens allow you to set up durable integrations that can act as service principals with their own specific set of permissions. This approach is ideal for scenarios like CI/CD, or building integrations with external services like SEIMs where it is important that the integration continues working, even long after the user who configured the integration may have left your organization altogether. User tokens are better for ad hoc tasks like scripting, where acting as the user is ideal and durability is less of a concern.
Copy link
Contributor

@pedrosousa pedrosousa Jan 29, 2025

Choose a reason for hiding this comment

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

We usually add the following frontmatter to partials:

---
{}
---

Can we immediately start with the content, without adding any frontmatter? Are there any edge cases?

Copy link
Member Author

Choose a reason for hiding this comment

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

Starting with frontmatter immediately is fine, if you are not using params, but {} is also fine.

This one was using [], not {}, which does not match the object containing params we're expecting.

if (
e.slug === "warp-client/legal/3rdparty" ||
e.slug === "magic-wan/legal/3rdparty"
e.id === "warp-client/legal/3rdparty" ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit (for later): We should probably have a const array somewhere with these specific values, since they appear in more than one file.

Copy link
Collaborator

@kodster28 kodster28 left a comment

Choose a reason for hiding this comment

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

Looked through the main components / features and didn't see any issues:

  • Pages languages / build outputs
  • changelogs
  • Compatibility dates
  • Tutorials / list examples

@KianNH KianNH merged commit df4cf11 into production Jan 31, 2025
12 checks passed
@KianNH KianNH deleted the kian/PCX-15576 branch January 31, 2025 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.