@kubohiroya/turbowarp-extension-template
v0.1.0
Published
A reusable TypeScript template for developing, testing, building, and releasing TurboWarp extensions with Vite.
Readme
TurboWarp Extension Template
A reusable TypeScript template for developing, testing, building, and releasing TurboWarp extensions with Vite.
Build workflow
TypeScript source
-> Vite
-> vite-plugin-turbowarp-extension
-> dist/<extension-name>.jsThe generated JavaScript is a single, non-minified TurboWarp extension file with Extension Gallery metadata and the standard (function (Scratch) { ... })(Scratch); wrapper.
Example blocks
hello [NAME]
Returns a localized greeting for the supplied name.
| Property | Value |
|---|---|
| Type | Reporter |
| Opcode | hello |
| NAME | String, default: world |
Getting started
- Create a repository from this template.
- Update the package name in
package.json. - Edit the metadata in
src/config.ts. - Define blocks in
src/block-definitions.json. - Implement their runtime behavior in
src/extension.ts. - Run
npm run docsafter changing block definitions. - Update the tests and handwritten documentation.
npm install
npm run checkFor continuous rebuilding during development:
npm run devProject structure
src/config.ts: extension metadatasrc/block-definitions.json: canonical block metadata used by both the extension and README generatorsrc/extension.ts: extension implementationsrc/index.ts: extension registration entry pointsrc/globals.d.ts: Scratch API declarations used by the projectscripts/generate-readme.mjs: updates the generated README block sectiontests/: unit testsvite.config.ts: TurboWarp-compatible Vite build configurationdist/: generated JavaScript for TurboWarp
Generated documentation
Regenerate block documentation with:
npm run docsnpm run check also runs docs:check, which fails if README.md is out of date with src/block-definitions.json.
Development dependency
Until @kubohiroya/vite-plugin-turbowarp-extension is published to npm, this template pins a tested Git commit of the plugin. Replace the Git dependency with a normal semantic version after publication.
License
MPL-2.0
