Skip to content

How to write a hack

Sean LeBlanc edited this page Jan 26, 2020 · 4 revisions

basics

  1. clone the repo
  2. run npm install (link for if you don't have node/npm)
  3. write your hack in ./src/
  4. run npm run build
  5. your hack should now be in ./dist/!

build system notes

  • import bitsy from "bitsy"; can be used in your hack to create an alias to the global scope under the name bitsy

  • the last code block in the format

export var hackOptions = {
...
};

will be shifted to the top of the built file's function body. If your hack has configurable options, it's best to make them properties of hackOptions so that users can easily find + edit them without having to know how the internals work

  • the last /** */ comment block will be parsed as a jsdoc to generate the readme. the format is
/**
<emoji>
@file <filename (without ".js")>
@summary <short description listed in readme>

@description
<full description>
*/

I recommend also including @license, @version, and @author for general info, and @requires for indicating what version of bitsy the hack is for

  • the last /* */ comment block will be shifted to the top of the built file (i.e. you should use // for comments outside of the jsdoc header)
Clone this wiki locally