import Foundation
import HTML
import PathKit
@preconcurrency import Saga
import SagaParsleyMarkdownReader
import SagaSwimRenderer
@main
struct Run {
static func main() async throws {
try await Saga(input: "content", output: "deploy")
// All the remaining markdown files will be parsed to html,
// using the default EmptyMetadata as the Item's metadata type.
.register(
metadata: PageMetadata.self,
readers: [.parsleyMarkdownReader],
itemWriteMode: .keepAsFile, // need to keep 404.md as 404.html, not 404/index.html
writers: [.itemWriter(swim(renderPage))]
)
// Run the steps we registered above
.run()
// All the remaining files that were not parsed to markdown, so for example images, raw html files and css,
// are copied as-is to the output folder.
.staticFiles()
}
}