Picotron-TypeScript/README.md
2025-12-14 17:39:00 +01:00

55 lines
1.0 KiB
Markdown

# TypeScript for Picotron
This is a template project to mix-and-match TypeScript and Lua for your Picotron projects.
## 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`
- Inside Picotron:
- Open the terminal, `cd my-project` then `load game`
- Edit `main.lua` to fix `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
```