forked from drashland/website-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
209 lines (208 loc) · 6.17 KB
/
next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
// next.config.js
module.exports = {
publicRuntimeConfig: {
app: {
env: process.APP_ENV || "production",
},
localStorageKeys: {
darkMode: "drash_land_dark_mode",
},
// A list of modules that have been migrated over to Next.js. This is used
// in the `[...path_params].js` file. If documentation pages for a module
// are requested, then `[...path_params].js` will check to see if that
// module is listed here and will do one of the following:
//
// - If the module is not listed here, then Next.js will end up showing
// the 404 page.
// - If the module is listed here, then Next.js will redirect the user to:
// /{module}/{version}/getting-started/introduction
// - If a module is listed here AND is set to redirect (see the
// `redirects` config down below), then Next.js will redirect the user
// using the `destination` in the `redirects` config.
modules: [
"dmm",
"drash",
"line",
"sinco",
"wocket",
"rhum",
"vital",
],
docDenoLandUrls: {
dmm: "https://doc.deno.land/https/deno.land/x/dmm/mod.ts",
drash: "https://doc.deno.land/https/deno.land/x/drash/mod.ts",
line: "https://doc.deno.land/https/deno.land/x/line/mod.ts",
rhum: "https://doc.deno.land/https/deno.land/x/rhum/mod.ts",
sinco: "https://doc.deno.land/https/deno.land/x/sinco/mod.ts",
wocket: "https://doc.deno.land/https/deno.land/x/wocket/mod.ts",
vital: "https://doc.deno.land/https/deno.land/x/vital/mod.ts",
},
gitHubUrls: {
dmm: "https://github.com/drashland/dmm",
drash: "https://github.com/drashland/drash",
line: "https://github.com/drashland/line",
sinco: "https://github.com/drashland/sinco",
rhum: "https://github.com/drashland/rhum",
wocket: "https://github.com/drashland/wocket",
website: "https://github.com/drashland/website-v2",
vital: "https://github.com/drashland/vital",
},
roadmapsUrls: {
drash:
"https://github.com/drashland/drash/issues?q=is%3Aissue+is%3Aopen+roadmap",
line:
"https://github.com/drashland/line/issues?q=is%3Aissue+is%3Aopen+roadmap",
},
versions: {
drash: {
versions: [
"v1.x",
"v2.x",
],
},
line: {
versions: [
"v0.x",
"v1.x",
],
},
sinco: {
versions: [
"v1.x",
"v2.x",
"v3.x",
"v4.x",
],
},
wocket: {
versions: [
"v0.x",
"v1.x",
],
},
dmm: {
versions: [
"v1.x",
"v2.x",
],
},
rhum: {
versions: [
"v1.x",
"v2.x",
],
},
vital: {
versions: [
"v1.x",
],
},
},
},
reactStrictMode: false,
redirects() {
return [
// Redirect pages without content to the nearest page with content
{
source: "/drash/v2.x/getting-started",
destination: "/drash/v2.x/getting-started/introduction",
permanent: false,
},
{
source: "/drash/v2.x/tutorials",
destination:
"/drash/v2.x/tutorials/introduction/add-drash-as-a-dependency",
permanent: false,
},
{
source: "/drash/v2.x/tutorials/resources",
destination: "/drash/v2.x/tutorials/resources/creating-a-resource",
permanent: false,
},
{
source: "/drash/v2.x/tutorials/requests",
destination: "/drash/v2.x/tutorials/requests/handling-json-bodies",
permanent: false,
},
{
source: "/drash/v2.x/tutorials/responses",
destination: "/drash/v2.x/tutorials/responses/setting-the-body",
permanent: false,
},
{
source: "/drash/v2.x/tutorials/services",
destination: "/drash/v2.x/tutorials/services/introduction",
permanent: false,
},
// Remove the below /drash/v1.x object when its migrated
{
source: "/drash/v1.x",
destination: "/drash/v1.x/index.html",
permanent: false,
},
{
source: "/wocket/v0.x",
destination: "/wocket/v0.x/index.html",
permanent: false,
},
// Remove the below /dmm object when the its migrated
{
source: "/dmm/v1.x",
destination: "/dmm/v1.x/index.html",
permanent: false,
},
// Remove the below /rhum object when the its migrated
{
source: "/rhum/v1.x",
destination: "/rhum/v1.x/index.html",
permanent: false,
},
{
source: "/line/v0.x",
destination: "/line/v0.x/index.html",
permanent: false,
},
{
source: "/sinco/v1.x",
destination: "/sinco/v1.x/index.html",
permanent: false,
},
// Redirect pages that have their URLs changed and document when the redirection should be
// removed. Redirections should be removed at least 2 months out.
permanentRedirect(
// Remove on 07-01-2022
"/drash/v2.x/tutorials/services/introduction",
"/drash/v2.x/tutorials/services/basics",
),
permanentRedirect(
// Remove on 07-01-2022
"/drash/v2.x/tutorials/services/creating-services",
"/drash/v2.x/tutorials/services/creating-services/introduction",
),
permanentRedirect(
// Remove on 07-01-2022
"/drash/v2.x/tutorials/services/adding-server-level-services",
"/drash/v2.x/tutorials/services/creating-services/server-level/introduction",
),
permanentRedirect(
// Remove on 07-01-2022
"/drash/v2.x/tutorials/services/adding-resource-level-services",
"/drash/v2.x/tutorials/services/creating-services/resource-level/introduction",
),
];
},
};
/**
* Create a permanent redirect.
*
* @param {string} source - Where are we redirecting from?
* @param {string} destination - Where are we redirecting to?
* @returns {object} - Object with source, destination, and permanent fields.
*/
function permanentRedirect(source, destination) {
return {
source,
destination,
permanent: true,
};
}