Style updates
This commit is contained in:
parent
a9a979c5f8
commit
e7218143ec
18 changed files with 928 additions and 230 deletions
|
@ -17,7 +17,7 @@ import { FileNotFoundError } from "./errors";
|
|||
|
||||
// binding.yaml file schema
|
||||
const BindingSchema = z.object({
|
||||
extend: z.string().optional(),
|
||||
include: z.array(z.string()).default([]),
|
||||
|
||||
name: z.string().default("Unnamed playbill"),
|
||||
author: z.string().default("Someone"),
|
||||
|
@ -25,6 +25,7 @@ const BindingSchema = z.object({
|
|||
version: z.string().default("0.0.0"),
|
||||
|
||||
files: z.array(z.string()).default(["**/*.yaml", "**/*.md"]),
|
||||
omitDefaultStyles: z.boolean().default(false),
|
||||
styles: z
|
||||
.union([z.string(), z.array(z.string())])
|
||||
.transform((val) => (Array.isArray(val) ? val : [val]))
|
||||
|
@ -40,7 +41,7 @@ export interface BoundPlaybill {
|
|||
// File information
|
||||
bindingFilePath: string;
|
||||
bindingFileDirname: string;
|
||||
includedFiles: string[];
|
||||
files: string[];
|
||||
componentFiles: ComponentFile[];
|
||||
|
||||
// Binding properties
|
||||
|
@ -49,6 +50,7 @@ export interface BoundPlaybill {
|
|||
version: string;
|
||||
description: string;
|
||||
|
||||
omitDefaultStyles: boolean;
|
||||
styles: string;
|
||||
|
||||
playbill: Playbill;
|
||||
|
@ -94,8 +96,8 @@ export async function loadFromBinding(
|
|||
const playbill = new Playbill();
|
||||
|
||||
// If this is extending another binding, load that first
|
||||
if (binding.extend) {
|
||||
const pathFromHere = path.resolve(bindingFileDirname, binding.extend);
|
||||
for (const includePath of binding.include) {
|
||||
const pathFromHere = path.resolve(bindingFileDirname, includePath);
|
||||
const extendBindingPath = await resolveBindingPath(pathFromHere);
|
||||
const loadedBinding = await loadFromBinding(extendBindingPath);
|
||||
playbill.extend(loadedBinding.playbill);
|
||||
|
@ -239,7 +241,7 @@ export async function loadFromBinding(
|
|||
_raw: binding,
|
||||
bindingFilePath: bindingPath,
|
||||
bindingFileDirname,
|
||||
includedFiles: filePathsWithoutBindingFile,
|
||||
files: filePathsWithoutBindingFile,
|
||||
componentFiles,
|
||||
|
||||
name: binding.name,
|
||||
|
@ -247,6 +249,7 @@ export async function loadFromBinding(
|
|||
description: binding.description ?? "",
|
||||
version: binding.version,
|
||||
|
||||
omitDefaultStyles: binding.omitDefaultStyles,
|
||||
styles,
|
||||
|
||||
playbill,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue