You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This following script from the tweet above uses bun to create a Next.js create-next-app app called "app-tea" via tea
sh <(curl tea.xyz) +bun.sh bun create next ./app-tea
Breakdown
Let's break it down.
sh <(curl tea.xyz) +bun.sh bun create next ./app-tea
#-----------------# |# tea one-liner
if tea is installed, our one-liner uses the tea installation,
if it’s not installed then it doesn’t install tea or any dependencies, it creates a sandbox and runs everything in there
I had tea installed, so case 1 applies. If you are running it the script and do not have tea installed, case 2 applies.
In case 2, tea and the package you add are stored in a tmp folder (/var/folders/... on macOS).
It's important to note that without any package, the command will install tea locally (see more here)
Moving on to the package declaration
sh <(curl tea.xyz) +bun.sh bun create next ./app-tea
# -------# |# package declaration
We explicitly declare bun with the syntax + and the package's FQDN as unique identifier. bun is injected into our current environment. So that whatever command comes next has access to the bun package. There are also other ways to inject a package into the current environment; learn more here.
If you have tea installed, open ~/.tea/tea.xyz/var/pantry/projects
Finally, the package command
sh <(curl tea.xyz) +bun.sh bun create next ./app-tea
# -------------------------# |# package command
This is straightforward. This is the command you would normally use if you had the package, i.e. bun, installed on your system. The command was taken from the bun README here.
Done
And that's it. You have successfully used bun to create a Next.js app without actually installing bun.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Let's break down what happens in this tweet 👇
The one-liner script
This following script from the tweet above uses
bun
to create a Next.jscreate-next-app
app called "app-tea" viatea
sh <(curl tea.xyz) +bun.sh bun create next ./app-tea
Breakdown
Let's break it down.
tea
is installed, our one-liner uses thetea
installation,tea
or any dependencies, it creates a sandbox and runs everything in thereI had
tea
installed, so case 1 applies. If you are running it the script and do not havetea
installed, case 2 applies.In case 2,
tea
and the package you add are stored in atmp
folder (/var/folders/...
on macOS).Moving on to the package declaration
We explicitly declare
bun
with the syntax+
and the package's FQDN as unique identifier.bun
is injected into our current environment. So that whatever command comes next has access to thebun
package. There are also other ways to inject a package into the current environment; learn more here.Finally, the package command
This is straightforward. This is the command you would normally use if you had the package, i.e.
bun
, installed on your system. The command was taken from the bun README here.Done
And that's it. You have successfully used
bun
to create a Next.js app without actually installingbun
.Beta Was this translation helpful? Give feedback.
All reactions