formatting
This commit is contained in:
parent
699c018825
commit
71f555bdd8
20
src/build.ts
20
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 { render_markdown_to_html, render_markdown_to_html_inline_sync } from '@doc-utils/markdown2html';
|
||||||
|
|
||||||
import { glob } from 'glob';
|
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 { promises as fs } from 'fs';
|
||||||
import { dirname, join as path_join } from 'path';
|
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 { 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 { 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 {
|
interface BuildState {
|
||||||
conf: Config;
|
conf: Config;
|
||||||
@ -364,7 +365,10 @@ async function render_json_schema(state: BuildState, schema: unknown, out_file:
|
|||||||
// ===== Helpers =====
|
// ===== Helpers =====
|
||||||
|
|
||||||
async function map_input_file_to_output_file(state: BuildState, in_file: string, remove_exts?: string[], add_ext?: string) {
|
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));
|
let out_file = path_join(state.conf.output.root, in_file.slice(state.conf.input.root.length));
|
||||||
|
|
||||||
if (remove_exts) {
|
if (remove_exts) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user