Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robloach/scriptpacker
Package multiple Wren, Squirrel or ChaiScript files into one, through JavaScript.
https://github.com/robloach/scriptpacker
chaiscript lua squirrel wren
Last synced: about 2 months ago
JSON representation
Package multiple Wren, Squirrel or ChaiScript files into one, through JavaScript.
- Host: GitHub
- URL: https://github.com/robloach/scriptpacker
- Owner: RobLoach
- License: mit
- Created: 2019-06-29T04:37:04.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-30T19:18:31.000Z (over 3 years ago)
- Last Synced: 2024-04-25T12:20:27.550Z (8 months ago)
- Topics: chaiscript, lua, squirrel, wren
- Language: JavaScript
- Homepage: https://npm.im/scriptpacker
- Size: 30.3 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ScriptPacker
Package multiple [Lua](https://www.lua.org/), [Wren](http://wren.io), [Squirrel](http://squirrel-lang.org/), Javascript, or [ChaiScript](http://chaiscript.com/) scripts together into one bundle, through JavaScript.
## Features
- [Lua](https://www.lua.org/) `require "MyModule"`
- [Squirrel](http://squirrel-lang.org) `import("MyModule")`
- [Wren](http://wren.io) `import "MyModule"`
- [Gravity](https://github.com/marcobambini/gravity) `#include "MyModule.gravity"`
- [ChaiScript](http://chaiscript.com) `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."]
--minify, -m Minify the output [boolean] [default: false]
--prefix, -p Text to prefix the output [string] [default: ""]
```## Example
1. Create a script file to import, `Unicorn.wren` for example:
``` wren
class Unicorn {
construct new() {
System.print("Greetings.")
}
run() {
System.print("Running!")
}
}
```2. Use `import` to bundle the module:
``` wren
import "Unicorn"
// In Squirrel, it would be: import("Unicorn")
// Use the imported class.
var unicorn = Unicorn.new()
unicorn.run()
```3. Run the build command
``` bash
scriptpack build index.wren --output=packed.wren
```4. See the resulting `packed.wren`
``` 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](https://www.lua.org)
``` javascript
require "Unicorn"// ... or
require("Unicorn")
```### [Wren](https://github.com/wren-lang/wren)
``` javascript
import "Unicorn"
```### [Squirrel](http://www.squirrel-lang.org)
``` javascript
import("Unicorn")
```### [ChaiScript](http://chaiscript.com)
``` javascript
require("Unicorn")
```### JavaScript
``` javascript
require("Unicorn")
```### [Gravity](https://github.com/marcobambini/gravity)
``` swift
#include "Unicorn.gravity"
```