scriptpacker
v2.6.0
Published
Pack multiple Lua/Wren/Squirrel/ChaiScript/JavaScript scripts together
Downloads
3
Maintainers
Readme
ScriptPacker
Package multiple Lua, Wren, Squirrel, Javascript, or ChaiScript scripts together into one bundle, through JavaScript.
Features
- Lua
require "MyModule"
- Squirrel
import("MyModule")
- Wren
import "MyModule"
- Gravity
#include "MyModule.gravity"
- ChaiScript
require("MyModule")
- JavaScript
require("MyModule")
- Retains dependency tree
- Relative import paths
Installation
npm i -g scriptpacker
Usage
scriptpacker build [input]
Build the given file
Positionals:
input The input file to build [default: "index.wren"]
Options:
--version Show version number [boolean]
--help Show help [boolean]
--output, -o Where to write the file [string] [default: "packed.<ext>"]
--minify, -m Minify the output [boolean] [default: false]
--prefix, -p Text to prefix the output [string] [default: ""]
Example
Create a script file to import,
Unicorn.wren
for example:class Unicorn { construct new() { System.print("Greetings.") } run() { System.print("Running!") } }
Use
import
to bundle the module:import "Unicorn" // In Squirrel, it would be: import("Unicorn") // Use the imported class. var unicorn = Unicorn.new() unicorn.run()
Run the build command
scriptpack build index.wren --output=packed.wren
See the resulting
packed.wren
// Unicorn.wren class Unicorn { construct new() { System.print("Greetings.") } run() { System.print("Running!") } } // Game.wren // import "Unicorn" var unicorn = Unicorn.new() unicorn.run()
Documentation
The following are examples of loading the Unicorn script across the different languages...
Lua
require "Unicorn"
// ... or
require("Unicorn")
Wren
import "Unicorn"
Squirrel
import("Unicorn")
ChaiScript
require("Unicorn")
JavaScript
require("Unicorn")
Gravity
#include "Unicorn.gravity"