forked from coderplex-org/coderplex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
451 lines (446 loc) · 12.6 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
const { ANALYZE } = process.env;
// For now copy paste from utils mockdata later we will fetch these from API
// We cannot import from utils/mockData.js because this file is not transpiled so does not support es6 modules
const listOfSubjects = [
{
id: '2132',
title: 'Laravel',
domain: 'Web Development',
path: '/learn/laravel/Choosing-laravel',
subjectId: 'laravel',
icon: 'devicon-laravel-plain colored',
learningCount: '20',
isGuideCompleted: true,
githubUrl: 'https://github.com/coderplex/learn/blob/master/web-dev/Backend/Learn-Laravel.md',
},
{
id: '213',
title: 'ReactJS',
domain: 'Web Development',
path: '/learn/reactjs/Choosing-ReactJS',
subjectId: 'reactjs',
icon: 'devicon-react-original colored',
learningCount: '28',
isGuideCompleted: true,
githubUrl:
'https://github.com/coderplex/learn/blob/master/web-dev/Frontend/Libraries%20%26%20Frameworks/Learn-React.md',
},
{
id: '2131',
title: 'Go',
domain: 'Programming Language',
path: '/learn/go',
subjectId: 'go',
icon: 'devicon-go-plain colored',
learningCount: '7',
isGuideCompleted: false,
githubUrl: 'https://github.com/coderplex/learn/blob/master/programming-languages/Go/learn-go.md',
},
{
id: '21fa3',
title: 'Android',
domain: 'Mobile Technology',
path: '/learn/android',
subjectId: 'android',
icon: 'devicon-android-plain colored',
learningCount: '9',
isGuideCompleted: false,
githubUrl: 'https://github.com/coderplex/learn/blob/master/mobile-dev/Android/learn-android.md',
},
{
id: '21afasda3',
title: 'Rails',
domain: 'Backend Development',
path: '/learn/rails',
subjectId: 'rails',
icon: 'devicon-rails-plain colored',
learningCount: '14',
isGuideCompleted: false,
githubUrl: 'https://github.com/coderplex/learn/blob/master/web-dev/Backend/Learn-Rails.md',
},
{
id: '21wqerwqe3',
title: 'Python',
domain: 'Programming Language',
path: '/learn/python',
subjectId: 'python',
icon: 'devicon-python-plain colored',
learningCount: '32',
isGuideCompleted: false,
githubUrl: 'https://github.com/coderplex/learn/tree/master/programming-languages/Python',
},
{
id: '2bxcvbx13',
title: 'iOS',
domain: 'Mobile Technology',
path: '/learn/ios',
subjectId: 'ios',
icon: 'devicon-swift-plain colored',
learningCount: '45',
isGuideCompleted: false,
githubUrl: 'https://github.com/coderplex/learn/blob/master/mobile-dev/iOS/Learn-iOS.md',
},
{
id: '2bxczzxcvbx13',
title: 'Javascript',
domain: 'Programming Language',
path: '/learn/javascript',
subjectId: 'javascript',
icon: 'devicon-javascript-plain colored',
learningCount: '31',
isGuideCompleted: false,
githubUrl: 'https://github.com/coderplex/learn/blob/master/web-dev/Frontend/learn-intermediate.md',
},
{
id: '2bxdfasczzxcvbx13',
title: 'Angular',
domain: 'Frontend Development',
path: '/learn/angular',
subjectId: 'angular',
icon: 'devicon-angularjs-plain colored',
learningCount: '3',
isGuideCompleted: false,
githubUrl:
'https://github.com/coderplex/learn/blob/master/web-dev/Frontend/Libraries%20%26%20Frameworks/Learn-Angular.md',
},
];
const laravelSyllabus = [
{
unit: 'Preface',
chapters: [
{
name: 'Choosing laravel',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/choosing-laravel.md',
},
{
name: 'Prerequisites',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/prerequisites.md',
},
{
name: 'Installation',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/installation.md',
},
],
},
{
unit: 'Models, Views, Controllers and Routes',
chapters: [
{
name: 'Introduction to MVC',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/introduction-to-mvc.md',
},
{
name: 'Basic Routing and Views',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/basic-routing-and-views.md',
},
{
name: 'Pass Data to Views',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/pass-data-to-views.md',
},
{
name: 'Database Setup',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/database-setup.md',
},
{
name: 'Working with Query Builder',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/working-with-query-builder.md',
},
{
name: 'Eloquent',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/eloquent.md',
},
{
name: 'Controllers',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/controllers.md',
},
{
name: 'Route Model Binding',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/route-model-binding.md',
},
],
},
{
unit: 'Front-End',
chapters: [
{
name: 'Layouts and Structures',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/layouts-and-structures.md',
},
{
name: 'Form Requests and CSRF',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/form-requests-and-CSRF.md',
},
{
name: 'Form Validation',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/form-validation.md',
},
{
name: 'Rendering',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/rendering',
},
{
name: 'Laravel Mix',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/laravel-mix.md',
},
{
name: 'Flash Messaging',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/flash-messaging.md',
},
],
},
{
unit: 'Relationships',
chapters: [
{
name: 'Eloquent Relationships',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/eloquent-relationships.md',
},
{
name: 'One-to-Many Relationship',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/one-to-many-relationship.md',
},
{
name: 'Pivot Tables',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/pivot-tables.md',
},
],
},
{
unit: 'Authentication',
chapters: [
{
name: 'Scaffold Authentication',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/scaffold-authentication.md',
},
{
name: 'Manual Authentication',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/manual-authentication.md',
},
],
},
{
unit: 'View Composers and Archives',
chapters: [
{
name: 'Add Archives',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/add-archives.md',
},
{
name: 'View Composers',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/view-composers.md',
},
],
},
{
unit: 'Testing & Seeding',
chapters: [
{
name: 'Testing',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/testing.md',
},
{
name: 'Seeding',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/laravel/seeding.md',
},
],
},
];
const reactSyllabus = [
{
unit: 'Preface',
chapters: [
{
name: 'Choosing ReactJS',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/choosing-reactjs.md',
},
{
name: 'Prerequisites',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/prerequisites.md',
},
{
name: 'Philosophy',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/philosophy.md',
},
],
},
{
unit: 'Getting Started',
chapters: [
{
name: 'Trying React',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/trying-react.md',
},
{
name: 'Create React App',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/create-react-app.md',
},
{
name: 'JavaScript XML Syntax',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/javascript-xml-syntax.md',
},
],
},
{
unit: 'Components',
chapters: [
{
name: 'Custom Components',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/custom-components.md',
},
{
name: 'Rendering',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/rendering.md',
},
{
name: 'Conditional Rendering',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/conditional-rendering.md',
},
{
name: 'Data Flow',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/data-flow.md',
},
{
name: 'Lifecycle',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/lifecycle.md',
},
{
name: 'Events',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/events.md',
},
],
},
{
unit: 'Forms',
chapters: [
{
name: 'Controlled Components',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/controlled-components.md',
},
{
name: 'Uncontrolled Components',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/uncontrolled-components.md',
},
],
},
{
unit: 'Composition',
chapters: [
{
name: 'Lifting State Up',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/lifting-state-up.md',
},
{
name: 'Composition vs Inheritance',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/composition-vs-inheritance.md',
},
{
name: 'Context',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/context.md',
},
],
},
{
unit: 'Tools',
chapters: [
{
name: 'Developer Tools',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/developer-tools.md',
},
{
name: 'Proptypes',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/proptypes.md',
},
{
name: 'Error Boundaries',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/error-boundaries.md',
},
],
},
{
unit: 'In depth discussions',
chapters: [
{
name: 'JSX In Depth',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/jsx-in-depth.md',
},
{
name: 'Synthetic Events',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/synthetic-events.md',
},
{
name: 'React Without JSX',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/react-without-jsx.md',
},
{
name: 'React without ES6',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/react-without-es6.md',
},
{
name: 'Reconcilation Diff Algorithm',
cdnUrl: 'https://rawgit.com/coderplex/learn/cdn/react/reconcilation---diff-algorithm.md',
},
],
},
];
module.exports = {
webpack: (config, { dev }) => {
/* Enable only in Production */
if (!dev) {
// Preact
// console.log('> Using Preact instead of React');
// config.resolve.alias = {
// react: 'preact-compat/dist/preact-compat',
// 'react-dom': 'preact-compat/dist/preact-compat',
// 'react-emotion': 'preact-emotion',
// };
if (ANALYZE) {
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'server',
analyzerPort: 8888,
openAnalyzer: true,
})
);
}
}
return config;
},
exportPathMap() {
const routes = {
'/': { page: '/' },
'/events': { page: '/events' },
'/learn': { page: '/learn' },
'/space': { page: '/space' },
'/login': { page: '/login' },
};
const getSubject = subjectId => {
switch (subjectId) {
case 'laravel':
return laravelSyllabus;
case 'reactjs':
return reactSyllabus;
default:
return [];
}
};
for (const subject of listOfSubjects) {
for (const unit of getSubject(subject.subjectId)) {
const chapters = unit.chapters;
for (const chapter of chapters) {
const chapterSlug = chapter.name.replace(/\s/gi, '-');
const route = `learn/${subject.subjectId}/${chapterSlug}`;
routes[route] = {
page: '/learn/subject',
query: {
subject: subject.subjectId,
chapter: chapterSlug,
},
};
}
}
}
console.log(routes);
return routes;
},
};