diff --git a/src/build.ts b/src/build.ts index b818043..d053b07 100644 --- a/src/build.ts +++ b/src/build.ts @@ -4,17 +4,18 @@ import { build_markdown_from_json_schema } from '@doc-utils/jsonschema2markdown' import { render_markdown_to_html, render_markdown_to_html_inline_sync } from '@doc-utils/markdown2html'; import { glob } from 'glob'; -import { Config } from './conf'; +import { DateTime } from 'luxon'; +import { stringify as to_yaml } from 'yaml'; + import { promises as fs } from 'fs'; import { dirname, join as path_join } from 'path'; -import { build_env_scope } from './env'; -import { load_layout, Context, render_template, load_partials, load_extras, FrontMatter } from './template'; -import { DateTime } from 'luxon'; -import assert = require('assert'); -import { load_themes, render_theme_css_properties } from './themes'; + import { icons } from './icons'; +import { Config } from './conf'; +import { build_env_scope } from './env'; +import { load_themes, render_theme_css_properties } from './themes'; import { mkdirp, read_json, read_text, read_yaml, write_text } from './fs'; -import { stringify as to_yaml } from 'yaml'; +import { load_layout, Context, render_template, load_partials, load_extras, FrontMatter } from './template'; interface BuildState { conf: Config; @@ -364,7 +365,10 @@ async function render_json_schema(state: BuildState, schema: unknown, out_file: // ===== Helpers ===== async function map_input_file_to_output_file(state: BuildState, in_file: string, remove_exts?: string[], add_ext?: string) { - assert(in_file.startsWith(state.conf.input.root), 'input file expected to be inside input root'); + if (! in_file.startsWith(state.conf.input.root)) { + throw new Error('input file expected to be inside input root'); + } + let out_file = path_join(state.conf.output.root, in_file.slice(state.conf.input.root.length)); if (remove_exts) {