Skip to content

Commit

Permalink
Merge pull request #758 from TurboWarp/rewrite
Browse files Browse the repository at this point in the history
Rewrite it
  • Loading branch information
GarboMuffin authored Aug 22, 2023
2 parents 524e69b + fb9be2b commit 9e3a35b
Show file tree
Hide file tree
Showing 121 changed files with 8,381 additions and 11,849 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
with:
node-version: 14.x
cache: npm
- name: Install Dependencies
- name: Install dependencies
run: npm ci
- name: Compile and package
run: npm run dist -- --linux tar.gz --publish never
env:
NODE_OPTIONS: --max-old-space-size=4096
- name: Compile
run: npm run webpack:compile
- name: Package
run: npm run electron:package:dir
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
with:
node-version: 14.x
cache: npm
- name: Install Dependencies
- name: Install dependencies
run: npm ci
- name: Download Library Files
- name: Fetch
run: npm run fetch
- name: Compile and package
- name: Compile
run: npm run webpack:compile
- name: Package
run: npm run dist -- --publish never
env:
NODE_OPTIONS: --max-old-space-size=4096
14 changes: 4 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@ jobs:
with:
node-version: 14.x
cache: npm
- name: Install Dependencies
- name: Install dependencies
run: npm ci
- name: Download Library Files
- name: Fetch
run: npm run fetch

- name: Compile
run: npm run compile
env:
NODE_OPTIONS: --max-old-space-size=4096
TW_ENABLE_UPDATE_CHECKER: "1"
run: npm run webpack:compile

- name: Package Windows
if: runner.os == 'Windows'
Expand All @@ -47,11 +44,8 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Package Microsoft Store
# Microsoft Store artifact needs to completely recompile the JS since we don't want the update checker
if: runner.os == 'Windows'
run: npm run dist -- --windows appx --x64 --ia32 --arm64 --publish never
env:
NODE_OPTIONS: --max-old-space-size=4096
run: npx electron-builder --windows appx --x64 --ia32 --arm64 --publish never
- name: Upload Microsoft Store Artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v3
Expand Down
14 changes: 8 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
.DS_Store
dist/
node_modules/
thumbs.db
node_modules/
.idea/
.vscode

# Generated by install-time scripts
library-files
packager.html.br
extensions.turbowarp.org
# Built files
dist
dist-renderer-webpack
dist-library-files
dist-extensions
src-renderer/packager/standalone.html

# Debian release scripts create files that shouldn't be committed
deb
59 changes: 17 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,58 +8,37 @@ Licensed under the GPLv3.0. See LICENSE for more information.

Parts of this repository are based on [LLK/scratch-desktop](https://github.com/LLK/scratch-desktop).

## Building it yourself

Install these:

- [Git](https://git-scm.com/)
- [Node.js](https://nodejs.org/en/)

You'll need to open a terminal for the next steps.

Clone it:

```bash
git clone --recursive https://github.com/TurboWarp/desktop turbowarp-desktop
cd turbowarp-desktop
```
## Website

We use git submodules so either use `--recursive` or run `git submodule init` later.
The website source code is in the `docs` folder.

Install dependencies after each update:
## App Architecture

```bash
# This will take a while.
npm ci
```
Due to TurboWarp's rather unique security requirements (the existence of custom extensions), our desktop app is more complicated than Scratch's.

Download library files, packager HTML, and extensions after each update:
- **src-main** is what runs in Electron's main process. There is no build step; this code is included as-is.
- **src-renderer-webpack** runs in an Electron renderer process to make the editor work. This is built by webpack as **dist-renderer-webpack**.
- **src-renderer** also runs in an Electron renderer process. This is used for things like the privacy policy window where webpack is completely unnecessary.
- **src-preload** runs as preload scripts in an Electron renderer process. They export glue functions to allow renderer and main to talk to each other in a somewhat controlled manner.
- **dist-library-files** and **dist-extensions** contain additional static resources managed by manual fetch scripts.

```
npm run fetch
```
We use submodules, so clone using `git clone --recursive https://github.com/TurboWarp/desktop turbowarp-desktop`.

Build:
Installl dependencies with `npm ci` and download extra files like the packager and library files with `npm run fetch`.

```bash
# Development
npm start
Build the webpack portions with `npm run webpack:compile` or `npm run webpack:watch`.

# Production (output is in `dist` folder)
npm run dist
# If it crashes with "JavaScript heap out of memory", try:
NODE_OPTIONS=--max-old-space-size=4096 npm run dist
```
For development, use `npm run electron:start`.

## Website
For development using the correct app ID, use `npm run electron:package:dir` and start the unpacked version in `dist`.

The website source code is in the `docs` folder.
For final production builds, use `electron-builder` CLI.

## Advanced customizations

TurboWarp Desktop lets you configure custom JS and CSS.
TurboWarp Desktop lets you configure custom JS and CSS without rebuilding the app.

Find TurboWarp Desktop's data path by using the list below or by clicking "?" in the top right corner, then "Desktop Settings", then "Open User Data Folder", then opening the highlighted folder.
Find TurboWarp Desktop's data path by using the list below or by clicking "?" in the top right corner, then "Desktop Settings", then "Open User Data", then opening the highlighted folder.

- Windows (except Microsoft Store): `%APPDATA%/turbowarp-desktop`
- Microsoft Store: Open `%LOCALAPPDATA%/Packages`, find the folder with the word `TurboWarpDesktop` in it, then open `LocalCache/Roaming/turbowarp-desktop`
Expand All @@ -70,10 +49,6 @@ Find TurboWarp Desktop's data path by using the list below or by clicking "?" in

Create the file `userscript.js` in this folder to configure custom JS. Create the file `userstyle.css` in this folder to configure custom CSS. Completely restart TurboWarp Desktop (including all windows) to apply.

## Update checker

TurboWarp Desktop includes a simple update checker. This update checker is disabled by default on local builds. To manally enable it, set the `TW_ENABLE_UPDATE_CHECKER` environment variable to `1` at build-time. In builds with the update checker enabled, the checker can be disabled through the "(?) > Desktop Settings" menu or by setting the `TW_DISABLE_UPDATE_CHECKER` environment variable to `1` at runtime.

## Uninstall

See https://desktop.turbowarp.org/uninstall
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion docs/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion extensions
Submodule extensions updated 145 files
Loading

0 comments on commit 9e3a35b

Please sign in to comment.