diff options
| author | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-02 18:51:45 +0300 |
|---|---|---|
| committer | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-02 18:51:45 +0300 |
| commit | d3261e64152397db2dca4d691a990c6bc2a6f4dd (patch) | |
| tree | fac2f7be638651181a72453d714f0f96675c2b8b /archived/projt-launcher/scripts/build-tomlplusplus.mjs | |
| parent | 31b9a8949ed0a288143e23bf739f2eb64fdc63be (diff) | |
| download | Project-Tick-d3261e64152397db2dca4d691a990c6bc2a6f4dd.tar.gz Project-Tick-d3261e64152397db2dca4d691a990c6bc2a6f4dd.zip | |
NOISSUE add archived projects
Signed-off-by: Mehmet Samet Duman <yongdohyun@projecttick.org>
Diffstat (limited to 'archived/projt-launcher/scripts/build-tomlplusplus.mjs')
| -rwxr-xr-x | archived/projt-launcher/scripts/build-tomlplusplus.mjs | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/archived/projt-launcher/scripts/build-tomlplusplus.mjs b/archived/projt-launcher/scripts/build-tomlplusplus.mjs new file mode 100755 index 0000000000..e294fe4776 --- /dev/null +++ b/archived/projt-launcher/scripts/build-tomlplusplus.mjs @@ -0,0 +1,110 @@ +#!/usr/bin/env node +/** + * Script to build toml++ documentation using Poxy + * This generates HTML documentation from the Doxygen-formatted markdown files + */ + +import { execSync } from 'child_process'; +import { existsSync, mkdirSync } from 'fs'; +import { join, dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +const projectRoot = join(__dirname, '..'); + +const colors = { + reset: '\x1b[0m', + green: '\x1b[32m', + yellow: '\x1b[33m', + red: '\x1b[31m', + blue: '\x1b[34m', +}; + +function log(message, color = colors.reset) { + console.log(`${color}${message}${colors.reset}`); +} + +function commandExists(command) { + try { + execSync(`which ${command}`, { stdio: 'ignore' }); + return true; + } catch { + return false; + } +} + +async function buildTomlPlusPlusDocs() { + log('\nšØ Building toml++ documentation...', colors.blue); + + // Check if dependencies exist + if (!commandExists('doxygen')) { + log('ā Doxygen is not installed!', colors.red); + log('Run: npm run setup:doxygen', colors.yellow); + process.exit(1); + } + + // Check for poxy in common locations + const poxyPaths = [ + 'poxy', + `${process.env.HOME}/.local/bin/poxy`, + ]; + + let poxyCommand = null; + for (const path of poxyPaths) { + if (commandExists(path)) { + poxyCommand = path; + break; + } + } + + if (!poxyCommand) { + log('ā Poxy is not installed or not in PATH!', colors.red); + log('Run: npm run setup:doxygen', colors.yellow); + log('Or add to PATH: export PATH="$HOME/.local/bin:$PATH"', colors.yellow); + process.exit(1); + } + + const tomlplusplusDir = join(projectRoot, 'website', 'tomlplusplus'); + + if (!existsSync(tomlplusplusDir)) { + log(`ā toml++ source directory not found: ${tomlplusplusDir}`, colors.red); + process.exit(1); + } + + try { + log('š Running Poxy to generate documentation...', colors.yellow); + + // Change to tomlplusplus directory and run poxy + process.chdir(tomlplusplusDir); + + // Run poxy - it will use the poxy.toml config file + // Fix PATH to use Homebrew Python instead of Nix Python (if present) + const fixedPath = `/opt/homebrew/bin:${process.env.HOME}/.local/bin:${process.env.PATH}`; + execSync(poxyCommand, { + stdio: 'inherit', + env: { ...process.env, PATH: fixedPath } + }); + + const outputDir = join(tomlplusplusDir, 'html'); + log('ā
toml++ documentation built successfully!', colors.green); + log(`š Output: ${outputDir}`, colors.blue); + log('š Will be copied to: _site/tomlplusplus/', colors.blue); + + } catch (error) { + log(`ā Failed to build documentation: ${error.message}`, colors.red); + log('\nš” Tips:', colors.yellow); + log(' - Make sure poxy.toml exists in website/tomlplusplus/', colors.yellow); + log(' - Check that all source files are present', colors.yellow); + log(' - Try running manually: cd website/tomlplusplus && poxy', colors.yellow); + process.exit(1); + } finally { + // Return to project root + process.chdir(projectRoot); + } +} + +buildTomlPlusPlusDocs().catch(error => { + log(`\nā Unexpected error: ${error.message}`, colors.red); + process.exit(1); +}); |
