Code Monkey home page Code Monkey logo

scriptpacker's Introduction

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...

require "Unicorn"

// ... or
require("Unicorn")
import "Unicorn"
import("Unicorn")
require("Unicorn")

JavaScript

require("Unicorn")
#include "Unicorn.gravity"

scriptpacker's People

Contributors

robloach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

xevin

scriptpacker's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.