npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tic-bundle

v3.5.2

Published

Multi-file development in TIC-80

Downloads

45

Readme

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