UNPKG

honkit

Version:

HonKit is building beautiful books using Markdown.

27 lines (25 loc) 1.03 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = __importDefault(require("path")); /** Return path to output folder @param {Array} args @return {string} */ function getOutputFolder(args) { const bookRoot = path_1.default.resolve(args[0] || process.cwd()); const defaultOutputRoot = path_1.default.join(bookRoot, "_book"); // Fix: Resolve relative output folder paths against the book root (not process.cwd()). // Absolute paths are preserved as-is. This ensures the output folder is correctly ignored // by the file watcher. See: https://github.com/honkit/honkit/issues/491 const outputFolder = args[1] ? path_1.default.isAbsolute(args[1]) ? args[1] : path_1.default.resolve(bookRoot, args[1]) : defaultOutputRoot; return outputFolder; } exports.default = getOutputFolder;