1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
Description: Fix for newer version of cosmiconfig (7.x)
Author: Pirate Praveen <praveen@debian.org>
Julian Gilbey <jdg@debian.org>
Forwarded: https://github.com/itgalaxy/webfont/issues/572
Last-Update: 2022-12-28
--- a/src/standalone/index.ts
+++ b/src/standalone/index.ts
@@ -3,7 +3,7 @@
import {Readable} from "stream";
import type {Result} from "../types/Result";
import SVGIcons2SVGFontStream from "svgicons2svgfont";
-import cosmiconfig from "cosmiconfig";
+import { cosmiconfig } from "cosmiconfig";
import crypto from "crypto";
import deepmerge from "deepmerge";
import {getGlyphsData} from "./glyphsData";
@@ -17,20 +17,16 @@
import wawoff2 from "wawoff2";
const buildConfig = async (options) => {
- let searchPath = process.cwd();
let configPath = null;
-
- if (options.configFile) {
- searchPath = null;
- configPath = path.resolve(process.cwd(), options.configFile);
- }
+ let config = null;
const configExplorer = cosmiconfig("webfont");
- let config = await configExplorer.search(searchPath);
-
- if (configPath) {
+ if (options.configFile) {
+ configPath = path.resolve(process.cwd(), options.configFile);
config = await configExplorer.load(configPath);
+ } else {
+ config = await configExplorer.search();
}
if (!config) {
|