Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
.venv
node_modules
.idea
__pycache__/
*.pyc
examples/*
!examples/*.yaml
!examples/*.png
.idea
95 changes: 0 additions & 95 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,98 +1,3 @@
# MakeCode Arcade to App

Convert your MakeCode Arcade games into a standalone offline executable!

## Install

### Dependencies

* Python (earliest version tested with is 3.12)
* Node (earliest version tested with is v20)
* Rust (earliest version tested with is 1.86) if building with Tauri

### Steps

1. Clone repo.
2. Create virtual environment and install Python dependencies in [
`requirements.txt`](requirements.txt) into it.
3. Install JavaScript dependencies with `yarn`.

## Usage

Quick start:

1. Create a YAML configuration file. See
[`Racers to Electron.yaml`](examples/Racers%20to%20Electron.yaml) for an
example.
2. Run the script with `python src/main.py "examples/Racers to Electron.yaml"`.

### Input

A YAML configuration file is used. Check out the examples in the
[`examples`](examples) directory to see how it's used, as it's
self-explanatory. Pass it as the first positional argument to the script.

### Output

The script will print the path to the output directory, which changes depending
on the output specified.

#### Static files

If the output is set to `static`, you will get HTML, CSS, and JS files that you
can serve from a web server. (maybe on your own website?) The script will print
out something like this:

```commandline
...
dist/assets/index-D3F42Pqm.js 225.78 kB │ gzip: 70.51 kB
✓ built in 532ms
Done in 1.60s.
2025-05-15 20:28:48,660 - __main__ - INFO - Static website files are at C:\Users\ckyiu\Documents\Projects\MakeCode-Arcade-to-App\examples\Racers\racers-website\dist
2025-05-15 20:28:48,660 - __main__ - INFO - Build finished
```

You will find the HTML, CSS, and JS files at the specified path, where
`index.html` is the entry point.

#### Executable with Electron

If the output is set to `electron`, you will get an executable using the
Electron framework. The script will print out something like this:

```commandline
...
› Artifacts available at: C:\Users\ckyiu\Documents\Projects\MakeCode-Arcade-to-App\examples\Racers\racers-electron\out\make
√ Running postMake hook
Done in 50.25s.
2025-05-15 20:32:22,652 - __main__ - INFO - Electron app executables are at C:\Users\ckyiu\Documents\Projects\MakeCode-Arcade-to-App\examples\Racers\racers-electron\out
2025-05-15 20:32:22,652 - __main__ - INFO - Build finished
```

You will find the directory with the executable and supporting files at the
specified path. (all of those files alongside the executable are needed, so
it's recommended to zip up the entire directory to distribute) You will also
find an installer in the `make` subdirectory.

#### Executable with Tauri (recommended option)

> This is the recommended option due to the small size and standalone nature of
> the executable. (~10 mb single executable with Tauri compared to almost 300
> mb
> in files with Electron)

If the output is set to `tauri`, you will get an executable using the Tauri
framework. The script will print out something like this:

```commandline
...
C:\Users\ckyiu\Documents\Projects\MakeCode-Arcade-to-App\examples\Racers\racers-tauri\src-tauri\target\release\bundle\nsis\Racers v1.3.2_1.3.2_x64-setup.exe

Done in 37.90s.
2025-05-15 23:39:14,612 - __main__ - INFO - Tauri app executables are at C:\Users\ckyiu\Documents\Projects\MakeCode-Arcade-to-App\examples\Racers\racers-tauri\src-tauri\target\release
2025-05-15 23:39:14,612 - __main__ - INFO - Build finished
```

You will find the executable at the specified path. (only the executable is
needed, no supporting files necessary) You will also find installers in the
`bundle` subdirectory.
31 changes: 0 additions & 31 deletions examples/Racers to Electron.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions examples/Racers to Tauri.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions examples/Racers to static files.yaml

This file was deleted.

60 changes: 60 additions & 0 deletions examples/Racers to static.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Example configuration file for MakeCode Arcade to App to compile to static
# HTML, CSS, and JS files

# Config version (single number, incremented if breaking change to schema is
# made)
version: 1

project:
name: Racers
description: "Enjoy the high-speed thrills of car racing in MakeCode Arcade!
For the MakeCode Arcade Mini Game Jam #3."
author: UnsignedArduino
version: 1.3.2
# This is what the window title will be
# This will also be used for the executable file name for Electron outputs
# You can use {NAME} or {VERSION} or {AUTHOR} to substitute the correct
# values
title: "{NAME} v{VERSION}"

inputs:
code:
# Can be share_link, github, or path
type: share_link
value: https://arcade.makecode.com/84426-33815-03715-00484

# code:
# type: github
# value: https://github.com/UnsignedArduino/Racers
# checkout: master

# code:
# type: path
# value: "E:/Racers"

assets:
icon:
# Can be url or path
type: url
value: https://raw.githubusercontent.com/UnsignedArduino/MakeCode-Arcade-to-App/refs/heads/main/examples/Racers%20icon.png

# icon:
# type: path
# value: "./examples/Racers icon.png"

# Path where we
build_dir: "./examples/Racers build"

# You can have multiple outputs
# Currently available options are static, electron, and tauri
outputs:
- type: static
# - type: electron
# window:
# width: 640
# height: 480
# - type: tauri
# identifier: com.unsignedarduino.racers
# window:
# width: 640
# height: 480
6 changes: 0 additions & 6 deletions package.json

This file was deleted.

2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
pydantic
pyyaml
doit
requests
beautifulsoup4
pillow
27 changes: 27 additions & 0 deletions src/config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import logging

import yaml

from config.model import Config
from utils.logger import create_logger

logger = create_logger(name=__name__, level=logging.INFO)


def load_config_from_yaml(config_text: str) -> Config:
"""
Load a config from YAML text.

:param config_text: The text of the config file, not the path.
:return: A Config object.
"""
logger.debug(f"Loading config from {len(config_text)} characters of YAML text")
data = yaml.safe_load(config_text)

if data["version"] == 1: # only one config version so far
config = Config(**data)
else:
raise NotImplementedError(f"Unknown config version {data.version}")
logger.debug(f"Loaded config version {config.version}")

return config
Loading