This is a bare-bones project template for hybrid TypeScript & Zig apps, using thi.ng/wasm-api related infrastructure for bridging both worlds, and using Vite as dev tool/server & bundler...
Edit/delete everything as you see fit, see linked package readme files for further details & please submit an issue if you spot anything wrong! Thanks!
Please consult the GitHub documentation to learn more about template repos. Once you cloned the repo, proceed as follows:
# git clone ...
cd <path-where-you-cloned-this-tpl>
# download & install all dependencies (can also use npm)
yarn install
# start dev server & open in browser
yarn start
# regenerate shared types (see thi.ng/wasm-api-bindgen)
yarn build:types
# production build
yarn build
# preview latest production build
yarn preview
This template is configured for Zig version v0.12.0 or newer, which includes several breaking changes to the earlier build system. You can download the latest version from the Zig website or (my own preferred method) using asdf to install it (even just locally for this project):
# asdf supports multiple versions of a tool, here to install latest dev version
asdf install zig 0.12.0
# global use of that version
asdf global zig 0.12.0
# only use that version in this project (already pre-configured)
asdf local zig 0.12.0
Please see the comments in build.zig for more details...
This template pulls in more dependencies than needed for the runtime of your actual app. Most of these additional packages are only required by the @thi.ng/wasm-api-bindgen CLI tool to generate source code for the types shared between the WASM/JS side... Feel free to remove that package if you're not making use of code generation.
This project is licensed under the MIT License. See LICENSE.txt
© 2022 - 2024 Karsten Schmidt