Skip to content

Commit 6c36389

Browse files
Configuration needed for using unified website (dotansimha#8238)
Co-authored-by: Dotan Simha <dotansimha@gmail.com>
1 parent f75818f commit 6c36389

27 files changed

+864
-544
lines changed

.github/workflows/website.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: website
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
deployment:
13+
runs-on: ubuntu-latest
14+
if: github.event.pull_request.head.repo.full_name == github.repository
15+
steps:
16+
- name: checkout
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- uses: the-guild-org/shared-config/setup@main
22+
name: setup env
23+
with:
24+
nodeVersion: 17
25+
packageManager: yarn
26+
27+
- uses: the-guild-org/shared-config/website-cf@wip-fix
28+
name: build and deploy website
29+
env:
30+
NEXT_BASE_PATH: ${{ github.ref == 'refs/heads/master' && '/graphql/codegen' || '' }}
31+
SITE_URL: ${{ github.ref == 'refs/heads/master' && 'https://the-guild.dev/graphql/codegen' || '' }}
32+
with:
33+
cloudflareApiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
34+
cloudflareAccountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
35+
githubToken: ${{ secrets.GITHUB_TOKEN }}
36+
projectName: graphql-code-generator
37+
prId: ${{ github.event.pull_request.number }}
38+
websiteDirectory: ./
39+
buildScript: yarn build && cd website && yarn build && yarn next export
40+
artifactDir: website/out

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ tsconfig.tsbuildinfo
1616
recompile.sh
1717

1818
.next/
19+
out
File renamed without changes.

website/next.config.mjs

Lines changed: 32 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,24 @@ import { withGuildDocs } from 'guild-docs/next.config';
22
import { CategoryToPackages } from './src/category-to-packages.mjs';
33

44
const PLUGINS_REDIRECTS = Object.entries(CategoryToPackages).flatMap(([category, packageNames]) =>
5-
packageNames.map(packageName => ({
6-
source: `/plugins/${packageName}`,
7-
destination: `/plugins/${category}/${packageName}`,
8-
}))
5+
packageNames.map(packageName => [`/plugins/${packageName}`, `/plugins/${category}/${packageName}`])
96
);
10-
117
export default withGuildDocs({
8+
basePath: process.env.NEXT_BASE_PATH && process.env.NEXT_BASE_PATH !== '' ? process.env.NEXT_BASE_PATH : undefined,
129
eslint: {
1310
ignoreDuringBuilds: true,
1411
},
12+
experimental: {
13+
urlImports: [
14+
'https://graphql-modules.com/assets/subheader-logo.svg',
15+
'https://pbs.twimg.com/profile_images/1004185780313395200/ImZxrDWf_400x400.jpg',
16+
'https://raw.githubusercontent.com/mswjs/msw/HEAD/media/msw-logo.svg',
17+
],
18+
images: {
19+
unoptimized: true, // doesn't work with `next export`
20+
allowFutureImage: true,
21+
},
22+
},
1523
typescript: {
1624
// Todo: remove it before merge to master
1725
ignoreBuildErrors: true,
@@ -24,54 +32,23 @@ export default withGuildDocs({
2432
return config;
2533
},
2634
redirects: () =>
27-
[
28-
{
29-
source: '/docs/presets/:presetName',
30-
destination: '/plugins/:presetName-preset',
31-
},
32-
{
33-
source: '/docs/plugins/:pluginName',
34-
destination: '/plugins/:pluginName',
35-
},
36-
{
37-
source: '/docs/getting-started/config-reference/codegen-config',
38-
destination: '/docs/config-reference/codegen-config',
39-
},
40-
{
41-
source: '/docs/getting-started/codegen-config',
42-
destination: '/docs/config-reference/codegen-config',
43-
},
44-
{
45-
source: '/docs/getting-started/documents-field',
46-
destination: '/docs/config-reference/documents-field',
47-
},
48-
{
49-
source: '/docs/getting-started/schema-field',
50-
destination: '/docs/config-reference/schema-field',
51-
},
52-
{
53-
source: '/docs/getting-started/config-field',
54-
destination: '/docs/config-reference/config-field',
55-
},
56-
{
57-
source: '/docs/getting-started/lifecycle-hooks',
58-
destination: '/docs/config-reference/lifecycle-hooks',
59-
},
60-
{
61-
source: '/docs/getting-started/require-field',
62-
destination: '/docs/config-reference/require-field',
63-
},
64-
{
65-
source: '/docs/getting-started/naming-convention',
66-
destination: '/docs/config-reference/naming-convention',
67-
},
68-
{
69-
source: '/docs/getting-started/how-does-it-work',
70-
destination: '/docs/advanced/how-does-it-work',
71-
},
72-
...PLUGINS_REDIRECTS,
73-
].map(redirect => ({
74-
...redirect,
75-
permanent: true,
76-
})),
35+
Object.entries({
36+
'/docs/presets/:presetName': '/plugins/:presetName-preset',
37+
'/docs/plugins/:pluginName': '/plugins/:pluginName',
38+
'/docs/getting-started/config-reference/codegen-config': '/docs/config-reference/codegen-config',
39+
'/docs/getting-started/codegen-config': '/docs/config-reference/codegen-config',
40+
'/docs/getting-started/documents-field': '/docs/config-reference/documents-field',
41+
'/docs/getting-started/schema-field': '/docs/config-reference/schema-field',
42+
'/docs/getting-started/config-field': '/docs/config-reference/config-field',
43+
'/docs/getting-started/lifecycle-hooks': '/docs/config-reference/lifecycle-hooks',
44+
'/docs/getting-started/require-field': '/docs/config-reference/require-field',
45+
'/docs/getting-started/naming-convention': '/docs/config-reference/naming-convention',
46+
'/docs/getting-started/how-does-it-work': '/docs/advanced/how-does-it-work',
47+
})
48+
.concat(PLUGINS_REDIRECTS)
49+
.map(([from, to]) => ({
50+
source: from,
51+
destination: to,
52+
permanent: true,
53+
})),
7754
});
7.18 KB
Loading
Lines changed: 13 additions & 0 deletions
Loading
Lines changed: 38 additions & 0 deletions
Loading

website/next.lock/lock.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"https://graphql-modules.com/assets/subheader-logo.svg": {
3+
"resolved": "https://www.graphql-modules.com/assets/subheader-logo.svg",
4+
"integrity": "sha512-eleU6ZkDs8fTba3J5sUDInGhqo1xacMxD/1qqxDbVxxLH2uAtkpuT/meJdwR52j1w5XCA/4Q7THYHqy8Gnv6ew==",
5+
"contentType": "image/svg+xml"
6+
},
7+
"https://pbs.twimg.com/profile_images/1004185780313395200/ImZxrDWf_400x400.jpg": {
8+
"integrity": "sha512-cG48xw2bbCeB4A3ln54VIDa+FA/1FaVALiXO7RTkZx0a6tGdQwVGzLPKHfdDLZRWct4mmE1X+iCpenB/MpiTQg==",
9+
"contentType": "image/jpeg"
10+
},
11+
"https://raw.githubusercontent.com/mswjs/msw/HEAD/media/msw-logo.svg": {
12+
"integrity": "sha512-VlGvK9swTGVafmZnTCLw9T70xQvv0Oyge/mGF1p5h1fiZ7WK2XL/dB2WrodoiF+xOtB4NAEVQKHjtc9o9amgXw==",
13+
"contentType": "image/svg+xml"
14+
},
15+
"version": 1
16+
}

website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"@graphql-codegen/typescript-vue-apollo-smart-ops": "2.3.3",
6666
"@graphql-codegen/typescript-vue-urql": "2.3.3",
6767
"@monaco-editor/react": "4.4.5",
68-
"@theguild/components": "2.0.5",
68+
"@theguild/components": "2.1.0-alpha-20220818233926-7ce4562",
6969
"classnames": "2.3.1",
7070
"date-fns": "2.29.2",
7171
"dedent": "0.7.0",

0 commit comments

Comments
 (0)