gnolang / gno-by-example

Tutorials and snippets for learning Gno
https://gno-by-example.com
Apache License 2.0
4 stars 4 forks source link

Multiple sections break tutorial generation script #160

Closed leohhhn closed 4 months ago

leohhhn commented 4 months ago

Description

The README does not document the exact way to add new sections, so I tried with the logical approach:

Screenshot 2024-04-17 at 16 03 14

Investigating and printing out errors, this is what it comes up with:

❯ yarn generate
yarn run v1.22.21
warning ../../../package.json: No license field
$ npx tsx ./scripts/generate.ts
Subdirs found:  [ 'basics', 'chain' ]
There should be only one .md file in the directory
✅ Generated tutorial for: src/tutorials/gno.land/gbe/basics
There should be only one .md file in the directory
✅ Generated tutorial for: src/tutorials/gno.land/gbe/chain
❌ Error encountered during tutorial generation TypeError: Cannot read properties of undefined (reading 'link')
    at <anonymous> (/Users/sasurai/Desktop/gno/gbe/scripts/generate.ts:165:52)
    at Array.forEach (<anonymous>)
    at generateTutorialRoutes (/Users/sasurai/Desktop/gno/gbe/scripts/generate.ts:164:9)
    at generateTutorials (/Users/sasurai/Desktop/gno/gbe/scripts/generate.ts:253:9)
✨  Done in 1.78s.

EDIT: from the README, I think the idea was to keep all tutorials in on the same level in the tutorials/gno.land/gbe/ dir. It will prove a bit difficult to organize tutorials without support for actual subfolders, instead of just writing the name of the section in the README of the tutorial.

I added section folder support in #162.

leohhhn commented 4 months ago

Fixed in #162