2.6.0 • Published 3 years ago

scriptpacker v2.6.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

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

  1. Create a script file to import, Unicorn.wren for example:

    class Unicorn {
    	construct new() {
    		System.print("Greetings.")
    	}
    	run() {
    		System.print("Running!")
    	}
    }
  2. 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()
  3. Run the build command

    scriptpack build index.wren --output=packed.wren
  4. 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"
2.6.0

3 years ago

2.5.0

3 years ago

2.5.1

3 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.1

5 years ago

2.0.0

5 years ago