Converts Scratch projects into HTML files, zip archives, or executable programs for Windows, macOS, and Linux.
Go to file
2022-06-26 00:02:41 -05:00
.github Add xcode build workflow (#422) 2022-06-06 20:27:55 -05:00
node-api-docs Rename api -> node-api-docs 2022-06-16 11:06:04 -05:00
scaffolding-api-docs Early draft for scaffolding API docs (#435) 2022-06-25 03:08:11 -05:00
src wkwebview: Cleanup 2022-06-25 23:52:48 -05:00
static Early draft for scaffolding API docs (#435) 2022-06-25 03:08:11 -05:00
test Add scaffolding methods to get and set variables and lists (#432) 2022-06-22 16:07:03 -05:00
wkwebview Copy WKWebView binary source code in-tree 2022-06-06 20:13:08 -05:00
.browserslistrc
.gitignore Add .DS_Store to .gitignore (#443) 2022-06-26 00:02:41 -05:00
.npmignore Update .npmignore 2021-12-12 11:05:37 -06:00
babel.config.js
LICENSE Relicense to Apache 2.0 2022-05-09 16:48:31 -05:00
package-lock.json 1.1.0 2022-06-24 13:39:38 -05:00
package.json 1.1.0 2022-06-24 13:39:38 -05:00
README.md Rename api -> node-api-docs 2022-06-16 11:06:04 -05:00
webpack.config.js Rename scaffolding.js to scaffolding-full.js 2022-06-16 11:46:26 -05:00

TurboWarp Packager

https://packager.turbowarp.org/

Converts Scratch projects into HTML files, zip archives, or executable programs for Windows, macOS, and Linux.

Development

Install dependencies:

npm ci

Start in development mode:

npm start

Then visit http://localhost:8947. Manually refresh to see changes.

Packaged projects generated while in development mode should not be distributed. Instead, you should run a production build to significantly reduce file size of both the website and the packager.

npm run build-prod

Output will be located in the dist folder.

The general layout of src is:

  • packager: The code that downloads and packages projects.
  • p4: The Svelte website for the packager. "p4" is the name that the packager uses internally to refer to itself.
  • scaffolding: A minimal Scratch project player. Handles most of the boring details of running Scratch projects like handling mouse inputs.
  • common: Some files used by both scaffolding and the packager.
  • addons: Optional addons such as gamepad support or pointerlock.
  • locales: Translations. en.json contains the original English messages. The other languages are translated by volunteers and imported by an automated script. (you can help)
  • build: Various build-time scripts such as webpack plugins and loaders.

Tips for forks

We strive to make the packager easy to fork, even for mods that aren't based on TurboWarp. Reading this section, at least the first half, should make it much easier to do so.

Packages

If you want to change the VM/renderer/etc. used, just npm install or npm link a different scratch-vm/scratch-render/etc. and rebuild. You can even install a vanilla scratch-vm and all core functionality will still work (but optional features such as interpolation, high quality pen, stage size, etc. may not work)

If you encounter errors about dependencies missing, usually these will be fixed after running another npm install.

Deployment

The packager is deployed as a simple static website. You can host it anywhere by just copying the dist folder after a build.

We use GitHub Actions and GitHub Pages to manage our deployment. If you want to do this too:

  • Fork the repository on GitHub and push your changes.
  • Go to your fork's settings on GitHub and enable GitHub Pages with the source set to the gh-pages branch.
  • Go to the "Actions" tab and enable GitHub Actions if it isn't already enabled
  • Go to your fork > Actions > Deploy > Manually run the action on the branch of your choice (probably master).
  • Your site will be automatically built and deployed.

Branding

We ask that you at least take a moment to rename the website.

  • Update the brand strings (src/packager/brand.js) to use your own app name, links, etc.
  • Update the privacy policy (static/privacy.html) to reflect your privacy practices.

Large files

Large files such as NW.js, Electron, and WKWebView executables are stored on an external server outside of this repository. While we aren't actively removing old files (the server still serves files unused since November 2020), we can't promise they will exist forever. The packager uses a secure checksum to validate these downloads. Forks are free to use our servers, but it's easy to setup your own if you'd prefer (it's just a static file server; see src/packager/large-assets.js for more information).

Service worker

Set the environment variable ENABLE_SERVICE_WORKER to 1 to enable service worker for offline support (experimental, not 100% reliable). This is not recommended in development. Our GitHub Actions deploy script uses this by default.

Standalone builds

To make a production standalone build:

npm run build-standalone-prod

Output will be located in dist/standalone.html.

Node.js module and API

See node-api-docs/README.md for Node.js API documentation.

To build the Node.js module locally:

npm run build-node-prod

License

Copyright (C) 2021-2022 Thomas Weber

This project is licensed under the Apache License, version 2.0. See LICENSE for more information.