UNPKG

@vivliostyle/cli

Version:

Save the pdf file via headless browser and Vivliostyle.

69 lines (67 loc) 2.36 kB
import { create } from "../chunk-PYPAYBFL.js"; import { createParserProgram, gracefulError } from "../chunk-DBK27BAR.js"; import "../chunk-7GIJVX4M.js"; import { versionForDisplay } from "../chunk-OAFXM4ES.js"; import "../chunk-I7BWSAN6.js"; // src/commands/create.parser.ts import { Command, Option } from "commander"; function setupCreateParserProgram() { const program = new Command(); program.name("vivliostyle create").description("scaffold a new Vivliostyle project").arguments("[projectPath]").option("--title <title>", "title").option("--author <author>", "author").option("-l, --language <language>", "language").option("-s, --size <size>", "paper size").option("-T, --theme <theme>", "theme").option("--no-theme", "Do not include a theme.").option( "--template <template>", `Template source in the format of \`[provider]:repo[/subpath][#ref]\` or as a local directory to copy from.` ).option( "--install-dependencies", "Install dependencies after creating a project." ).option( "--no-install-dependencies", "Do not install dependencies after creating a project." ).option( "--create-config-file-only", `Create a Vivliostyle config file without generating project template files.` ).addOption( new Option("--proxy-server <proxyServer>", `HTTP/SOCK proxy server url`) ).addOption( new Option( "--proxy-bypass <proxyBypass>", `optional comma-separated domains to bypass proxy` ) ).addOption( new Option( "--proxy-user <proxyUser>", `optional username for HTTP proxy authentication` ) ).addOption( new Option( "--proxy-pass <proxyPass>", `optional password for HTTP proxy authentication` ) ).addOption( new Option( "--log-level <level>", "specify a log level of console outputs" ).choices(["silent", "info", "verbose", "debug"]).default("info") ).version(versionForDisplay, "-v, --version"); return program; } var parseCreateCommand = createParserProgram({ setupProgram: setupCreateParserProgram, parseArgs: (options, [projectPath]) => ({ ...options, projectPath }) }); // src/commands/create.ts try { const inlineConfig = parseCreateCommand(process.argv); await create(inlineConfig); } catch (err) { if (err instanceof Error) { gracefulError(err); } } //# sourceMappingURL=create.js.map