Skip to content
jtLabHIUPublic

About

etrobo environment addon for jtScratch and jtS3H

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

36 Commits

Folders and files

Repository files navigation

jtScratch

etrobo environment addon for jtScratch and jtS3H.

Install repositories

Run jtScratch install [<absolute path to jtScratchRepos>]. If the path is omitted, repositories are stored in $ETROBO_USERPROFILE/jtScratchRepos. The addon exposes that directory at repos through a symbolic link, so the filesystem containing the addon must support symbolic links (for example, NTFS).

The installer clones scratch-editor and then scratch-desktop when their directories do not already exist. Installation of s3h and its dependencies is deferred, even when an existing checkout is present; activation does not require it. Existing Git repositories are reused without cloning, and npm install is run in each case. On Windows this uses Windows npm after installing Windows Node.js; the repository location must be on a Windows drive, not the WSL filesystem. Windows npm runs lifecycle scripts sequentially (--foreground-scripts) to avoid races in native package caches; this may increase installation time. The installer reads the Node.js version from scratch-editor/.nvmrc, installs and activates it with nvm, and installs nvm itself if needed. It uses sudo apt to install Git, curl, and the build tools required by native npm dependencies (build-essential and python3). For scratch-desktop Windows Electron builds, the installer enables the i386 architecture and installs wine64, wine32:i386, mono-devel, and libnss3. The Wine runtimes are needed to run Windows installer tooling during cross-builds. In WSL, it also installs nvm-windows through winget and activates the Node.js version from .nvmrc for Windows-side debugging. Logs are written separately to logs/install_scratch-editor.log, logs/install_scratch-desktop.log, and logs/windows-node.log.

jtScratch install --no-clone prepares available tools and existing repositories without cloning missing ones. If repositories or .nvmrc are missing, it asks you to run jtScratch install with the repository location. When the Node.js version cannot be determined, Node.js and npm dependencies are not installed. An existing repos link is used when no location is specified; an incomplete setup does not create a new link.

Opening jtScratch.code-workspace includes the jtScratch, scratch-editor, scratch-desktop, and s3h folders, starts an integrated terminal, and runs jtScratch activate. This activates the Node.js version specified by scratch-editor/.nvmrc with nvm on WSL and nvm-windows. If the Windows version is not installed, it runs jtScratch install --no-clone to prepare it. Activation through addonman open jtScratch shell or terminal also uses --no-clone; directly running jtScratch activate allows cloning. It then leaves an interactive shell open in the jtScratch addon directory. VS Code may ask permission to run the automatic workspace task the first time. Once dependencies are installed, select the workspace TypeScript version when VS Code prompts you, or use TypeScript: Select TypeScript Version and choose Use Workspace Version. This keeps editor diagnostics aligned with the scratch-editor installation. If repositories or .nvmrc are missing, managed activation still opens the addon shell and sets its activation marker, but the required Node.js version cannot be activated until its version file is available. The lowercase command jtscratch is also available as an alias for jtScratch.

On Windows, activation also checks the Node.js version last used to prepare and build the current editor and Desktop repositories. If the record is missing or the required version changes, activation runs install --no-clone when necessary, then runs Windows npm rebuild --foreground-scripts for both repositories and jtScratch build desktop --refresh. The record is saved only after all steps succeed; a failure stops activation and the next attempt retries. Incomplete managed installations still open the shell without building.

This automatic update can access the network, require administrator privileges, change the Windows-wide Node.js selection, and overwrite build outputs and logs. It does not delete node_modules, but npm install and npm rebuild can overwrite manual changes inside it. Avoid relying on such changes. The update does not fetch or merge repository changes, and does not rebuild jtS3H. Source changes without a Node.js version change do not trigger this update; run jtScratch build dist when a new distribution is needed.

Development and builds

The following commands run with Windows Node.js from an activated etrobo shell:

jtScratch build [editor] [--rebuild|--refresh]
jtScratch build desktop [--refresh]
jtScratch build s3h
jtScratch build dist
jtScratch start [editor] [--rebuild|--refresh]
jtScratch start s3h
jtScratch start desktop

build editor builds the GUI without checking or building VM or other workspaces. --rebuild also builds VM; --refresh builds task-herder, scratch-storage, scratch-svg-renderer, scratch-paint, scratch-render and scratch-vm in that order, then builds the GUI. start editor instead lets webpack compile the GUI; its options build VM or those workspaces before starting the server. These options do not reinstall dependencies.

Normal editor commands use existing workspace outputs even if they are missing or stale. In particular, after changing storage, render or svg-renderer, use --refresh. VM's extension worker and storage workers are copied from existing build outputs; missing or stale workers can affect their features. The editor and VM sources are watched by webpack, but a reload may discard an unsaved Scratch project.

build desktop always builds VM and GUI, links the GUI into Desktop, and compiles Desktop. --refresh also rebuilds the related workspaces listed above. start desktop runs build desktop before starting Electron; restart it to pick up source changes. build-linked is an alias for build desktop. These commands do not make a distribution package.

build dist refreshes the editor workspaces and Desktop, produces a Windows unpacked Desktop, then packages s3h with it in s3h/jtS3H-win32-x64. build s3h packages s3h with the existing scratch-desktop/dist/win-unpacked instead; it does not rebuild Desktop. Both replace the existing jtS3H-win32-x64 output. They produce a directory, not an installer. The s3h repository and its Windows npm dependencies must be prepared separately because jtScratch install currently does not install s3h; see the s3h repository's instructions. Desktop packaging invokes electron-builder's native dependency rebuild and may modify its dependencies.

start s3h runs its source directly, without build s3h, and restarts it when source files change. Start editor and s3h separately; neither command starts or restarts the other. The VM's helper retries its WebSocket connection after a disconnect. Requests made while disconnected fail rather than being replayed after reconnecting. Mesh hosting or joining is not restored automatically: after a disconnect, run the relevant Mesh block again. Previously received Mesh sensor values are cleared.

Editor opens in an external browser; Chrome is opened in a new window when it is the Windows default browser. Editor and Desktop use TCP port 8601 by default; PORT can override it. s3h uses port 5963. A port conflict aborts startup without stopping the owner. Commands reject concurrent operations on the same build inputs while allowing editor and s3h to run separately. Ctrl+C stops only processes belonging to that command, not the other server or existing browser windows. Desktop may close without a save prompt; save the project first. Electron output is forwarded to the terminal.

Builds overwrite generated workspace and Desktop files, and build dist or build s3h replaces the s3h package. Desktop builds change Windows npm's global GUI link and Desktop's node_modules; an existing link to a different checkout is rejected. Desktop media fetching and packaging can access the network. Logs in logs/build_scratch-editor.log, logs/build_scratch-desktop.log and logs/build_s3h.log are replaced on each corresponding build. Existing Linux-installed node_modules must be preserved or removed before preparing Windows dependencies; the installer rejects a .bin directory without Windows .cmd files, but cannot detect every mixed tree.

Migration assets

bash migration/migrate.sh copies the files in migration/ into repos/scratch-editor, creating directories and overwriting matching files in that checkout. It resolves paths relative to migration/ regardless of the current directory and requires the scratch-editor repository to exist first.

Memory requirements

The build and start processes can be slow on machines with limited memory. As a reference, processing on an 8 GB machine can take five times as long as on a 32 GB machine. During a build, VS Code may mistake a temporarily unresponsive WSL environment for a hang, which can cause the build to fail. If a build fails this way, run it from an etrobo shell started in shell mode, or from the addon terminal opened with addonman open jtScratch terminal, instead of using the VS Code integrated terminal.

About

etrobo environment addon for jtScratch and jtS3H

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages