Scratch 3.0 as a self-contained desktop application
Find a file
Christopher Willis-Ford eea135e52b npm upgrade
2018-12-28 00:48:29 -08:00
buildResources Add screenshot 2018-12-13 20:11:28 -08:00
scripts Fix static assets path 2018-10-24 09:47:59 -07:00
src Merge pull request #20 from LLK/fix-mac-shortcuts 2018-12-27 15:01:38 -05:00
.editorconfig Use eslint-config-scratch 2018-09-27 14:28:23 -07:00
.eslintignore Use eslint-config-scratch 2018-09-27 14:28:23 -07:00
.eslintrc.js Add media library assets, fetch script 2018-10-19 15:19:41 -07:00
.gitattributes Configure store and non-store builds for Mac & Win 2018-12-13 12:01:08 -08:00
.gitignore MAS: fix embedded provisioning profile 2018-12-13 21:17:02 -08:00
.npmignore Initial commit 2018-09-06 11:20:27 -07:00
electron-builder.yaml Don't apply entitlements to the Mac DevID build 2018-12-14 09:53:42 -08:00
electron-webpack.json5 Fix build with/without npm ln, match scratch-gui 2018-10-24 09:47:52 -07:00
LICENSE Initial commit 2018-09-06 11:20:27 -07:00
package-lock.json npm upgrade 2018-12-28 00:48:29 -08:00
package.json npm upgrade 2018-12-28 00:48:29 -08:00
README.md Add dev instructions to README.md 2018-12-27 12:18:09 -08:00
TRADEMARK Initial commit 2018-09-06 11:20:27 -07:00
webpack.main.additions.js Further simplify and consolidate webpack config 2018-12-28 00:48:24 -08:00
webpack.makeConfig.js npm upgrade 2018-12-28 00:48:29 -08:00
webpack.renderer.additions.js Further simplify and consolidate webpack config 2018-12-28 00:48:24 -08:00

scratch-desktop

Scratch 3.0 as a standalone desktop application

Developer Instructions

Prepare scratch-gui

This step is temporary: eventually, the scratch-desktop branch of the Scratch GUI repository will be merged with that repository's main development line. For now, though, there's a separate branch:

  1. Clone the scratch-gui repository if you haven't already.
  2. Switch to the scratch-desktop branch with git checkout scratch-desktop
  3. Build with BUILD_MODE=dist:
    • macOS, WSL, or Cygwin: run BUILD_MODE=dist npm run build or BUILD_MODE=dist npm run watch
    • CMD: run set BUILD_MODE=dist once, then npm run build or npm run watch any number of times in the same window.
    • PowerShell: run $env:BUILD_MODE = "dist" once, then npm run build or npm run watch any number of times in the same window.

Prepare media library assets

In the scratch-desktop directory, run npm run fetch. Re-run this any time you update scratch-gui or make any other changes which might affect the media libraries.

Run in development mode

npm start

Make a packaged build

npm run dist

Node that on macOS this will require installing various certificates.

Make a semi-packaged build

This will simulate a packaged build without actually packaging it: instead the files will be copied to a subdirectory of dist.

npm run dist:dir

Debugging

You can debug the renderer process by opening the Chromium development console. This should be the same keyboard shortcut as Chrome on your platform. This won't work on a packaged build.

You can debug the main process the same way as any Node.js process. I like to use Visual Studio Code with a configuration like this:

    "launch": {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Desktop",
                "type": "node",
                "request": "launch",
                "cwd": "${workspaceFolder:scratch-desktop}",
                "runtimeExecutable": "npm",
                "autoAttachChildProcesses": true,
                "runtimeArgs": ["start", "--"],
                "protocol": "inspector",
                "skipFiles": [
                    // it seems like skipFiles only reliably works with 1 entry :(
                    //"<node_internals>/**",
                    "${workspaceFolder:scratch-desktop}/node_modules/electron/dist/resources/*.asar/**"
                ],
                "sourceMaps": true,
                "timeout": 30000,
                "outputCapture": "std"
            }
        ]
    },