slidev-workspace 0.6.1 → 0.6.2
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/cli.js +9 -14
- package/dist/index.d.ts +10 -0
- package/dist/plugin-slides.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -15,7 +15,7 @@ import { spawn } from "child_process";
|
|
|
15
15
|
//#region src/scripts/config.ts
|
|
16
16
|
const DEFAULT_CONFIG = {
|
|
17
17
|
slidesDir: ["./slides"],
|
|
18
|
-
outputDir: "./
|
|
18
|
+
outputDir: "./_gh-pages",
|
|
19
19
|
baseUrl: "/",
|
|
20
20
|
exclude: ["node_modules", ".git"],
|
|
21
21
|
hero: {
|
|
@@ -405,31 +405,26 @@ async function exportOgImages() {
|
|
|
405
405
|
process.exit(1);
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
async function
|
|
408
|
+
async function copySlidesToOutputDir() {
|
|
409
409
|
const workspaceCwd = process.env.SLIDEV_WORKSPACE_CWD || process.cwd();
|
|
410
410
|
const config = loadConfig(workspaceCwd);
|
|
411
411
|
const slidesDirs = resolveSlidesDirs(config, workspaceCwd);
|
|
412
|
-
const
|
|
413
|
-
console.log(
|
|
414
|
-
if (!existsSync(
|
|
412
|
+
const deployDir = resolve(workspaceCwd, config.outputDir);
|
|
413
|
+
console.log(`📁 Copying slide builds into ${deployDir}...`);
|
|
414
|
+
if (!existsSync(deployDir)) mkdirSync(deployDir, { recursive: true });
|
|
415
415
|
for (const slidesDir of slidesDirs) {
|
|
416
416
|
if (!existsSync(slidesDir)) continue;
|
|
417
417
|
const slides = readdirSync(slidesDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
|
|
418
418
|
for (const slideName of slides) {
|
|
419
419
|
const slideDistDir = join(slidesDir, slideName, "dist");
|
|
420
|
-
const targetDir = join(
|
|
420
|
+
const targetDir = join(deployDir, slideName);
|
|
421
421
|
if (existsSync(slideDistDir)) {
|
|
422
|
-
console.log(`📋 Copying ${slideName}
|
|
422
|
+
console.log(`📋 Copying ${slideName}...`);
|
|
423
423
|
await cp(slideDistDir, targetDir, { recursive: true });
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
|
|
428
|
-
if (existsSync(previewDistDir)) {
|
|
429
|
-
console.log("📋 Copying preview app as index...");
|
|
430
|
-
await cp(previewDistDir, ghPagesDir, { recursive: true });
|
|
431
|
-
}
|
|
432
|
-
console.log("✅ All files copied to _gh-pages successfully!");
|
|
427
|
+
console.log(`✅ All slide assets copied into ${deployDir}!`);
|
|
433
428
|
}
|
|
434
429
|
async function runViteBuild() {
|
|
435
430
|
try {
|
|
@@ -437,7 +432,7 @@ async function runViteBuild() {
|
|
|
437
432
|
console.log("📦 Building Slidev Workspace for production...");
|
|
438
433
|
const config = createViteConfig();
|
|
439
434
|
await build(config);
|
|
440
|
-
await
|
|
435
|
+
await copySlidesToOutputDir();
|
|
441
436
|
console.log("✅ Build completed successfully!");
|
|
442
437
|
} catch (error) {
|
|
443
438
|
console.error("❌ Build failed:", error);
|
package/dist/index.d.ts
CHANGED
|
@@ -55,14 +55,24 @@ declare function useSlides(): {
|
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region src/types/config.d.ts
|
|
57
57
|
interface HeroConfig {
|
|
58
|
+
/** Main heading displayed at the top of the workspace page. */
|
|
58
59
|
title: string;
|
|
60
|
+
/** Supporting copy shown under the hero title. */
|
|
59
61
|
description: string;
|
|
60
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Slidev Workspace configuration loaded from slidev-workspace.yaml.
|
|
65
|
+
*/
|
|
61
66
|
interface SlidevWorkspaceConfig {
|
|
67
|
+
/** One or more directories that contain slide packages. */
|
|
62
68
|
slidesDir: string[];
|
|
69
|
+
/** Where the aggregated preview app should output its build. */
|
|
63
70
|
outputDir: string;
|
|
71
|
+
/** Public base URL used when serving or building slides. */
|
|
64
72
|
baseUrl: string;
|
|
73
|
+
/** Folder names to ignore when scanning for slides. */
|
|
65
74
|
exclude: string[];
|
|
75
|
+
/** Hero content surfaced by the preview application. */
|
|
66
76
|
hero: HeroConfig;
|
|
67
77
|
}
|
|
68
78
|
//#endregion
|
package/dist/plugin-slides.js
CHANGED