A Node.js command-line tool for compiling Q-Sys plugins with support for file inclusion and image encoding.
- File Inclusion: Embed Lua files using
#includedirectives - Image Encoding: Convert images to base64 and embed them directly in your plugin
- Version Management: Automatically increment plugin versions (major, minor, fix, dev)
- UUID Generation: Auto-generate unique plugin IDs
- Circular Include Detection: Prevents infinite loops from circular file dependencies
- Use any IDE: Configure this to run for build tasks in your IDE of choice
- PNG (
.png) - JPEG (
.jpg,.jpeg) - SVG (
.svg)
npm installEnsure Node.js is installed on your system.
node qsys-compiler.jsCompiles the plugin using default settings (current directory, plugin.lua as main file).
node qsys-compiler.js [options]| Option | Short | Description | Default |
|---|---|---|---|
--source |
-s |
Source directory | Current directory |
--main |
-m |
Main plugin file | plugin.lua |
--output |
-o |
Output file name | Auto-generated from directory name |
--info |
-i |
Info file name | info.lua |
--build-type |
-b |
Version increment type | ver_dev |
--help |
-h |
Show help message | — |
| Type | Behavior | Example |
|---|---|---|
ver_maj |
Increment major version | 1.0.0.0 → 2.0.0.0 |
ver_min |
Increment minor version | 1.0.0.0 → 1.1.0.0 |
ver_fix |
Increment fix version | 1.0.0.0 → 1.0.1.0 |
ver_dev |
Increment dev version (default) | 1.0.0.0 → 1.0.0.1 |
# Compile with minor version increment
node qsys-compiler.js --build-type ver_min
# Compile from a specific directory with custom output name
node qsys-compiler.js --source ./my-plugin --output MyPlugin.qplug
# Specify all options
node qsys-compiler.js -s ./plugins/myapp -m main.lua -o compiled.qplug -b ver_fixUse the #include directive to embed Lua files:
--[[ #include "helpers.lua" ]]
--[[ #include "lib/utilities.lua" ]]The compiler will:
- Find the referenced file relative to the source directory
- Replace the directive with the file contents
- Process any nested includes within the included file
- Wrap the content with begin/end markers for clarity
The compiler detects and prevents circular includes:
-- file-a.lua
--[[ #include "file-b.lua" ]]
-- file-b.lua
--[[ #include "file-a.lua" ]] -- This will trigger a warningUse the #encode directive to embed images:
Logo = "--[[ #encode "logo.png" ]]"
table.insert(graphics, {
Type="Image",
Image=Logo,
Position={0,0},
Size={75,9}
})For SVG files:
Icon = "--[[ #encode "icon.svg" ]]"
table.insert(graphics, {
Type="svg",
Image=Icon,
Position={0,0},
Size={75,9}
})Images can be placed in subdirectories relative to your source directory:
--[[ #encode "assets/images/logo.png" ]]
--[[ #encode "img/icons/settings.svg" ]]- PNG/JPEG: Encoded as raw base64 string
- SVG: Encoded as raw base64 string
The compiler logs the size of each encoded image in kilobytes.
my-plugin/
├── plugin.lua # Main plugin file
├── info.lua # Plugin information with version
├── helpers.lua # Included via #include
├── assets/
│ └── logo.png # Encoded via #encode
└── my-plugin.qplug # Compiled output
The info.lua file should contain the plugin metadata:
Info = {
Id = "<guid>",
BuildVersion = "1.0.0.0",
Name = "My Plugin"
}<guid>: Will be replaced with an auto-generated UUIDBuildVersion: Will be incremented based on the build type
- Organize your files: Structure your plugin with includes and images
- Use directives: Add
#includeand#encodedirectives in your Lua code - Compile: Run the compiler with desired options
- Version management: The tool automatically updates
info.luawith new version and UUID - Deploy: Use the generated
.qplugfile in your Q-Sys environment
The compiler provides helpful error messages:
- File not found: Warning if an included file or image doesn't exist
- Circular includes: Warning with filename if a circular dependency is detected
- Encoding errors: Error message if an image can't be read or is in an unsupported format
- Missing info.lua: Error if the info file is not found (if processing versions)
The compiler generates:
- Compiled plugin file (
.qplug): Your ready-to-deploy plugin - Updated info.lua: With new version and/or UUID
- Console output: Detailed compilation log with:
- Files processed
- Versions updated
- Images encoded (with file sizes)
- Final output path and file size
"Main file not found"
- Verify the file exists and the path is correct
- Use
-mflag to specify the correct main file name
"Image file not found"
- Check the image path is relative to your source directory
- Verify the file exists and the path is spelled correctly
"Circular include detected"
- Review your include structure
Large file sizes
- Base64 encoding increases file size by ~33%
- Consider compressing images before encoding
- Use SVG for vector graphics when possible
MIT
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.