| 56 | } |
| 57 | |
| 58 | function showHelp(): void { |
| 59 | console.log(` |
| 60 | svelteesp32 - Svelte JS to ESP32 converter |
| 61 | |
| 62 | Commands: |
| 63 | init Create .svelteesp32rc.json interactively |
| 64 | |
| 65 | Configuration: |
| 66 | --config <path> Use custom RC file (default: search for .svelteesp32rc.json) |
| 67 | |
| 68 | Options: |
| 69 | -e, --engine <value> The engine for which the include file is created |
| 70 | (psychic|async|espidf|webserver) (default: "psychic") |
| 71 | -s, --sourcepath <path> Source dist folder with compiled web files (required) |
| 72 | -o, --outputfile <path> Generated output file with path (default: "svelteesp32.h") |
| 73 | --etag <value> Use ETAG header for cache (always|never|compiler) (default: "never") |
| 74 | --gzip <value> Compress content with gzip (always|never|compiler) (default: "always") |
| 75 | --created Include creation time in the output file (default: false) |
| 76 | --version <value> Include version info in the output file (default: "") |
| 77 | --espmethod <name> Name of generated method (default: "initSvelteStaticFiles") |
| 78 | --define <prefix> Prefix of c++ defines (default: "SVELTEESP32") |
| 79 | --cachetime <seconds> max-age cache time in seconds (default: 0) |
| 80 | --cachetimehtml <sec> Cache-Control max-age for HTML files (overrides --cachetime) |
| 81 | --cachetimeassets <sec> Cache-Control max-age for non-HTML assets (overrides --cachetime) |
| 82 | --exclude <pattern> Exclude files matching glob pattern (repeatable or comma-separated) |
| 83 | Examples: --exclude="*.map" --exclude="test/**/*.ts" |
| 84 | --basepath <path> URL prefix for all routes (e.g., "/ui") (default: "") |
| 85 | --maxsize <size> Maximum total uncompressed size (e.g., 400k, 1.5m, 409600) |
| 86 | --maxgzipsize <size> Maximum total gzip size (e.g., 150k, 1m, 153600) |
| 87 | --dryrun Show summary without writing the output file (default: false) |
| 88 | --analyze Print per-file size table and budget status without writing (default: false) |
| 89 | --spa Serve index.html for unmatched routes (SPA routing) (default: false) |
| 90 | --manifest Write companion JSON manifest file alongside the header (default: false) |
| 91 | -h, --help Show this help |
| 92 | |
| 93 | RC File: |
| 94 | The tool searches for .svelteesp32rc.json in: |
| 95 | 1. Current directory (./.svelteesp32rc.json) |
| 96 | 2. User home directory (~/.svelteesp32rc.json) |
| 97 | |
| 98 | Example RC file (all fields optional): |
| 99 | { |
| 100 | "engine": "psychic", |
| 101 | "sourcepath": "./dist", |
| 102 | "outputfile": "./output.h", |
| 103 | "etag": "always", |
| 104 | "gzip": "always", |
| 105 | "exclude": ["*.map", "*.md"], |
| 106 | "basepath": "/ui", |
| 107 | "maxsize": "400k", |
| 108 | "maxgzipsize": "150k", |
| 109 | "noindexcheck": false, |
| 110 | "spa": false |
| 111 | } |
| 112 | |
| 113 | CLI arguments override RC file values. |
| 114 | `); |
| 115 | process.exit(0); |