Picotron-TypeScript/README.md
2025-12-28 14:09:34 +01:00

59 lines
1.2 KiB
Markdown

# TypeScript for Picotron
This is an experimental template project to mix-and-match TypeScript and Lua for your Picotron projects.
Most of the _G.d.ts file has been AI-generated from the official documentation.
## Setup
### Requirements
- [NodeJS](https://nodejs.org/en/download)
- [pnpm](https://pnpm.io/installation)
### Create your project
- Create a new project (i.e. `my-project`) from this template
- Clone `my-project` in your Picotron's `drive` folder
- `cd my-project` then
- `pnpm install`
- `pnpm build`
- Inside Picotron:
- Open the terminal, `cd my-project` then `load game`
- Edit `main.lua` to change the `cd` line to `cd("/my-project/build")`
- Run the game
## Development
- `pnpm dev` will watch and rebuild your **TypeScript** code.
- `pnpm build` is required when you change **Lua** code.
The resulting code is a single `build/bundle.lua` file.
## Publish
**In Picotron**
```
> cd my-project
> load game
```
- Open the code inside Picotron
- Comment the `cd()` line in main.lua
- Save
**On the host**
`pnpm build`
**In Picotron**
Open the terminal:
```
> cp -f /my-project/build/src /ram/cart/build/src
> save
> export my-project.bin
```