Skip to content

Conversation

colinhacks
Copy link

Adds instructions for bun and bunx (Bun's npx equivalent). Bun can be used as a runtime-agnostic package manager.

This PR also adds support for identifying when bunx is used to run create-react-app and uses it for dependency management if so. Here is a successful run showing bun being used to install the dependencies for both the create-react-app CLI and the template itself.

npm_config_user_agent=bun/1.0 bun run index.js myapp

Creating a new React app in /Users/colinmcd94/Documents/bun/fun/repos/create-react-app/packages/create-react-app/myapp.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

bun add v0.7.3 (a9b3d583)

 installed react@18.2.0
 installed react-dom@18.2.0
 installed react-scripts@5.0.1 with binaries:
  - react-scripts
 installed cra-template@1.2.0


 1179 packages installed [2.67s]
{ packageName: 'react-scripts', templateName: 'cra-template' }
[
  '/Users/colinmcd94/Documents/bun/fun/repos/create-react-app/packages/create-react-app/myapp',
  'myapp',
  undefined,
  '/Users/colinmcd94/Documents/bun/fun/repos/create-react-app/packages/create-react-app',
  'cra-template'
]
[]

Installing template dependencies using bun...
bun add v0.7.3 (a9b3d583)

 installed @testing-library/jest-dom@5.17.0
 installed @testing-library/react@13.4.0
 installed @testing-library/user-event@13.5.0
 installed web-vitals@2.1.4


 57 packages installed [476.00ms]
Removing template package using bun...

bun remove v0.7.3 (a9b3d583)
 - cra-template

 1 packages removed [36.00ms]

Success! Created myapp at /Users/colinmcd94/Documents/bun/fun/repos/create-react-app/packages/create-react-app/myapp
Inside that directory, you can run several commands:

  bun start
    Starts the development server.

  bun run build
    Bundles the app into static files for production.

  bun test
    Starts the test runner.

  bun run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd myapp
  bun start

Happy hacking!

@colinhacks colinhacks changed the title docs: Add instructions for bun/bunx docs: Add support for bun/bunx Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants