Bun v0.0.36
bun create
bun create is a new subcommand that lets you quickly create a project from a template.
To create a new React project (based on Create React App)
bun create react ./app11x 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 ./appTo create from a GitHub repository:
bun create jarred-sumner/calculator calcTo see a list of templates:
bun createRight 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 ./fooThis 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
fetchnow supports gzip- https support in
fetchwas completely rewritten to be more reliable. TLS is now powered by s2n-tls fetchnow supportsTransfer-Encoding: chunked. It didn't before, which was embarrassing.- Set
selftoglobalThisin Bun.js. This improves compatibility with some npm packages - There are two new test binaries in
misctools/,tgzandfetch.tgzis likegunzipexcept harder to use andfetchis sort of likecurl? These are really just to help me test some things in isolation from the rest of Bun



