github oven-sh/bun bun-v0.0.36
Bun v0.0.36

latest releases: bun-v1.1.8, bun-v1.1.7, bun-v1.1.6...
2 years ago

bun create

bun create is a new subcommand that lets you quickly create a project from a template.

this

To create a new React project (based on Create React App)

bun create react ./app

11x faster than yarn create react app on my Macbook Pro (both installing dependencies via yarn)

To create a new Next.js project (based on Create Next App)

bun create next ./app

To create from a GitHub repository:

bun create jarred-sumner/calculator calc

To see a list of templates:

bun create

Right now, there are only two "official" templates (and they're mostly empty) – but you can add more. bun create fetches from packages published in the examples folder of Bun's GitHub repo. PRs are very welcome!

Local templates

Many developers have boilerplate code copied for new projects.

That's why bun create also searches $HOME/.bun-create for local templates.

Add a folder with a package.json in $HOME/.bun-create/my-local-template and then you can run:

bun create my-local-template ./foo

This copies the contents of my-local-template, initializes a git repository, runs any preinstall steps, installs dependencies (if any exist), runs any postinstall steps and rewrites the name field in package.json to foo.

It uses the fastest system calls available for copying files. bun create copies files faster than cp. Here is a stupid microbenchmark

Performance

The slowest part is running your NPM client to install node_modules. The second slowest part is downloading the tarball from GitHub (or NPM if it's from Bun's examples folder). Third is git.

Other stuff

  • fetch now supports gzip
  • https support in fetch was completely rewritten to be more reliable. TLS is now powered by s2n-tls
  • fetch now supports Transfer-Encoding: chunked. It didn't before, which was embarrassing.
  • Set self to globalThis in Bun.js. This improves compatibility with some npm packages
  • There are two new test binaries in misctools/, tgz and fetch. tgz is like gunzip except harder to use and fetch is sort of like curl? These are really just to help me test some things in isolation from the rest of Bun

Don't miss a new bun release

NewReleases is sending notifications on new releases.