CHGenerator/WebsiteGenerator/main.swift
2022-08-19 18:05:06 +02:00

43 lines
1.1 KiB
Swift

import Foundation
let contentDirectory = URL(fileURLWithPath: "/Users/ch/Projects/MakerSpace")
let outputDirectory = URL(fileURLWithPath: "/Users/ch/Projects/MakerSpace/Site")
let context = Context(inputFolder: contentDirectory, outputFolder: outputDirectory)
let siteData: Element
do {
guard let element = try Element(atRoot: contentDirectory, with: context) else {
exit(0)
}
siteData = element
} catch {
print(error)
exit(0)
}
siteData.printTree()
context.fileSystem.printChangedFilesOverview()
context.fileSystem.didGenerateAllFiles()
exit(0)
let files = FileProcessor(
inputFolder: contentDirectory, outputFolder: outputDirectory)
// 1: Load all site content
guard let site = try Site(folder: contentDirectory) else {
exit(0)
}
// site.printContents()
let siteGenerator = try SiteGenerator(site: site, files: files)
try siteGenerator.generate()
print("Pages generated")
try files.createImages()
print("Images generated")
try files.copyRequiredFiles()
print("Required files copied")
#warning("Check that all metadata for each language is present")