A simple shell script to make development for Playdate a bit easier from the command line on the Unix-like systems.
This tool is designed for Playdate.
- Create a new project with interactive prompt
- Build a project
- Run/Stop Playdate simulator
- Wish your function in the issues or pull request.
Be sure that PLAYDATE_SDK_PATH
is already set on your system.
Something like this:
echo $PLAYDATE_SDK_PATH
If nothing is printed then set it in yout shell config, e.g. .bashrc
or
.zsh
depends on what terminal you use.
Consider
echo "/path/to/your/PlaydateSDK-2.7.2" > "$HOME/.bashrc"
Clone this repo:
git clone https://github.com/dknight/pd.sh
Change directory:
cd pd.sh
Run Makefile:
- Root privileges might be needed with the
sudo
command.
make install
# or
sudo make install
The default installation path is /usr/local/bin
. Additionally,
PREFIX
can be set to change the destination, for example:
PREFIX=/var/opt make install
Another option, without make
utility, to copy manually the pd.sh
file to
any desired directory in $PATH
environment variable.
General command: ps.sh [-hd <directory>] command
where, -d
directory of the
project (current directory) by default; -h
prints help in the terminal.
- new: Create a new project with an interactive prompt;
- run: build and run a project;
- build: build a project;
- stop: stop Playdate simulator, if running.
Create a new project:
pd.sh new <project_dir>
or
pd.sh -d <project_dir> new
Build a project in the current directory:
pd.sh new .
The new command will also create .luarc.json
file, which helps use
autocomplete.
{
"telemetry.enable": false,
"runtime.version": "Lua 5.4",
"runtime.special": {
"import": "require"
},
"runtime.nonstandardSymbol": ["+=", "-=", "*=", "/="],
"diagnostics.globals": [
"playdate",
"json"
],
"diagnostics.disable": ["redefined-local"],
"diagnostics.neededFileStatus": {},
"diagnostics.libraryFiles": "Disable",
"completion.callSnippet": "Replace",
"workspace.library": ["$PLAYDATE_SDK_PATH/CoreLibs"],
"workspace.ignoreDir": ["Source/external"]
}
LuaCATS provides better completeion documentation. If you install
notpeter/playdate-luacats and
set the environment variable PLAYDATE_LUACATS_PATH
, it will be automatically
added to the workspace.library.
Just build the project without running:
pd.sh build
Build and run the project in Playdate Simulator:
pd.sh run
or run project detached:
pd.sh run &
Stop Playdate Simulator, if running and detached:
pd.sh stop
If the simulator was started in detached mode (background), this command will try to restart it also in the background mode.
pd.sh restart
Any help is appreciated. Found a bug, typo, inaccuracy, etc.? Please do not hesitate to create a pull request or submit an issue.
MIT 2024-2025 Dmitri Smirnov