Initial commit: HMDesignSystem baseline
This commit is contained in:
commit
b6a0a61103
486 files changed
+68432
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { mkdirSync, readdirSync, writeFileSync, unlinkSync } from "node:fs"
|
||||
import { read, repositoryRoot, validateDocument } from "./theme-contract.mjs"
|
||||
|
||||
// Independent Theme artifact. Does not build UI/Graphic or generate package CSS.
|
||||
// Only top-level themes/*.json are published; historic drafts stay out.
|
||||
const directory = new URL("../themes/", import.meta.url)
|
||||
const themes = readdirSync(directory).filter(file => file.endsWith(".json")).sort()
|
||||
if (!themes.includes("default.json")) throw Error("Missing themes/default.json")
|
||||
const documents = themes.map(file => [file, validateDocument(JSON.parse(read(`themes/${file}`)), file === "default.json")])
|
||||
const output = new URL("theme-dist/themes/", repositoryRoot)
|
||||
mkdirSync(output, { recursive: true })
|
||||
// Only generated top-level JSON artifacts in this explicit workspace output.
|
||||
for (const file of readdirSync(output).filter(file => file.endsWith(".json") && !themes.includes(file))) unlinkSync(new URL(file, output))
|
||||
for (const [file, theme] of documents) {
|
||||
writeFileSync(new URL(file, output), JSON.stringify(theme, null, 2) + "\n")
|
||||
}
|
||||
console.log(`Validated/exported ${themes.length} independent Theme artifacts to theme-dist/themes/`)
|
||||
Reference in new issue
Block a user