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

docs: upgrade the-guild-docs version #1178

Merged
merged 10 commits into from May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/config.json
Expand Up @@ -6,5 +6,5 @@
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": ["@graphql-yoga/website"]
"ignore": ["website"]
}
2 changes: 1 addition & 1 deletion .github/workflows/website-integrity.yml
Expand Up @@ -23,7 +23,7 @@ jobs:
run: yarn build

- name: Typecheck
run: yarn workspace @graphql-yoga/website run build
run: yarn workspace website run build
- name: Diff
run: git diff --exit-code -- website/route-lockfile.txt

Expand Down
6 changes: 3 additions & 3 deletions examples/file-upload-nextjs-pothos/package.json
Expand Up @@ -14,11 +14,11 @@
"@pothos/core": "3.5.0",
"graphql": "16.3.0",
"next": "12.1.4",
"react": "18.0.0",
"react-dom": "18.0.0"
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"@types/react": "18.0.0",
"@types/react": "^17.0.0",
"eslint": "8.13.0",
"eslint-config-next": "12.1.4",
"typescript": "4.6.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs-auth/package.json
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@graphql-yoga/node": "2.5.0",
"@types/react": "17.0.38",
"@types/react": "17.0.39",
"graphql": "^16.1.0",
"next-auth": "4.3.1",
"next": "12.0.7",
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs/package.json
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@graphql-yoga/node": "2.5.0",
"@types/react": "17.0.38",
"@types/react": "17.0.39",
"graphql": "^16.1.0",
"next": "12.0.7",
"react": "17.0.2",
Expand Down
10 changes: 6 additions & 4 deletions package.json
Expand Up @@ -10,7 +10,7 @@
"test": "jest --passWithNoTests",
"release": "yarn build && changeset publish",
"release:canary": "(node scripts/canary-release.js && yarn build && yarn changeset publish --tag canary) || echo Skipping Canary...",
"start:docs": "yarn workspace @graphql-yoga/website dev",
"start:docs": "yarn workspace website dev",
"postinstall": "patch-package && husky install",
"fix-bin": "node scripts/fix-bin.js",
"build-website": "yarn build && cd website && yarn build"
Expand Down Expand Up @@ -71,11 +71,13 @@
"ts-jest": "^28.0.0"
},
"resolutions": {
"@graphql-tools/url-loader": "7.9.12",
"@changesets/apply-release-plan": "6.0.0",
"graphql": "16.4.0",
"cross-undici-fetch": "0.4.2",
"@types/react": "18.0.1",
"react": "^18.0.0",
"react-dom": "^18.0.0"
"@types/react": "17.0.39",
"@types/react-dom": "17.0.11",
"react": "17.0.2",
"react-dom": "17.0.2"
Comment on lines +78 to +81
Copy link
Collaborator

Choose a reason for hiding this comment

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

why provide it in root package.json?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

because I don't want 900000 different versions of react installed by those packages deep in the tree that fuck up declaring loose enough dependency ranges and cause multiple instances of react runtime issues.

}
}
8 changes: 4 additions & 4 deletions packages/graphiql/package.json
Expand Up @@ -24,18 +24,18 @@
"author": "Laurin Quast <laurinquast@googlemail.com>",
"license": "MIT",
"devDependencies": {
"@types/react": "18.0.4",
"@types/react": "17.0.39",
"@vitejs/plugin-react-refresh": "1.3.6",
"vite": "2.9.8"
},
"dependencies": {
"@graphql-tools/url-loader": "^7.9.10",
"copy-to-clipboard": "^3.3.1",
"graphiql": "^1.8.4",
"graphiql": "1.8.4",
"graphiql-explorer": "^0.9.0",
"graphql": "^16.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react": "17.0.2",
"react-dom": "17.0.2",
Comment on lines +37 to +38
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better?

Suggested change
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",

Copy link
Collaborator

Choose a reason for hiding this comment

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

We create a static bundle before releasing this. For consistency and making sure we know the bundled version, I think it is better to go with pinned versions.

"use-url-search-params": "^2.5.1",
"json-bigint-patch": "^0.0.8"
}
Expand Down
17 changes: 0 additions & 17 deletions patches/@guild-docs+client+1.4.0.patch

This file was deleted.

8 changes: 3 additions & 5 deletions website/next-i18next.config.js
@@ -1,6 +1,4 @@
module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
exports.i18n = {
defaultLocale: 'en',
locales: ['en'],
}
15 changes: 9 additions & 6 deletions website/next.config.js → website/next.config.mjs
@@ -1,16 +1,19 @@
require('bob-tsm')
import { createRequire } from 'node:module'
import nextBundleAnalyzer from '@next/bundle-analyzer'
import { withGuildDocs } from '@guild-docs/server'
import { register } from 'esbuild-register/dist/node.js'
import { i18n } from './next-i18next.config.js'

const { i18n } = require('./next-i18next.config.js')
register({ extensions: ['.ts', '.tsx'] })

const { withGuildDocs } = require('@guild-docs/server')
const require = createRequire(import.meta.url)

const { getRoutes, getTutorialRoutes } = require('./routes.ts')

const withBundleAnalyzer = require('@next/bundle-analyzer')({
const withBundleAnalyzer = nextBundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
})

module.exports = withBundleAnalyzer(
export default withBundleAnalyzer(
withGuildDocs({
env: {
// This is a pre-serialized version of the tutorial routes that prevents calculating the routes on production
Expand Down
21 changes: 11 additions & 10 deletions website/package.json
@@ -1,10 +1,10 @@
{
"name": "@graphql-yoga/website",
"name": "website",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "next build",
"postbuild": "npx next-sitemap && ts-node scripts/sitemap-ci.ts",
"postbuild": "npx next-sitemap && node scripts/sitemap-ci.mjs",
"dev": "concurrently -r \"next-remote-watch ./docs ./routes.ts ./src/pages/_app.tsx ./src/pages/_document.tsx\" \"wait-on -s 1 http://localhost:3000 && open-cli http://localhost:3000\"",
"next": "next",
"start": "next start",
Expand All @@ -16,12 +16,13 @@
"@types/concurrently": "^6.4.0",
"@types/mdx-js__react": "^1.5.5",
"@types/node": "^16.11.7",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react": "^17.0.39",
"@types/react-dom": "^17.0.11",
"bob-tsm": "^0.4.6",
"concurrently": "^7.0.0",
"cross-env": "^7.0.3",
"esbuild": "^0.14.21",
"esbuild-register": "^3.3.2",
"next-remote-watch": "^1.0.0",
"open-cli": "^7.0.1",
"fast-xml-parser": "^4.0.7",
Expand All @@ -37,20 +38,20 @@
"@emotion/styled": "^11.6.0",
"@graphql-yoga/node": "2.5.0",
"@graphql-yoga/render-graphiql": "2.6.0",
"@guild-docs/client": "^1.4.0",
"@guild-docs/server": "^2.2.0",
"@guild-docs/client": "^2.1.1",
"@guild-docs/server": "^3.0.1",
"@mdx-js/react": "^2.1.1",
"@theguild/components": "1.11.2",
"framer-motion": "^6.2.6",
"graphql": "16.4.0",
"next": "^12.0.10",
"next-i18next": "^11.0.0",
"next-seo": "^5.1.0",
"next-seo": "^5.2.0",
"next-sitemap": "^2.5.17",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-icons": "^4.3.1",
"react-use": "^17.3.2",
"remark-admonitions": "^1.2.1",
"shiki": "^0.10.1"
}
}
13 changes: 8 additions & 5 deletions website/scripts/sitemap-ci.ts → website/scripts/sitemap-ci.mjs
@@ -1,8 +1,11 @@
import { XMLParser } from 'fast-xml-parser'
import { fileURLToPath } from 'url'
import { dirname } from 'path'
import * as fs from 'fs'
import type { Redirect } from 'next/dist/lib/load-custom-routes'
import * as path from 'path'
import config from '../next.config.js'
import config from '../next.config.mjs'

const __dirname = dirname(fileURLToPath(import.meta.url))

const sitemapPath = path.join(__dirname, '..', 'public', 'sitemap-0.xml')
const lockfilePath = path.join(__dirname, '..', 'route-lockfile.txt')
Expand All @@ -12,13 +15,13 @@ async function main() {

const d = parser.parse(fs.readFileSync(sitemapPath, 'utf-8'))

const routes: Array<string> = d.urlset.url.map((url: any) =>
const routes = d.urlset.url.map((url) =>
url.loc.replace(`https://graphql-yoga.com`, ``),
)

const redirectsPointingToNonExistingStuff: Array<Redirect> = []
const redirectsPointingToNonExistingStuff = []

const redirects: Redirect[] = config.redirects()
const redirects = config.redirects()

for (const redirect of redirects) {
if (routes.includes(redirect.destination) === false) {
Expand Down
1 change: 0 additions & 1 deletion website/src/pages/_app.tsx
@@ -1,4 +1,3 @@
import 'remark-admonitions/styles/infima.css'
import '../../public/style.css'

import { appWithTranslation } from 'next-i18next'
Expand Down
4 changes: 2 additions & 2 deletions website/tutorial/basic/08-graph-relations.mdx
Expand Up @@ -378,7 +378,7 @@ So far you only fetched single entities within your GraphQL operations.

Let's also add a one to many connection from the Link to Comment object types within the GraphQL schema.

<Introduction>
<Instruction>

Add the `Link.comments` field to the GraphQL schema definition.

Expand All @@ -391,7 +391,7 @@ type Link {
}
```

</Introduction>
</Instruction>

Up next you implement the corresponding `Link.comments` resolver. For this you need to touch the `Link` object types resolver map.

Expand Down