Skip to content

Commit

Permalink
GraphQL Tools x Nextra 3 (#5625)
Browse files Browse the repository at this point in the history
* upd

* upd

* f111x

* f111x
  • Loading branch information
dimaMachina authored Oct 10, 2023
1 parent 82e7a34 commit e515061
Show file tree
Hide file tree
Showing 11 changed files with 813 additions and 574 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"lint": "eslint --ext .ts .",
"postinstall": "patch-package && husky install",
"prerelease": "yarn build",
"prettier": "prettier --ignore-path .prettierignore --write --list-different .",
"prettier:check": "prettier --ignore-path .prettierignore --check .",
"prettier": "prettier --cache --ignore-path .prettierignore --write --list-different .",
"prettier:check": "prettier --cache --ignore-path .prettierignore --check .",
"release": "changeset publish",
"test": "jest --no-watchman",
"test:leaks": "jest --no-watchman --detectOpenHandles --detectLeaks --logHeapUsage",
Expand Down
62 changes: 32 additions & 30 deletions scripts/build-api-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,27 @@ async function buildApiDocs(): Promise<void> {
);

await fsPromises.writeFile(
path.join(filePath, '_meta.json'),
JSON.stringify(
Object.fromEntries(
filesInDirectory
.map(fileName => {
fileName = fileName.replace(/\.md$/, '');
const key = fileName.toLowerCase();
const value = fileName.replace(/^.*\./, '');

if (filePath.endsWith('/modules')) {
return [key, `${value.replace('_src', '').replace(/_/g, '-')}`];
}

return [key, value];
})
.sort((a, b) => a[1].localeCompare(b[1])),
path.join(filePath, '_meta.ts'),
'export default ' +
JSON.stringify(
Object.fromEntries(
filesInDirectory
.map(fileName => {
fileName = fileName.replace(/\.md$/, '');
const key = fileName.toLowerCase();
const value = fileName.replace(/^.*\./, '');

if (filePath.endsWith('/modules')) {
return [key, `${value.replace('_src', '').replace(/_/g, '-')}`];
}

return [key, value];
})
.sort((a, b) => a[1].localeCompare(b[1])),
),
null,
2,
),
null,
2,
),
);
}

Expand All @@ -134,17 +135,18 @@ async function buildApiDocs(): Promise<void> {
}),
);
await fsPromises.writeFile(
path.join(OUTPUT_PATH, '_meta.json'),
JSON.stringify(
{
modules: 'Packages',
classes: 'Classes',
enums: 'Enums',
interfaces: 'Interfaces',
},
null,
2,
),
path.join(OUTPUT_PATH, '_meta.ts'),
'export default ' +
JSON.stringify(
{
modules: 'Packages',
classes: 'Classes',
enums: 'Enums',
interfaces: 'Interfaces',
},
null,
2,
),
);

// Remove the generated "README.md" file
Expand Down
3 changes: 0 additions & 3 deletions website/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { withGuildDocs } from '@theguild/components/next.config';

export default withGuildDocs({
images: {
unoptimized: true, // doesn't work with `next export`
},
redirects: () =>
Object.entries({
'/docs/directive-resolvers': '/docs/schema-directives',
Expand Down
4 changes: 2 additions & 2 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"start": "next start"
},
"dependencies": {
"@theguild/components": "5.2.5",
"next": "13.5.2",
"@theguild/components": "6.0.0",
"next": "13.5.4",
"next-sitemap": "4.2.3",
"react": "18.2.0",
"react-dom": "18.2.0"
Expand Down
14 changes: 0 additions & 14 deletions website/src/pages/_meta.json

This file was deleted.

14 changes: 14 additions & 0 deletions website/src/pages/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default {
index: {
title: 'Home',
type: 'page',
display: 'hidden',
theme: {
layout: 'raw',
},
},
docs: {
title: 'Docs',
type: 'page',
},
};
22 changes: 0 additions & 22 deletions website/src/pages/docs/_meta.json

This file was deleted.

22 changes: 22 additions & 0 deletions website/src/pages/docs/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export default {
introduction: 'Introduction',
'generate-schema': 'Executable Schemas',
resolvers: 'Resolvers',
'resolvers-composition': 'Resolvers Composition',
scalars: 'Custom Scalars and Enums',
mocking: 'Mocking',
connectors: 'Data Fetching',
'schema-directives': 'Schema Directives',
'schema-merging': 'Schema Merging',
'schema-stitching': {
title: 'Schema Stitching ↗',
href: 'https://the-guild.dev/graphql/stitching',
},
'server-setup': 'Setup an HTTP Server',
'schema-loading': 'Schema Loading',
'documents-loading': 'Documents Loading',
'graphql-tag-pluck': 'GraphQL Tag Pluck',
'relay-operation-optimizer': 'Relay Operation Optimizer',
migration: 'Migration',
api: 'API Reference',
};
6 changes: 0 additions & 6 deletions website/src/pages/docs/migration/_meta.json

This file was deleted.

6 changes: 6 additions & 0 deletions website/src/pages/docs/migration/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
'migration-from-import': 'From GraphQL Import',
'migration-from-merge-graphql-schemas': 'From Merge GraphQL Schemas',
'migration-from-toolkit': 'From GraphQL Toolkit',
'migration-from-tools': 'From Tools v4 - v6',
};
Loading

0 comments on commit e515061

Please sign in to comment.