-
Notifications
You must be signed in to change notification settings - Fork 104
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
Hive Docs x Nextra 4 #6089
base: main
Are you sure you want to change the base?
Hive Docs x Nextra 4 #6089
Changes from 7 commits
d29fed1
126dda1
e74509e
20b2ee9
c31351d
a519c9b
6ba874b
8d3efd2
12f74af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: validate-mdx-links | ||
on: | ||
pull_request: | ||
paths: | ||
# we run to check if the links are wrong | ||
- 'packages/web/docs/src/**/*.mdx' | ||
# or if a page disappeared | ||
- 'packages/web/docs/src/app/**' | ||
|
||
jobs: | ||
validate-mdx-links: | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 4 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: setup environment | ||
uses: ./.github/actions/setup | ||
with: | ||
actor: validate-mdx-links | ||
cacheTurbo: false | ||
|
||
- name: validate links in docs | ||
run: pnpm tsx ./scripts/validate-mdx-links.ts --cwd packages/web/docs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export const latestChangelog = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we commit that? It's exactly like types being generated by codegen, a thing that is part of the build process. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And because it's not meant to be edited, it should be ignored. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed it to see what's exactly changed in changelogs, and added to prettier ignore There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add it to .gitignore as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do, just question I wonder if it's possible to have race condition? e.g. |
||
{ | ||
"date": "November 20, 2024", | ||
"href": "https://the-guild.dev/graphql/hive/product-updates/2024-11-20-hive-plugin-apollo-router-crate", | ||
"title": "Hive Plugin for Apollo-Router now available on Crates.io", | ||
"description": "We've published the Hive Plugin for Apollo-Router on Crates.io. Learn how to use it in your custom Apollo-Router projects." | ||
}, | ||
{ | ||
"date": "November 19, 2024", | ||
"href": "https://the-guild.dev/graphql/hive/product-updates/2024-11-19-apollo-router-hive-versioning", | ||
"title": "Hive Plugin for Apollo Router - Stable v1 Release", | ||
"description": "The stable build of Apollo Router with Hive plugin is now available. Learn how to integrate it with your Federation projects." | ||
}, | ||
{ | ||
"date": "October 29, 2024", | ||
"href": "https://the-guild.dev/graphql/hive/product-updates/2024-10-29-new-home", | ||
"title": "New Home for Repositories and Docker Images", | ||
"description": "We've moved repositories and Docker images to the `graphql-hive` organization on GitHub. See what's changed and how to update your setup." | ||
}, | ||
{ | ||
"date": "October 29, 2024", | ||
"href": "https://the-guild.dev/graphql/hive/product-updates/2024-10-29-versioning-for-self-hosters", | ||
"title": "Self-Hosting Hive Made Easier with Versioned Docker Images", | ||
"description": "We've introduced versioned Docker images for Hive, making it easier to manage and self-host. See where to find the latest updates." | ||
} | ||
]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* We have an error while using `mdx-components` with `.tsx` extension: | ||
* | ||
* createContext only works in Client Components. Add the "use client" directive at the top of the file to use it | ||
* | ||
* Using `.js` to avoid this error for now | ||
*/ | ||
export { useMDXComponents } from './src/mdx-components'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
/// <reference types="next/navigation-types/compat/navigation" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. | ||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import { withGuildDocs } from '@theguild/components/next.config'; | ||
|
||
export default withGuildDocs({ | ||
nextraConfig: /** @satisfies import("nextra").NextraConfig*/ ({ | ||
themeConfig: './src/theme.config.tsx', | ||
autoImportThemeStyle: false, | ||
}), | ||
output: 'export', | ||
basePath: process.env.NEXT_BASE_PATH, | ||
eslint: { | ||
ignoreDuringBuilds: true, | ||
}, | ||
|
||
experimental: { | ||
turbo: { | ||
treeShaking: true, | ||
}, | ||
}, | ||
nextraConfig: { | ||
contentDirBasePath: '/docs', | ||
}, | ||
redirects: async () => [ | ||
{ | ||
source: '/docs/get-started/organizations', | ||
|
@@ -240,7 +242,9 @@ export default withGuildDocs({ | |
permanent: true, | ||
}, | ||
], | ||
swcMinify: true, | ||
env: { | ||
SITE_URL: 'https://the-guild.dev/graphql/hive', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't that affect the previews? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope, this env is used to generate |
||
}, | ||
webpack: (config, { webpack }) => { | ||
config.externals['node:fs'] = 'commonjs node:fs'; | ||
config.externals['node:path'] = 'commonjs node:path'; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,58 +6,40 @@ const meta: Record<string, DeepPartial<Item | MenuItem | PageItem>> = { | |
title: 'Home', | ||
type: 'page', | ||
display: 'hidden', | ||
theme: { | ||
layout: 'raw', | ||
}, | ||
}, | ||
federation: { | ||
title: 'Federation', | ||
type: 'page', | ||
display: 'hidden', | ||
theme: { | ||
layout: 'raw', | ||
}, | ||
}, | ||
hive: { | ||
title: 'Get Started', | ||
type: 'page', | ||
href: 'https://app.graphql-hive.com', | ||
newWindow: true, | ||
}, | ||
'contact-us': { | ||
title: 'Contact Us', | ||
type: 'page', | ||
href: 'https://the-guild.dev/contact', | ||
newWindow: true, | ||
}, | ||
status: { | ||
title: 'Status', | ||
type: 'page', | ||
href: 'https://status.graphql-hive.com', | ||
newWindow: true, | ||
}, | ||
docs: { | ||
title: 'Documentation', | ||
type: 'page', | ||
theme: { | ||
toc: true, | ||
}, | ||
}, | ||
partners: { | ||
title: 'Partners', | ||
type: 'page', | ||
display: 'hidden', | ||
theme: { | ||
layout: 'raw', | ||
}, | ||
}, | ||
ecosystem: { | ||
title: 'Ecosystem', | ||
type: 'page', | ||
display: 'hidden', | ||
theme: { | ||
layout: 'raw', | ||
}, | ||
}, | ||
products: { | ||
title: 'Products', | ||
|
@@ -67,9 +49,6 @@ const meta: Record<string, DeepPartial<Item | MenuItem | PageItem>> = { | |
pricing: { | ||
title: 'Pricing', | ||
type: 'page', | ||
theme: { | ||
layout: 'raw', | ||
}, | ||
}, | ||
'product-updates': { | ||
type: 'page', | ||
|
@@ -85,21 +64,16 @@ const meta: Record<string, DeepPartial<Item | MenuItem | PageItem>> = { | |
type: 'page', | ||
title: 'Our Open Source Friends', | ||
display: 'hidden', | ||
theme: { | ||
layout: 'raw', | ||
}, | ||
}, | ||
blog: { | ||
title: 'Blog', | ||
type: 'page', | ||
href: 'https://the-guild.dev/blog', | ||
newWindow: true, | ||
}, | ||
github: { | ||
title: 'GitHub', | ||
type: 'page', | ||
href: 'https://github.com/graphql-hive/platform', | ||
newWindow: true, | ||
}, | ||
'the-guild': { | ||
title: 'The Guild', | ||
|
@@ -108,20 +82,17 @@ const meta: Record<string, DeepPartial<Item | MenuItem | PageItem>> = { | |
'about-us': { | ||
title: 'About Us', | ||
href: 'https://the-guild.dev/about-us', | ||
newWindow: true, | ||
}, | ||
'brand-assets': { | ||
title: 'Brand Assets', | ||
href: 'https://the-guild.dev/logos', | ||
newWindow: true, | ||
}, | ||
}, | ||
}, | ||
'graphql-foundation': { | ||
title: 'GraphQL Foundation', | ||
type: 'page', | ||
href: 'https://graphql.org/community/foundation/', | ||
newWindow: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it smart enough on it's own to detect if a link should be opened in a new window? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this option is removed in nextra, all external links now are opened in new window |
||
}, | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { ResolvingMetadata } from 'next'; | ||
import { generateStaticParamsFor, importPage } from 'nextra/pages'; | ||
import { NextPageProps } from '@theguild/components'; | ||
import { useMDXComponents } from '../../../../mdx-components.js'; | ||
import { ConfiguredGiscus } from '../../../components/configured-giscus'; | ||
|
||
export const generateStaticParams = generateStaticParamsFor('mdxPath'); | ||
|
||
export async function generateMetadata( | ||
props: NextPageProps<'...mdxPath'>, | ||
_parent: ResolvingMetadata, | ||
) { | ||
const { mdxPath } = await props.params; | ||
const { metadata } = await importPage(mdxPath); | ||
return { | ||
...metadata, | ||
...(mdxPath?.[0] === 'gateway' && { | ||
title: { absolute: `${metadata.title} | Hive Gateway` }, | ||
}), | ||
}; | ||
} | ||
|
||
const Wrapper = useMDXComponents().wrapper; | ||
|
||
export default async function Page(props: NextPageProps<'...mdxPath'>) { | ||
const params = await props.params; | ||
const result = await importPage(params.mdxPath); | ||
const { default: MDXContent, toc, metadata } = result; | ||
return ( | ||
<Wrapper toc={toc} metadata={metadata}> | ||
<MDXContent {...props} params={params} /> | ||
<ConfiguredGiscus /> | ||
</Wrapper> | ||
); | ||
} |
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.
Why?
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.
I simplified it to generate changelogs once
feed.xml
will be generated https://github.com/graphql-hive/console/blob/nextra-4--move-files/packages/web/docs/src/app/feed.xml/route.ts