Electronite Local Development

How to make changes to Electronite while using a local development server.

Table of Contents

Windows, MacOS, or Linux

Prerequisites

  1. See Environment Requirements.

  2. Consider App Spin-up and Scripts.

Electronite Dev Viewer

  1. πŸ’‘ To create an Electronite viewer for use with your local dev build environment, run this script while online:
    • Linux: cd linux/scripts then ./build_viewer.bsh
    • Windows: cd windows\\scripts then .\build_viewer.ps1 (use a powershell terminal)
    • MacOS: cd macos/scripts then ./build_viewer.zsh
  2. Read the β€˜Use’ and β€˜Client Development’ sections at the top of Scripts.

  • πŸ’‘ When the server is running (the run script), start the Electronite viewer created by the build_viewer script:
    • Linux: cd linux/scripts then ./viewer.bsh – Dev Tools: Ctrl + Shift + I”
    • Windows: cd windows\scripts then .\viewer.bat – Dev Tools: Ctrl + Shift + I”
    • MacOS: cd macos/scripts then ./viewer.zsh – Dev Tools: Cmd + Option + I”

Making dev changes to Electronite

Electronite is a drop-in replacement for electron that provides an enhanced font rendering system. Make your dev changes the same way as for an Electron viewer.

This project works in either a web browser or the Electronite viewer. Only add code to Electron/Electronite that are necessary for it to handle things that web browser already do (e.g., Print, Find, Zoom, Back, Forward). Avoid coding in such a way that prevents web browser use.

πŸ’‘ The way to develop in Electronite is to start by modifying sourcecode in the following location. The electron orechestrator is electronStartup.js.

└── buildResources
    └── electron
        β”œβ”€β”€ config
        β”‚   └── paths.js
        β”œβ”€β”€ core
        β”‚   β”œβ”€β”€ archiveUtil.js
        β”‚   β”œβ”€β”€ downloadUtil.js
        β”‚   β”œβ”€β”€ ports.js
        β”‚   β”œβ”€β”€ server.js
        β”‚   β”œβ”€β”€ startupErrors.js
        β”‚   └── window.js
        β”œβ”€β”€ features
        β”‚   β”œβ”€β”€ ffmpeg.js
        β”‚   β”œβ”€β”€ firefox.js
        β”‚   └── pdf.js
        β”œβ”€β”€ electronStartup.js
        β”œβ”€β”€ package.json
        └── preload.js

Deploying tested dev changes to Electronite

Test by re-running the build_viewer script. See Electronite Dev Viewer above. This will setup the Electron files above in the following location with app-specific variables configured.

└── [linux | windows | macos]
    └── viewer
        └── project
            └── payload
                └── app
                    └── electron

Test bundle_viewer.<bsh|ps1|zsh> by either building locally on Windows or MacOS or by pushing a branch, building via git hub actions, then testing the resulting installs.

Required packages are copied by script!

If packages required in Electron are changed or updated, it is not enough to address them in the repo root package.json as applicable files from this repo copied into installs rather than being handled by a package manager. See additional info to make and test changes.

If a change needs to be made to favicon*.png, make those changes in the globalBuildResources directory. The same test instructions above apply.

Local Installer Build

Before doing this, also consider To Generate Artifacts

Prerequisites:

  • Ensure the local server is current! This is the build_server script, or ./build_server.[ext] dev or ./build_server.[ext] qa if /local_server.env has different versions from the panksomia_web in /local_server/Cargo.toml.

  • Windows has an additional requirement for running this bundle_viewer build locally:

bundle_viewer script

  • Windows - cd windows\scripts then .\bundle_viewer.ps1
    • Optional arguments:
      • .\bundle_viewer.ps1 -ServerOff "Y"
        or: β€œy”; Will not ask if server is off

    • Deletes the last bundles and temp contents for the given OS (if they exist), then on this repo runs git checkout main, git pull, and pnpm i, runs app_setup.bat to ensure version consistency, runs node build.js, then makes a zip release bundle and a stand-alone exe installer.
  • MacOS - cd /macos/scripts then ./bundle_viewer.zsh
    • Optional arguments:
      • ./bundle_viewer.zsh -s
        Will not ask if server is off

    • Deletes the last bundles and temp contents for the given OS (if they exist), then on this repo runs git checkout main, git pull, and pnpm i, runs app_setup.bat to ensure version consistency, runs node build.js, then makes a zip release bundle and a stand-alone exe installer.
  • Linux - cd /linux/scripts then ./bundle_viewer.bsh
    • Before running:
      • manually delete prior local builds
      • pnpm i (if not already run)
      • app_setup.bat to ensure version consistency (unless already current)
      • run run ./bundle_tgz.bsh

      • then run ./bundle_viewer.bsh

bundle_viewer script Outputs:

  • Windows: releases\\windows\\intel64\\[app-name]-[version]-windows-[x64|arm64].exe
  • MacOS: releases/macos/[intel64|arm64]/[app-name]-[version]-macos-[x64|arm64].pkg
  • Linux: releases/linux/[app-name]-[version]-linux-[x64|arm64].deb