File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed
Expand file tree Collapse file tree 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 1111 "scripts" : {
1212 "dev" : " gatsby develop -H 0.0.0.0" ,
1313 "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" ,
1515 "serve" : " gatsby serve" ,
1616 "clean" : " gatsby clean" ,
1717 "test" : " jest" ,
Original file line number Diff line number Diff line change 2727
2828# shortcuts - 302
2929
30-
3130/flock-view https://editor.p5js.org/codingtrain/sketches/fFNCIQw4e 302 !
3231/decade https://donorbox.org/to-the-power-of-10 302 !
3332/noc https://nostarch.com/nature-code 302 !
6261/p5js /tracks/code-programming-with-p5-js 302 !
6362/processing /tracks/learning-processing 302 !
6463/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