File: cosmiconfig-7-compat.patch

package info (click to toggle)
node-webfont 11.4.0%2Bdfsg2%2B~cs35.7.26-15
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 122,048 kB
  • sloc: xml: 3,682,028; ansic: 31,165; javascript: 12,580; cpp: 4,386; python: 689; sh: 307; makefile: 228
file content (43 lines) | stat: -rw-r--r-- 1,294 bytes parent folder | download | duplicates (3)
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) {