Skip to content
peterhellbergPublic

About

Initialize a Zig ⚡ WASM-4 cart project

Resources

Stars

4 stars

Watchers

1 watching

Forks

Latest commit

 

History

46 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

w4-init ✨

This is a command line tool that acts as a companion to my w4 module for Zig ⚡

w4-init is used to create a directory containing code that allows you to promptly get started coding on a cart for the lovely little fantasy console WASM-4.

The Zig build .target is declared as .{ .cpu_arch = .wasm32, .os_tag = .wasi } and .optimize defaults to .small

Important

No need to specify -Doptimize=small

Installation

Requires you to have Go installed.

go install github.com/peterhellberg/w4-init@latest

Usage

Requires Zig 0.17.1 or newer to build the generated cart.

(As well as npx, which is part of Node.js these days)

w4-init mycart
cd mycart
zig build run

The deployment defaults can also be set with environment variables:

Flag Environment variable Default
-hostname W4_INIT_HOSTNAME play.c7.se
-server-path W4_INIT_SERVER_PATH /var/www/play.c7.se
-backup-path W4_INIT_BACKUP_PATH /run/user/1000/gvfs/smb-share:server=diskstation.local,share=backups/Code/Fantasy/WASM-4

An explicit flag wins over its environment variable, which wins over the built-in default. Empty environment variables are ignored.

Tip

There is also a zig build --watch command that can be used to trigger automatic reload of the WASM-4 cart running in the browser when a file is changed.

Note

Arguments after -- are forwarded to WASM-4, for example zig build run -- --port 5555.

🌱

About

Initialize a Zig ⚡ WASM-4 cart project

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages