mirror of
https://github.com/StepanovPlaton/SSAUGenerator.git
synced 2026-10-31 10:18:29 +04:00
Rename project to SSAU Generator and restructure content
- Move projects into content/<project>/{docx,pptx} with shared assets/
- Flatten config paths; output = project name in project folder
- Add pptx --init scaffold; remove docx exe build
- Add feature-complete content/example; ignore content/* except example
- Rewrite README and AGENTS.md
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { build } = require("./build");
|
||||
const { ensureScaffold } = require("./scaffold");
|
||||
|
||||
function parseArgs(argv) {
|
||||
const options = { config: "config.yaml" };
|
||||
@@ -20,6 +22,9 @@ function parseArgs(argv) {
|
||||
case "--check":
|
||||
options.check = true;
|
||||
break;
|
||||
case "--init":
|
||||
options.init = true;
|
||||
break;
|
||||
case "--verbose":
|
||||
case "-v":
|
||||
options.verbose = true;
|
||||
@@ -43,15 +48,16 @@ function parseArgs(argv) {
|
||||
}
|
||||
|
||||
function printHelp() {
|
||||
console.log(`lab-gen-pptx — генератор презентаций PPTX из Markdown
|
||||
console.log(`SSAU Generator PPTX — генератор презентаций PPTX из Markdown
|
||||
|
||||
Использование:
|
||||
lab-gen-pptx [config.yaml] [опции]
|
||||
node pptx/src/cli.js [config.yaml] [опции]
|
||||
|
||||
Опции:
|
||||
-c, --config <file> путь к config.yaml (по умолчанию config.yaml)
|
||||
-o, --output <file> переопределить имя выходного файла
|
||||
--check только проверить конфигурацию и ссылки
|
||||
--init создать шаблон config.yaml/slides/assets и выйти
|
||||
-v, --verbose подробный вывод
|
||||
-h, --help показать справку
|
||||
--version показать версию
|
||||
@@ -68,6 +74,26 @@ async function main() {
|
||||
}
|
||||
|
||||
const configPath = path.resolve(options.config);
|
||||
|
||||
if (options.init || !fs.existsSync(configPath)) {
|
||||
const targetDir = path.dirname(configPath);
|
||||
try {
|
||||
const created = await ensureScaffold(targetDir);
|
||||
if (created.length) {
|
||||
console.log("Создан шаблон генератора:");
|
||||
created.forEach((file) => console.log(" " + path.relative(targetDir, file)));
|
||||
} else {
|
||||
console.log("Файлы уже существуют, ничего не создано.");
|
||||
}
|
||||
console.log("");
|
||||
console.log("Отредактируйте config.yaml и файлы в slides/, затем запустите генератор снова.");
|
||||
} catch (error) {
|
||||
console.error(error.message);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await build({ config: configPath, check: options.check, output: options.output });
|
||||
const { config, issues } = result;
|
||||
|
||||
Reference in New Issue
Block a user