All Projects → chronoDave → tic-bundle

chronoDave / tic-bundle

Licence: GPL-3.0 license
Multi-file development in TIC-80

Programming Languages

javascript
184084 projects - #8 most used programming language
lua
6591 projects

Projects that are alternatives of or similar to tic-bundle

Tic 80
TIC-80 is a fantasy computer for making, playing and sharing tiny games.
Stars: ✭ 3,176 (+24330.77%)
Mutual labels:  tic80, tic-80, fantasy-console
feup-8
TIC-80 fork enabling server-side unit testing to help kids learn how to code, by developing games!
Stars: ✭ 27 (+107.69%)
Mutual labels:  tic-80, fantasy-console
Pyxel
A retro game engine for Python
Stars: ✭ 9,133 (+70153.85%)
Mutual labels:  tic-80, fantasy-console
Zany80
Zany80 fantasy computer system
Stars: ✭ 48 (+269.23%)
Mutual labels:  fantasy-console
bitty
Bitty Engine - An itty bitty 2D game engine, with built-in editors, programmable in Lua.
Stars: ✭ 86 (+561.54%)
Mutual labels:  fantasy-console
wasm4
Build retro games using WebAssembly for a fantasy console.
Stars: ✭ 711 (+5369.23%)
Mutual labels:  fantasy-console
SN-50
⚠️ Still Under Development ⚠️ SN-50 is a free and open source fantasy computer for building, playing and sharing resources-limited games.
Stars: ✭ 22 (+69.23%)
Mutual labels:  fantasy-console
FFDB
NFL Database Engine for PostgreSql and Mongo (easily works with other custom databases too)
Stars: ✭ 34 (+161.54%)
Mutual labels:  fantasy-console
pico2tic
PICO-8 Wrapper for the TIC-80
Stars: ✭ 48 (+269.23%)
Mutual labels:  tic-80
atom-tic80
Make and run TIC-80 games in Atom
Stars: ✭ 15 (+15.38%)
Mutual labels:  tic80
fake-08
A Pico-8 player/emulator for console homebrew
Stars: ✭ 374 (+2776.92%)
Mutual labels:  fantasy-console
zeus
Programmable fantasy electronic game with its own assembly language and virtual architecture
Stars: ✭ 41 (+215.38%)
Mutual labels:  fantasy-console

tic-bundle logo

license GPLv3 npm ci

tic-bundle

Simple CLI tool for bundling TIC-80 cartridge code. Supports any language!

Content

Installation

// Yarn
yarn add tic-bundle --dev

// Npm
npm i tic-bundle --save-dev

Example

Config

{
  "files": ["ui.js", "main.js"],
  "assets": ["assets.js"]
}

Input

src/main.js

function TIC() {

};

// <TILES>
// 000:0100000010100000010000000000000000000000000000000000000000000000
// </TILES>

src/ui.js

function ui() {
  return 'ui';
};

src/assets.js

// script: js

// <TILES>
// 000:0100000010100000010000000000000000000000000000000000000000000000
// </TILES>

Output

build.js

// script: js

function ui() {
  return 'ui';
};

function TIC() {

};

// <TILES>
// 000:0100000010100000010000000000000000000000000000000000000000000000
// </TILES>

CLI

package.json

{
  "scripts": {
    "watch": "tic-bundle"
  }
}

CLI options

  • -r / --root - Root folder
  • -w / --wait - Wait interval
  • -c / --config - Path to config file
  • -o / --output - Bundled file output path
  • -n / --name - Bundle file name
  • -f / --file - Bundle file extension
  • -s / --script - Language
  • -b / --build - Build

Configuration

tic-bundle supports config files. By default, tic-bundle looks for a .ticbundle.js file in the current directory, but an alternative location can be specified using -c <file> or --config <file>.

The specificity is as folows:

  • .ticbundle.js
  • .ticbundle.json
  • CLI
  • Default config

Default config

{
  root: 'src',
  wait: 200,
  metadata: {
    title: null,
    author: null,
    desc: null,
    script: 'js',
    input: null,
    saveid: null
  },
  output: {
    path: './',
    extension: 'js',
    name: 'build'
  },
  files: [],
  assets: [],
  after: null
}

Options

  • root (default src) - Folder to watch.
  • wait (default 200) - Chokidar awaitWriteFinish.stabilityThreshold
  • metadata - Cartridge metadata
  • metadata.title - The name of the cart.
  • metadata.author - The name of the developer.
  • metadata.description - Optional description of the game.
  • metadata.script (default js) - Used scripting language.
  • metadata.input - Selects gamepad, mouse or keyboard input source.
  • metadata.saveid - Allows save data to be shared within multiple games on a copy of TIC.
  • output.path (default ./) - Bundled file output path.
  • output.extension (default js) - Bundle file output extension
  • output.name (default build) - Bundled file name.
  • files - Files to bundle. Asset data will be stripped (graphics data, sprite data, etc.) Files will be ordered by index (top first, bottom last).
  • assets - Assets to bundle. Code data will be stripped. Assets will be ordered by index (top first, bottom last) and are always places below files.
  • after - Run after generating the bundle, this can be used to further modify the bundle.

Babel

after can be used to transform the bundled code. A common use-case for js is transforming ES6 syntax to ES5.

Example

.ticbundle.js

module.exports = {
  after: bundle => {
    const { code } = require('@babel/standalone').transform(bundle, {
      plugins: [require('@babel/plugin-transform-arrow-functions')]
    });
    
    return  code;
  }
};

Donating

ko-fi

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].