UNPKG

@ikona/cli

Version:
86 lines (82 loc) 3.45 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/utils/merge-config.ts var merge_config_exports = {}; __export(merge_config_exports, { mergeConfigs: () => mergeConfigs }); module.exports = __toCommonJS(merge_config_exports); // src/utils/config.ts var import_bundle_n_require = require("bundle-n-require"); var import_sync = __toESM(require("escalade/sync")); var defaultConfig = { verbose: false, outputDir: ".ikona", force: false, icons: { optimize: false, inputDir: "icons", spriteOutputDir: "output", hash: false }, illustrations: { inputDir: "illustrations", extensions: ["svg", "png", "jpg", "jpeg", "webp"] }, cwd: process.cwd() }; var configs = [".ts", ".js", ".mts", ".mjs", ".cts", ".cjs"]; var configRegex = new RegExp(`ikona.config(${configs.join("|")})$`); // src/utils/merge-config.ts var mergeConfigs = ({ cliConfig, fileConfig }) => { return { verbose: cliConfig.v ?? cliConfig.verbose ?? fileConfig.verbose ?? defaultConfig.verbose, outputDir: cliConfig["out-dir"] ?? fileConfig.outputDir ?? defaultConfig.outputDir, force: cliConfig.force ?? fileConfig.force ?? defaultConfig.force, icons: { optimize: cliConfig.optimize ?? fileConfig.icons?.optimize ?? defaultConfig.icons.optimize, inputDir: fileConfig.icons?.inputDir ?? defaultConfig.icons.inputDir, // TODO add missing cli config flag spriteOutputDir: fileConfig.icons?.spriteOutputDir ?? defaultConfig.icons.spriteOutputDir, // TODO add missing cli config flag hash: cliConfig.hash ?? fileConfig.icons?.hash ?? defaultConfig.icons.hash }, illustrations: { inputDir: fileConfig.illustrations?.inputDir ?? defaultConfig.illustrations.inputDir, // TODO add missing cli config flag extensions: fileConfig.illustrations?.extensions ?? defaultConfig.illustrations.extensions // TODO add missing cli config flag }, cwd: cliConfig.cwd ?? fileConfig.cwd ?? defaultConfig.cwd }; }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { mergeConfigs });