sdocs 0.0.4 → 0.0.6
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/app-gen.js +9 -1
- package/dist/client/favicon.png +0 -0
- package/dist/config.js +1 -1
- package/package.json +1 -1
package/dist/app-gen.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdir, writeFile, rm, readFile } from 'node:fs/promises';
|
|
1
|
+
import { mkdir, writeFile, rm, readFile, copyFile } from 'node:fs/promises';
|
|
2
2
|
import { dirname, resolve } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { discoverDocFiles, getSdocKind } from './server/discovery.js';
|
|
@@ -16,6 +16,7 @@ function generateIndexHtml(title) {
|
|
|
16
16
|
<head>
|
|
17
17
|
<meta charset="UTF-8">
|
|
18
18
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
19
|
+
<link rel="icon" type="image/png" href="./favicon.png">
|
|
19
20
|
<title>${title}</title>
|
|
20
21
|
</head>
|
|
21
22
|
<body>
|
|
@@ -86,6 +87,11 @@ function generatePreviewHtml(iframeVirtualId, css) {
|
|
|
86
87
|
</body>
|
|
87
88
|
</html>`;
|
|
88
89
|
}
|
|
90
|
+
/** Copy the favicon.png into the .sdocs/ directory */
|
|
91
|
+
async function copyFavicon(sdocsDir) {
|
|
92
|
+
const src = resolve(__dirname, 'client', 'favicon.png');
|
|
93
|
+
await copyFile(src, resolve(sdocsDir, 'favicon.png'));
|
|
94
|
+
}
|
|
89
95
|
/** Discover doc files and extract snippet names (lightweight, no highlighting) */
|
|
90
96
|
async function discoverSnippets(config, cwd) {
|
|
91
97
|
const files = await discoverDocFiles(config.include, cwd);
|
|
@@ -113,6 +119,7 @@ export async function generateDevFiles(config, cwd) {
|
|
|
113
119
|
await mkdir(sdocsDir, { recursive: true });
|
|
114
120
|
await writeFile(resolve(sdocsDir, 'index.html'), generateIndexHtml(config.logo));
|
|
115
121
|
await writeFile(resolve(sdocsDir, 'entry.js'), generateEntryJs(config));
|
|
122
|
+
await copyFavicon(sdocsDir);
|
|
116
123
|
return sdocsDir;
|
|
117
124
|
}
|
|
118
125
|
/** Generate .sdocs/ directory with entry + preview HTML files for build mode */
|
|
@@ -121,6 +128,7 @@ export async function generateBuildFiles(config, cwd) {
|
|
|
121
128
|
await mkdir(sdocsDir, { recursive: true });
|
|
122
129
|
await writeFile(resolve(sdocsDir, 'index.html'), generateIndexHtml(config.logo));
|
|
123
130
|
await writeFile(resolve(sdocsDir, 'entry.js'), generateEntryJs(config));
|
|
131
|
+
await copyFavicon(sdocsDir);
|
|
124
132
|
const inputs = {
|
|
125
133
|
main: resolve(sdocsDir, 'index.html'),
|
|
126
134
|
};
|
|
Binary file
|
package/dist/config.js
CHANGED