Skip to content

Latest commit

 

History

History
69 lines (44 loc) · 1.64 KB

README.md

File metadata and controls

69 lines (44 loc) · 1.64 KB

Localpen

Quickly run and evaluate code with the speed of Bun.

Localpen demo

Synopsis

I like to just run some one-off code snippets sometimes. There are browser-based solutions like CodePen or Stackblitz, but they come with their own editor and are inherently slow.

Localpen is a CLI tool that allows you to run and evaluate code with the speed of Bun. It creates a project folder in a temporary directory, opens it in VSCode and immediately runs the code in Bun using the bun watch command.

Opening in VSCode uses the --wait flag, so that closing the editor will tell Localpen to stop the evaluation and show a prompt to delete the temporary directory.

Usage

  • Install bun:

    # Linux & macOS
    curl -fsSL https://bun.sh/install | bash
    # Windows
    powershell -c "irm bun.sh/install.ps1 | iex"
  • Run localpen:

    bunx localpen
  • Install localpen:

    bun add -g localpen

Templates

Currently, there are three templates available:

  • TypeScript/ts
  • JavaScript/js
  • Vite/v

Tip

You can also specify any vite template directly, e.g. vue-ts

To use a template, run localpen with the -t flag:

localpen -t ts

Deletion behavior

By default, Localpen will prompt you to delete the temporary directory after the evaluation is complete.

This prompt can be skipped by passing the --keep (-k) or the --delete (-d) flag.

Todo

  • ensure all the vite templates work
  • list the vite templates in the help message