Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
lumenwrites committed Aug 7, 2023
1 parent 5891099 commit db8f263
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions content-gdschool/00.introduction/01.demo-lesson.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ draft: false
slug: demo-lesson
title: What you'll learn in the course
thumbnail: images/course-thumbnail.png
testList:
- One
- Two
free: true
---

Expand Down
1 change: 0 additions & 1 deletion godot-node-essentials

This file was deleted.

1 change: 1 addition & 0 deletions learn-to-code-from-zero-with-godot-4
19 changes: 11 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ import matter from 'gray-matter'
import { copyFiles, readText, saveText, ensureDirExists, readJson, saveJson, slugify } from './utils'
import { zip } from 'zip-a-folder'

const WORKING_DIR = process.cwd() // + '/godot-node-essentials' // + '/course-content' // '/learn-to-code-with-godot' // + '/course-content' // + '/godot-node-essentials' // + `/learn-to-code-from-zero-test`
const CONTENT_DIR = `${WORKING_DIR}/content-gdschool`
const OUTPUT_DIR = `${WORKING_DIR}/content-gdschool-processed`
const RELEASES_DIR = `${WORKING_DIR}/content-gdschool-releases`
const WORKING_DIR = process.cwd() // + '/learn-to-code-from-zero-with-godot-4' // + '/godot-node-essentials' // + '/course-content' // '/learn-to-code-with-godot' // + '/course-content' // + '/godot-node-essentials' // + `/learn-to-code-from-zero-test`
const CONTENT_DIR = `${WORKING_DIR}/content`
const OUTPUT_DIR = `${WORKING_DIR}/content-processed`
const RELEASES_DIR = `${WORKING_DIR}/content-releases`
let config

async function main() {
loadConfig()
let courseIndexText = readText(`${CONTENT_DIR}/_index.md`)
const { data: courseFrontmatter } = matter(courseIndexText)
console.log('Course frontmatter', courseFrontmatter)
// Copy all files to the output folder
fs.rmSync(OUTPUT_DIR, { recursive: true, force: true })
copyFiles(CONTENT_DIR, OUTPUT_DIR)
Expand Down Expand Up @@ -56,10 +57,10 @@ async function main() {
saveText(lessonFilePath, lessonText)
}
}
console.log('Compressing the processed course')
const fileName = `${RELEASES_DIR}/${courseFrontmatter.slug}-${getDate()}.zip`
ensureDirExists(fileName)
await zip(OUTPUT_DIR, fileName)
// console.log('Compressing the processed course')
// const fileName = `${RELEASES_DIR}/${courseFrontmatter.slug}-${getDate()}.zip`
// ensureDirExists(fileName)
// await zip(OUTPUT_DIR, fileName)
}

function parseConfig(config) {
Expand Down Expand Up @@ -252,11 +253,13 @@ function indexLessonFiles() {
const { data: sectionFrontmatter } = matter(sectionIndex)
const lessonFileNames = fs.readdirSync(sectionFolderPath)
for (let lessonFileName of lessonFileNames) {
// console.log('[indexLessonFiles] ', lessonFileName)
const lessonFilePath = `${sectionFolderPath}/${lessonFileName}`
if (fs.lstatSync(lessonFilePath).isDirectory()) continue
if (['.DS_Store'].includes(lessonFileName)) continue
let lessonText = readText(lessonFilePath)
const { data: frontmatter, content } = matter(lessonText)
// console.log('[indexLessonFiles] frontmatter ', frontmatter)
let lesson = {
slug: slugify(frontmatter.title), // frontmatter.slug,
sectionSlug: sectionFrontmatter.slug,
Expand Down

0 comments on commit db8f263

Please sign in to comment.