Skip to content

Instantly share code, notes, and snippets.

@guest271314
Last active August 31, 2024 03:25
Show Gist options
  • Save guest271314/f36fb20cc957bbf7ff60a8a126c891e6 to your computer and use it in GitHub Desktop.
Save guest271314/f36fb20cc957bbf7ff60a8a126c891e6 to your computer and use it in GitHub Desktop.
Bun code formatter using bun build and bun -e
$ bun build fmt.js --no-bundle | bun -e 'Bun.write(Bun.file("fmt.js"), await Bun.file("/dev/stdin").text())'

oven-sh/bun#2246

// bun run fmt.js gist-plugin.js
import { $ } from "bun";
const file = Bun.argv.at(-1);
await Bun.write(file, await $`bun build ${file} --no-bundle`.text());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment