Merge branch 'master' of github.com:TurboWarp/packager

This commit is contained in:
Thomas Weber committed 2021-10-25 19:45:49 -05:00
commit ca6265d93d
5 files changed
+65 -36

No files matched your search

+22 -16
View File
@@ -2,7 +2,7 @@
https://packager.turbowarp.org/
Converts Scratch projects into HTML files, zip archives, or executable programs for Windows, macOS, and Linux. Built using TurboWarp, webpack, and Svelte.
Converts Scratch projects into HTML files, zip archives, or executable programs for Windows, macOS, and Linux.
## Development
@@ -22,13 +22,13 @@ Then visit http://localhost:8947. Manually refresh to see changes.
The general layout of `src` is:
- packager: The project packager
- p4: The Svelte interface for the packager
- scaffolding: A minimal Scratch project player used by the packager. Handles most of the boring details of playing Scratch projects such as handling basic mouse input
- common: Files used by both scaffolding and the packager
- addons: Optional addons such as gamepad support or pointerlock
- build: Unusual webpack customizations
- locales: Translations
- packager: The project packager.
- p4: The Svelte GUI for the packager. "p4" is the name that the packager uses internally to refer to itself.
- scaffolding: A minimal Scratch project player used by the packager. Handles most of the boring details of playing Scratch projects such as handling basic mouse input.
- common: Files used by both scaffolding and the packager.
- addons: Optional addons such as gamepad support or pointerlock.
- build: Various internal build tools including some webpack plugins and loaders.
- locales: Translations.
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.
@@ -40,15 +40,19 @@ Output will be located in the `dist` folder.
## Tips for forks
Some assorted tips for people who want to fork this project (it's really easy):
**Branding**
- The packager is deployed as a simple static website. You can host it anywhere by just copying the `dist` folder. We use GitHub Actions to deploy to GitHub Pages by running the "Deploy" workflow whenever we want to push to production (Actions > Deploy > Run workflow). This should be automatically available in forks after enabling GitHub Actions.
- 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)
- src/packager/brand.js controls names and links that appear in various places
- static/privacy.html is the privacy policy
- Large files such as NW.js or Electron executables are stored on an external server outside of this repository and have no guarantee of existing long-term. It's easy to setup your own, see src/packager/large-assets.js for more information.
- Set the environment variable ENABLE_SERVICE_WORKER=1 to enable service worker for offline support
- Be aware of the license of this project (see below)
- Please update the brand strings (`src/packager/brand.js`) to use your own name and links.
- Update the privacy policy (`static/privacy.html`) to reflect your privacy practices.
- Update this document (`README.md`) too.
**Deploying**: 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 to deploy to GitHub Pages by running the "Deploy" workflow whenever we want to push to production (Actions > Deploy > Run workflow). This should be automatically available in forks after enabling GitHub Actions.
**Changing Scratch internals**: 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)
**Large files**: Large files such as NW.js or Electron executables are stored on an external server outside of this repository and have no guarantee of existing long-term. It's easy to setup your own, 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. Not recommended in development. Automatically used the GitHub Actions deploy script.
## Standalone builds
@@ -62,6 +66,8 @@ Output will be located in `dist/standalone.html`.
## License
<!-- Make sure to also update COPYRIGHT_NOTICE in src/packager/brand.js -->
Copyright (C) 2021 Thomas Weber
This project is licensed under the GNU Lesser General Public License version 3. See COPYING and COPYING.LESSER for more information. We believe that packaging a project using the packager "makes use of an interface provided by the Library, but which is not otherwise based on the Library"
+1 -1
View File
@@ -4,7 +4,7 @@
"string": "Converts Scratch projects into HTML files, zip archives, or executable programs for Windows, macOS, and Linux."
},
"description2": {
"string": "If you just want an easy way to embed a TurboWarp project into your website, you may be interested in {embedding}."
"string": "If you just want an easy way to embed a project into your website, you may be interested in {embedding}."
},
"description2-embedding": {
"string": "Embedding"
+38 -3
View File
@@ -1,9 +1,44 @@
// Use old export to make this easier to import in old node environments
/*
These values control branding strings throughout the entire app. If you're forking, please take a few minutes to update them.
"The website" refers to the website itself that you use to load projects and convert them to another form.
"Packaged projects" refers to the files generated by the website. They include a line of text something like:
`Parts of this script are from the ${APP_NAME} <${WEBSITE}>, licensed as follows: ${COPYRIGHT_NOTICE}`
*/
module.exports = {
// The name of the app. This text is included in packaged projects.
APP_NAME: 'TurboWarp Packager',
// A longer form of the app's name. Used by the website.
LONG_NAME: 'TurboWarp Packager for Scratch',
// Your app's website. This link is included in packaged projects.
WEBSITE: 'https://packager.turbowarp.org/',
// A copyright notice regarding the app. This text is included in packaged projects.
// Also make sure to update the "License" section in README.md
COPYRIGHT_NOTICE: `Copyright (C) 2021 Thomas Weber
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.`,
// Where users can find the app's source code. This link is included in the website.
// Note that due to the license used by the project (see README.md), you may be required to make the source code available to all visitors.
SOURCE_CODE: 'https://github.com/TurboWarp/packager',
// Feedback/bug report links shown in various places throughout the website.
// These don't strictly need to be Scratch or GitHub links, but some parts of the interface label them that way.
FEEDBACK_SCRATCH: 'https://scratch.mit.edu/users/GarboMuffin/#comments',
FEEDBACK_GITHUB: 'https://github.com/TurboWarp/packager/issues',
WEBSITE: 'https://packager.turbowarp.org/'
FEEDBACK_GITHUB: 'https://github.com/TurboWarp/packager/issues'
};
+3 -15
View File
@@ -10,7 +10,7 @@ import {buildId, verifyBuildId} from './build-id';
import {encode, decode} from './base85';
import generateAsar from './generate-asar';
import {parsePlist, generatePlist} from './plist';
import {APP_NAME, SOURCE_CODE, WEBSITE} from './brand';
import {APP_NAME, WEBSITE, COPYRIGHT_NOTICE} from './brand';
const PROGRESS_LOADED_SCRIPTS = 0.1;
const PROGRESS_LOADED_JSON_BUT_NEED_ASSETS = 0.2;
@@ -86,19 +86,7 @@ const getAppIcon = async (file) => {
const SELF_LICENSE = {
title: APP_NAME,
homepage: WEBSITE,
license: `Copyright (C) 2021 Thomas Weber
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.`
license: COPYRIGHT_NOTICE
};
const SCRATCH_LICENSE = {
@@ -145,7 +133,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.`
};
const COPYRIGHT_HEADER = `/*!
Parts of this script are from the ${APP_NAME} <${SOURCE_CODE}>, licensed as follows:
Parts of this script are from the ${APP_NAME} <${WEBSITE}>, licensed as follows:
${SELF_LICENSE.license}
Parts of this script are from Scratch <https://scratch.mit.edu/>, licensed as follows:
+1 -1
View File
@@ -34,7 +34,7 @@
<body>
<header>
<h1>TurboWarp Packager Privacy Policy</h1>
<h1>Privacy Policy</h1>
</header>
<main>