msfs-layout-generator
v0.3.5
Published
Generate layout.json for MSFS community packages
Downloads
293
Readme
🛫 MSFS Layout Generator
A tool for Microsoft Flight Simulator (MSFS) developers to automatically generate and update layout.json files for their add-ons.
✨ Features
Automatic Layout Generation
Scans package directories and createslayout.jsonwith file metadataWatch changes in Package Directory
Scans all changes in provided directory and updateslayout.jsonaccordinglyManifest Integration
Automatically updatestotal_package_sizeinmanifest.jsonMultiple Processing Modes
Process single packages, multiple packages, or batch operationsBatch Processing
Interactive Windows batch file with menu system for easy useFlexible CLI
Command-line interface with various options for different workflowsTypeScript Support
Fully typed API for programmatic usage
📦 Installation & Quick Start
Windows batch file with menu system (recommended)
- Download
msfs-layout-generator.batfrom the latest release - Place it in your desired directory
- Double-click to run
- Choose options from the interactive menu
Manual Installation as a Global CLI Tool
npm install -g msfs-layout-generator💻 API Usage (For Developers)
Use your manager (npm, yarn, bun etc.) to install the package:
npm install msfs-layout-generatorSimple Usage
import { generateLayout } from 'msfs-layout-generator';
// Process a single package (throws on errors, uses default options)
await generateLayout("F:\\fs20\\Community\\my-package"); Advanced Usage with Options
import { processLayout } from 'msfs-layout-generator';
import type { ProcessOptions, ProcessResult } from 'msfs-layout-generator';
// Overwrite existing layout.json silently
await processLayout("./my-package", { force: true, quiet: true });
// Get a result object instead of throwing on errors
const result = await processLayout("./my-package", {
returnResult: true,
force: true
});
if (result.success) {
console.log(`Processed ${result.fileCount} files (${result.totalSize} bytes)`);
} else {
console.error(result.message);
}
// Generate layout without requiring or updating manifest.json
await processLayout("./my-package", {
force: true,
checkManifest: false,
skipManifestUpdate: true
});Exports
| Export | Type | Description |
|---|---|---|
| generateLayout(dir) | (dir: string) => Promise<void> | Simple wrapper — processes a package directory with default options. Throws on errors. |
| processLayout(dir, options?) | (dir: string, options?: ProcessOptions) => Promise<void \| ProcessResult> | Full-featured function with configurable options. |
ProcessOptions
| Option | Type | Default | Description |
|---|---|---|---|
| force | boolean | false | Overwrite existing layout.json |
| quiet | boolean | false | Suppress all console output |
| debug | boolean | false | Enable verbose debug logging |
| checkManifest | boolean | true | Require manifest.json to exist in the package directory |
| skipManifestUpdate | boolean | false | Skip updating total_package_size in manifest.json |
| returnResult | boolean | false | Return a ProcessResult object instead of void. When true, errors are returned in the result instead of thrown. |
ProcessResult
Returned when returnResult is true:
| Field | Type | Description |
|---|---|---|
| success | boolean | Whether the operation completed successfully |
| fileCount | number | Number of files included in layout.json |
| totalSize | number | Total package size in bytes |
| layoutPath | string | Absolute path to the generated layout.json |
| manifestPath | string | Absolute path to manifest.json |
| skippedFiles | number | Number of files that were excluded |
| message | string? | Error message (when success is false) |
Happy Flying! ✈️

