|
| 1 | +import type { NextConfig } from 'next'; |
1 | 2 | import { withGuildDocs } from '@theguild/components/next.config'; |
2 | 3 |
|
3 | | -const config = withGuildDocs({ |
4 | | - redirects: async () => |
5 | | - Object.entries({ |
6 | | - '/docs/quick-start': '/docs', |
7 | | - '/tutorial': '/tutorial/basic', |
8 | | - '/tutorial/basic/00-introduction': '/tutorial/basic', |
9 | | - '/docs/testing': '/docs/features/testing', |
10 | | - '/docs/integrations': '/docs', |
11 | | - '/docs/features': '/docs', |
12 | | - '/v2/features/health-check': '/v2', |
13 | | - '/v2/features/defer-stream': '/v2', |
14 | | - '/v2/features/automatic-persisted-queries': '/v2', |
15 | | - '/v2/features/response-caching': '/v2', |
16 | | - '/v2/features/introspection': '/v2', |
17 | | - '/v2/features/persisted-operations': '/v2', |
18 | | - '/features/graphiql': '/docs/features/graphiql', |
19 | | - '/examples/graphql-ws': '/docs/features/subscriptions', |
20 | | - '/changelog': '/changelogs/graphql-yoga', |
21 | | - }).map(([from, to]) => ({ |
22 | | - source: from, |
23 | | - destination: to, |
24 | | - permanent: true, |
25 | | - })), |
26 | | - eslint: { |
27 | | - ignoreDuringBuilds: true, |
28 | | - }, |
29 | | - env: { |
30 | | - SITE_URL: 'https://the-guild.dev/graphql/yoga-server', |
31 | | - }, |
32 | | - output: 'export', |
33 | | -}); |
| 4 | +let config: NextConfig; |
34 | 5 |
|
35 | | -if (config.experimental?.turbo) { |
36 | | - // TODO: Migrate this in @theguild/components |
37 | | - config.turbopack = config.experimental!.turbo; |
38 | | - delete config.experimental!.turbo; |
| 6 | +try { |
| 7 | + config = withGuildDocs({ |
| 8 | + redirects: async () => |
| 9 | + Object.entries({ |
| 10 | + '/docs/quick-start': '/docs', |
| 11 | + '/tutorial': '/tutorial/basic', |
| 12 | + '/tutorial/basic/00-introduction': '/tutorial/basic', |
| 13 | + '/docs/testing': '/docs/features/testing', |
| 14 | + '/docs/integrations': '/docs', |
| 15 | + '/docs/features': '/docs', |
| 16 | + '/v2/features/health-check': '/v2', |
| 17 | + '/v2/features/defer-stream': '/v2', |
| 18 | + '/v2/features/automatic-persisted-queries': '/v2', |
| 19 | + '/v2/features/response-caching': '/v2', |
| 20 | + '/v2/features/introspection': '/v2', |
| 21 | + '/v2/features/persisted-operations': '/v2', |
| 22 | + '/features/graphiql': '/docs/features/graphiql', |
| 23 | + '/examples/graphql-ws': '/docs/features/subscriptions', |
| 24 | + '/changelog': '/changelogs/graphql-yoga', |
| 25 | + }).map(([from, to]) => ({ |
| 26 | + source: from, |
| 27 | + destination: to, |
| 28 | + permanent: true, |
| 29 | + })), |
| 30 | + env: { |
| 31 | + SITE_URL: 'https://the-guild.dev/graphql/yoga-server', |
| 32 | + }, |
| 33 | + output: 'export', |
| 34 | + }); |
| 35 | +} catch (e) { |
| 36 | + console.error('Error configuring Next.js:', e); |
| 37 | + process.exit(1); |
39 | 38 | } |
40 | 39 |
|
41 | 40 | export default config; |
0 commit comments