File tree 3 files changed +20
-6
lines changed
3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change
1
+ const { appendFileSync } = require ( 'node:fs' ) ;
2
+ const { slugs } = require ( '../content-testing/content' ) ;
3
+
4
+ let challengesRedirects = '\n' ;
5
+ slugs . challenges . forEach ( ( slug ) => {
6
+ const videoNumber = slug . split ( '-' ) [ 0 ] ;
7
+ challengesRedirects += `/${ videoNumber } /challenges/${ slug } 302!\n` ;
8
+ } ) ;
9
+
10
+ const redirectsFilePath = './static/_redirects' ;
11
+ appendFileSync ( redirectsFilePath , challengesRedirects ) ;
12
+
13
+ console . log (
14
+ `${ slugs . challenges . size } challenges redirects were appended to '${ redirectsFilePath } '`
15
+ ) ;
Original file line number Diff line number Diff line change 11
11
"scripts" : {
12
12
"dev" : " gatsby develop -H 0.0.0.0" ,
13
13
"build" : " gatsby build --verbose" ,
14
- "build-ci" : " npm run tags-transforms && npm run build" ,
14
+ "build-ci" : " node node-scripts/generate-challenges-redirects && npm run tags-transforms && npm run build" ,
15
15
"serve" : " gatsby serve" ,
16
16
"clean" : " gatsby clean" ,
17
17
"test" : " jest" ,
Original file line number Diff line number Diff line change 27
27
28
28
# shortcuts - 302
29
29
30
-
31
30
/flock-view https://editor.p5js.org/codingtrain/sketches/fFNCIQw4e 302 !
32
31
/decade https://donorbox.org/to-the-power-of-10 302 !
33
32
/noc https://nostarch.com/nature-code 302 !
62
61
/p5js /tracks/code-programming-with-p5-js 302 !
63
62
/processing /tracks/learning-processing 302 !
64
63
/genuary1 https://editor.p5js.org/codingtrain/sketches/vN8EEr59I 302 !
65
- /particles https://thecodingtrain.com /challenges/78-simple-particle-system 302 !
66
- /ca https://thecodingtrain.com /challenges/179-wolfram-ca 302 !
67
- /182 https://thecodingtrain.com/challenges/182-apollonian-gasket 302 !
68
- /180 https://thecodingtrain.com/ challenges/180-falling-sand 302 !
64
+ /particles /challenges/78-simple-particle-system 302 !
65
+ /ca /challenges/179-wolfram-ca 302 !
66
+
67
+ # challenges shortcuts will be appended to this file at build time as /{videoNumber} -> /challenges/{slug}
You can’t perform that action at this time.
0 commit comments