slidev-prerender 0.0.1-alpha.2 → 0.0.1-alpha.3
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/run.mjs +3 -4
- package/package.json +1 -1
package/dist/run.mjs
CHANGED
|
@@ -40,6 +40,7 @@ async function getPageHtml(page, pageUrl) {
|
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/utils/file.ts
|
|
42
42
|
async function copyDir(src, dst) {
|
|
43
|
+
await fs.access(src);
|
|
43
44
|
await fs.mkdir(dst, { recursive: true });
|
|
44
45
|
for (const e of await fs.readdir(src, { withFileTypes: true })) {
|
|
45
46
|
const s = path.join(src, e.name);
|
|
@@ -164,12 +165,10 @@ async function run() {
|
|
|
164
165
|
throw new Error(`Slidev dist directory not found: ${slidevDist}\nPlease run 'slidev build' first.`);
|
|
165
166
|
}
|
|
166
167
|
await removeDist(outDir);
|
|
167
|
-
const assetsPath = path.join(slidevDist, "assets");
|
|
168
168
|
try {
|
|
169
|
-
await
|
|
170
|
-
await copyDir(assetsPath, path.join(outDir, "assets"));
|
|
169
|
+
await copyDir(slidevDist, outDir);
|
|
171
170
|
} catch {
|
|
172
|
-
console.warn(`Assets directory not found: ${
|
|
171
|
+
console.warn(`Assets directory not found: ${slidevDist}, skipping...`);
|
|
173
172
|
}
|
|
174
173
|
const { origin, close: serverClose } = await serveDist(slidevDist, port);
|
|
175
174
|
const browser = await chromium.launch();
|