@mintlify/prebuild 1.0.342 → 1.0.344
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/prebuild/generateFavicons.d.ts +3 -4
- package/dist/prebuild/generateFavicons.js +33 -9
- package/dist/prebuild/update/ConfigUpdater.d.ts +3000 -360
- package/dist/prebuild/update/index.d.ts +4386 -1
- package/dist/prebuild/update/index.js +2 -2
- package/dist/prebuild/update/updateFavicons.d.ts +3 -4
- package/dist/prebuild/update/updateFavicons.js +18 -14
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}, contentDirectoryPath: string) => Promise<import("favicons").FaviconResponse | undefined>;
|
|
1
|
+
import type { MintConfig } from '@mintlify/models';
|
|
2
|
+
import { DocsConfig } from '@mintlify/validation';
|
|
3
|
+
export declare const generateFavicons: (config: MintConfig | DocsConfig, contentDirectoryPath: string) => Promise<import("favicons").FaviconResponse[] | undefined>;
|
|
@@ -2,17 +2,41 @@ import favicons from 'favicons';
|
|
|
2
2
|
import { promises as _promises } from 'fs';
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
const { readFile } = _promises;
|
|
5
|
-
export const generateFavicons = async (
|
|
6
|
-
if (
|
|
5
|
+
export const generateFavicons = async (config, contentDirectoryPath) => {
|
|
6
|
+
if (config.favicon == null)
|
|
7
7
|
return;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
if (typeof config.favicon === 'string') {
|
|
9
|
+
const desiredPath = join(contentDirectoryPath, config.favicon);
|
|
10
|
+
const favicon = await readFile(desiredPath);
|
|
11
|
+
try {
|
|
12
|
+
const icons = await favicons(favicon, faviconConfig(config.name));
|
|
13
|
+
return [icons];
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
if (typeof err === 'object' && err != null && 'message' in err)
|
|
17
|
+
console.log(err.message); // Error description e.g. "An unknown error has occurred"
|
|
18
|
+
}
|
|
12
19
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
else {
|
|
21
|
+
// Light and dark favicons case
|
|
22
|
+
try {
|
|
23
|
+
const lightPath = join(contentDirectoryPath, config.favicon.light);
|
|
24
|
+
const darkPath = join(contentDirectoryPath, config.favicon.dark);
|
|
25
|
+
const lightFavicon = await readFile(lightPath);
|
|
26
|
+
const darkFavicon = await readFile(darkPath);
|
|
27
|
+
const [lightIcons, darkIcons] = await Promise.all([
|
|
28
|
+
favicons(lightFavicon, faviconConfig(config.name)),
|
|
29
|
+
favicons(darkFavicon, {
|
|
30
|
+
...faviconConfig(config.name),
|
|
31
|
+
path: '/favicons-dark',
|
|
32
|
+
}),
|
|
33
|
+
]);
|
|
34
|
+
return [lightIcons, darkIcons];
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
if (typeof err === 'object' && err != null && 'message' in err)
|
|
38
|
+
console.log(err.message);
|
|
39
|
+
}
|
|
16
40
|
}
|
|
17
41
|
};
|
|
18
42
|
const faviconConfig = (name) => ({
|