Skip to content

crankscript/lib-template-blank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crankscript library blank template

This is a simple template for a Crankscript library project.

Quick start

Install dependencies:

npm install

To generate a .d.ts and a Lua file:

npm run transpile

CrankScript & Toybox Compatibility

When you transpile your library, Crankscript will generate both index.lua and index.d.ts inside the Source directory. This allows your library to be:

  • Used via npm in CrankScript projects (with full TypeScript types)
  • Imported in Toybox projects with zero setup

Toybox support is enabled by default via the --toybox flag:

// ...
"transpile": "crankscript transpile --toybox MyLib"
// ...

This will generate a Toybox-compatible Source/import.lua, which:

  • Automatically exposes your exports under a global table (MyLib)
  • Can be imported and used by others:
import "toyboxes"

MyLib.someFunction()

Publishing Tips

  • Make sure to commit the Source/import.lua file
  • Your library will be usable from Toybox with:
toybox add github-username/repository-name

To disable Toybox support, remove the --toybox option in your package.json.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published