@ncukondo/slide-generation 0.2.1 → 0.2.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/index.js +52 -23
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1515,7 +1515,7 @@ var Pipeline = class {
|
|
|
1515
1515
|
};
|
|
1516
1516
|
|
|
1517
1517
|
// src/index.ts
|
|
1518
|
-
var VERSION = "0.2.
|
|
1518
|
+
var VERSION = "0.2.2";
|
|
1519
1519
|
|
|
1520
1520
|
// src/cli/commands/convert.ts
|
|
1521
1521
|
import { Command } from "commander";
|
|
@@ -4768,10 +4768,11 @@ function createIconsCommand() {
|
|
|
4768
4768
|
|
|
4769
4769
|
// src/cli/commands/init.ts
|
|
4770
4770
|
import { Command as Command6 } from "commander";
|
|
4771
|
-
import { mkdir as mkdir7, writeFile as writeFile7, access as access10, readdir as readdir6 } from "fs/promises";
|
|
4771
|
+
import { mkdir as mkdir7, writeFile as writeFile7, access as access10, readdir as readdir6, cp } from "fs/promises";
|
|
4772
4772
|
import { existsSync } from "fs";
|
|
4773
4773
|
import { execSync as execSync2 } from "child_process";
|
|
4774
|
-
import { join as join15, resolve as resolve5 } from "path";
|
|
4774
|
+
import { dirname as dirname6, join as join15, resolve as resolve5 } from "path";
|
|
4775
|
+
import { fileURLToPath } from "url";
|
|
4775
4776
|
import chalk6 from "chalk";
|
|
4776
4777
|
import ora3 from "ora";
|
|
4777
4778
|
|
|
@@ -6031,6 +6032,13 @@ function generateSlideThemeCommand() {
|
|
|
6031
6032
|
}
|
|
6032
6033
|
|
|
6033
6034
|
// src/cli/commands/init.ts
|
|
6035
|
+
function getPackageRoot() {
|
|
6036
|
+
const __dirname = dirname6(fileURLToPath(import.meta.url));
|
|
6037
|
+
if (__dirname.includes("/src/")) {
|
|
6038
|
+
return join15(__dirname, "..", "..", "..");
|
|
6039
|
+
}
|
|
6040
|
+
return join15(__dirname, "..", "..");
|
|
6041
|
+
}
|
|
6034
6042
|
function createInitCommand() {
|
|
6035
6043
|
return new Command6("init").description("Initialize a new project").argument("[directory]", "Target directory", ".").option("--template <name>", "Initial template").option("--no-examples", "Do not create sample files").option("--no-ai-config", "Do not create AI assistant config files").option("--no-sources", "Do not create sources directory").option("--from-directory <path>", "Import materials from directory").option("--skip-marp-install", "Skip Marp CLI installation prompt").action(async (directory, options) => {
|
|
6036
6044
|
await executeInit(directory, options);
|
|
@@ -6055,6 +6063,20 @@ async function executeInit(directory, options) {
|
|
|
6055
6063
|
await mkdir7(targetDir, { recursive: true });
|
|
6056
6064
|
await mkdir7(join15(targetDir, "themes"), { recursive: true });
|
|
6057
6065
|
await mkdir7(join15(targetDir, "icons", "custom"), { recursive: true });
|
|
6066
|
+
const packageRoot = getPackageRoot();
|
|
6067
|
+
const sourceTemplatesDir = join15(packageRoot, "templates");
|
|
6068
|
+
const targetTemplatesDir = join15(targetDir, "templates");
|
|
6069
|
+
try {
|
|
6070
|
+
await access10(targetTemplatesDir);
|
|
6071
|
+
} catch {
|
|
6072
|
+
await cp(sourceTemplatesDir, targetTemplatesDir, { recursive: true });
|
|
6073
|
+
}
|
|
6074
|
+
const sourceIconsRegistry = join15(packageRoot, "icons", "registry.yaml");
|
|
6075
|
+
const targetIconsRegistry = join15(targetDir, "icons", "registry.yaml");
|
|
6076
|
+
await copyFileIfNotExists(sourceIconsRegistry, targetIconsRegistry);
|
|
6077
|
+
const sourceDefaultTheme = join15(packageRoot, "themes", "default.css");
|
|
6078
|
+
const targetDefaultTheme = join15(targetDir, "themes", "default.css");
|
|
6079
|
+
await copyFileIfNotExists(sourceDefaultTheme, targetDefaultTheme);
|
|
6058
6080
|
const configContent = generateConfigContent();
|
|
6059
6081
|
await writeFileIfNotExists(join15(targetDir, "config.yaml"), configContent);
|
|
6060
6082
|
const customCssContent = generateCustomCssContent();
|
|
@@ -6088,7 +6110,10 @@ async function executeInit(directory, options) {
|
|
|
6088
6110
|
console.log("");
|
|
6089
6111
|
console.log(chalk6.green("Created files:"));
|
|
6090
6112
|
console.log(` ${chalk6.cyan("config.yaml")} - Project configuration`);
|
|
6113
|
+
console.log(` ${chalk6.cyan("templates/")} - Slide templates`);
|
|
6114
|
+
console.log(` ${chalk6.cyan("themes/default.css")} - Default theme`);
|
|
6091
6115
|
console.log(` ${chalk6.cyan("themes/custom.css")} - Custom theme styles`);
|
|
6116
|
+
console.log(` ${chalk6.cyan("icons/registry.yaml")} - Icon registry`);
|
|
6092
6117
|
console.log(` ${chalk6.cyan("icons/custom/")} - Custom icons directory`);
|
|
6093
6118
|
if (includeExamples) {
|
|
6094
6119
|
console.log(` ${chalk6.cyan("presentation.yaml")} - Sample presentation`);
|
|
@@ -6130,6 +6155,13 @@ async function writeFileIfNotExists(filePath, content) {
|
|
|
6130
6155
|
await writeFile7(filePath, content, "utf-8");
|
|
6131
6156
|
}
|
|
6132
6157
|
}
|
|
6158
|
+
async function copyFileIfNotExists(source, dest) {
|
|
6159
|
+
try {
|
|
6160
|
+
await access10(dest);
|
|
6161
|
+
} catch {
|
|
6162
|
+
await cp(source, dest);
|
|
6163
|
+
}
|
|
6164
|
+
}
|
|
6133
6165
|
function isMarpCliInstalled() {
|
|
6134
6166
|
try {
|
|
6135
6167
|
execSync2("marp --version", { stdio: "pipe", timeout: 5e3 });
|
|
@@ -6260,14 +6292,12 @@ slides:
|
|
|
6260
6292
|
content:
|
|
6261
6293
|
title: My Presentation
|
|
6262
6294
|
subtitle: A sample slide deck
|
|
6263
|
-
author: Your Name
|
|
6264
6295
|
|
|
6265
|
-
- template:
|
|
6296
|
+
- template: bullet-list
|
|
6266
6297
|
content:
|
|
6267
6298
|
title: Introduction
|
|
6268
|
-
|
|
6269
|
-
Welcome to this presentation!
|
|
6270
|
-
|
|
6299
|
+
items:
|
|
6300
|
+
- Welcome to this presentation!
|
|
6271
6301
|
- Point one
|
|
6272
6302
|
- Point two
|
|
6273
6303
|
- Point three
|
|
@@ -6277,15 +6307,14 @@ slides:
|
|
|
6277
6307
|
title: Section Title
|
|
6278
6308
|
subtitle: Section description
|
|
6279
6309
|
|
|
6280
|
-
- template:
|
|
6310
|
+
- template: bullet-list
|
|
6281
6311
|
content:
|
|
6282
6312
|
title: Main Content
|
|
6283
|
-
|
|
6284
|
-
Here's the main content of your presentation.
|
|
6285
|
-
|
|
6286
|
-
You can use **markdown** formatting in the body text.
|
|
6313
|
+
items:
|
|
6314
|
+
- Here's the main content of your presentation.
|
|
6315
|
+
- You can use **markdown** formatting in the body text.
|
|
6287
6316
|
|
|
6288
|
-
- template:
|
|
6317
|
+
- template: section
|
|
6289
6318
|
content:
|
|
6290
6319
|
title: Thank You
|
|
6291
6320
|
subtitle: Questions?
|
|
@@ -6296,7 +6325,7 @@ slides:
|
|
|
6296
6325
|
// src/cli/commands/watch.ts
|
|
6297
6326
|
import { Command as Command7 } from "commander";
|
|
6298
6327
|
import { access as access11 } from "fs/promises";
|
|
6299
|
-
import { basename as basename7, dirname as
|
|
6328
|
+
import { basename as basename7, dirname as dirname7, join as join16 } from "path";
|
|
6300
6329
|
import chalk7 from "chalk";
|
|
6301
6330
|
import { watch as chokidarWatch2 } from "chokidar";
|
|
6302
6331
|
var WatchState = class {
|
|
@@ -6329,7 +6358,7 @@ var WatchState = class {
|
|
|
6329
6358
|
}
|
|
6330
6359
|
};
|
|
6331
6360
|
function getDefaultOutputPath2(inputPath) {
|
|
6332
|
-
const dir =
|
|
6361
|
+
const dir = dirname7(inputPath);
|
|
6333
6362
|
const base = basename7(inputPath, ".yaml");
|
|
6334
6363
|
return join16(dir, `${base}.md`);
|
|
6335
6364
|
}
|
|
@@ -6391,7 +6420,7 @@ async function executeWatch(inputPath, options) {
|
|
|
6391
6420
|
const configLoader = new ConfigLoader();
|
|
6392
6421
|
let configPath = options.config;
|
|
6393
6422
|
if (!configPath) {
|
|
6394
|
-
configPath = await configLoader.findConfig(
|
|
6423
|
+
configPath = await configLoader.findConfig(dirname7(inputPath));
|
|
6395
6424
|
}
|
|
6396
6425
|
const config = await configLoader.load(configPath);
|
|
6397
6426
|
const pipeline = new Pipeline(config);
|
|
@@ -6475,7 +6504,7 @@ async function executeWatch(inputPath, options) {
|
|
|
6475
6504
|
// src/cli/commands/images.ts
|
|
6476
6505
|
import { Command as Command8 } from "commander";
|
|
6477
6506
|
import { readFile as readFile15, stat as stat2, mkdir as mkdir8 } from "fs/promises";
|
|
6478
|
-
import { dirname as
|
|
6507
|
+
import { dirname as dirname8, basename as basename8, join as join17 } from "path";
|
|
6479
6508
|
import chalk8 from "chalk";
|
|
6480
6509
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
6481
6510
|
function createImagesCommand() {
|
|
@@ -6498,7 +6527,7 @@ function createImagesRequestCommand() {
|
|
|
6498
6527
|
async function executeImagesStatus(inputPath) {
|
|
6499
6528
|
try {
|
|
6500
6529
|
const slides = await loadPresentation(inputPath);
|
|
6501
|
-
const baseDir =
|
|
6530
|
+
const baseDir = dirname8(inputPath);
|
|
6502
6531
|
const validator = new ImageValidator(baseDir);
|
|
6503
6532
|
const imageRefs = validator.extractImageReferences(slides);
|
|
6504
6533
|
if (imageRefs.length === 0) {
|
|
@@ -6598,7 +6627,7 @@ async function outputImageStatus(stats, imageRefs, _validator, baseDir) {
|
|
|
6598
6627
|
async function executeImagesRequest(inputPath, options) {
|
|
6599
6628
|
try {
|
|
6600
6629
|
const slides = await loadPresentation(inputPath);
|
|
6601
|
-
const baseDir =
|
|
6630
|
+
const baseDir = dirname8(inputPath);
|
|
6602
6631
|
const validator = new ImageValidator(baseDir);
|
|
6603
6632
|
const missingImages = await validator.getMissingImages(slides);
|
|
6604
6633
|
if (missingImages.length === 0) {
|
|
@@ -6798,7 +6827,7 @@ async function processSingleFile(filePath, options) {
|
|
|
6798
6827
|
return;
|
|
6799
6828
|
}
|
|
6800
6829
|
const processor = new ImageProcessor();
|
|
6801
|
-
const dir =
|
|
6830
|
+
const dir = dirname8(filePath);
|
|
6802
6831
|
const filename = basename8(filePath);
|
|
6803
6832
|
const outputDir = join17(dir, options.output);
|
|
6804
6833
|
await mkdir8(outputDir, { recursive: true });
|
|
@@ -6897,7 +6926,7 @@ function parseBlurSpec(spec) {
|
|
|
6897
6926
|
// src/cli/commands/screenshot.ts
|
|
6898
6927
|
import { Command as Command9 } from "commander";
|
|
6899
6928
|
import { access as access12, mkdir as mkdir9, readdir as readdir7, unlink as unlink3 } from "fs/promises";
|
|
6900
|
-
import { basename as basename9, dirname as
|
|
6929
|
+
import { basename as basename9, dirname as dirname9, join as join18 } from "path";
|
|
6901
6930
|
import { execSync as execSync3, execFileSync as execFileSync3 } from "child_process";
|
|
6902
6931
|
import chalk9 from "chalk";
|
|
6903
6932
|
import ora4 from "ora";
|
|
@@ -6994,7 +7023,7 @@ async function executeScreenshot(inputPath, options) {
|
|
|
6994
7023
|
const configLoader = new ConfigLoader();
|
|
6995
7024
|
let configPath = options.config;
|
|
6996
7025
|
if (!configPath) {
|
|
6997
|
-
configPath = await configLoader.findConfig(
|
|
7026
|
+
configPath = await configLoader.findConfig(dirname9(inputPath));
|
|
6998
7027
|
}
|
|
6999
7028
|
const config = await configLoader.load(configPath);
|
|
7000
7029
|
spinner?.succeed("Configuration loaded");
|