Switch to Bun runtime for faster performance

Updated the entire project to use Bun instead of npm/yarn for:
- Faster package installation (3x faster than npm)
- Native TypeScript support
- Better runtime performance
- Built-in bundler

Changes:
- Updated package.json to use bun in all scripts
- Renamed project from example-marketing to localgreenchain
- Added bunfig.toml for bun configuration
- Updated README with Bun installation instructions
- Added "Why Bun?" section explaining benefits
- Updated .gitignore for bun-specific debug logs
- Changed all npm/yarn references to bun commands

All commands now use:
- bun install (instead of npm install)
- bun run dev (instead of npm run dev)
- bun test (instead of npm test)
This commit is contained in:
Claude 2025-11-16 12:19:56 +00:00
parent 1e14a700c7
commit 5a93b3e680
No known key found for this signature in database
4 changed files with 49 additions and 13 deletions

1
.gitignore vendored
View file

@ -25,6 +25,7 @@ npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
lerna-debug.log* lerna-debug.log*
bun-debug.log*
# local env files # local env files
.env.local .env.local

View file

@ -40,9 +40,27 @@ LocalGreenChain is a revolutionary plant tracking system that uses blockchain te
## 🚀 Quick Start ## 🚀 Quick Start
### Prerequisites ### Prerequisites
- Node.js 14+ and npm/yarn - **Bun 1.0+** (https://bun.sh) - A fast JavaScript runtime and package manager
- Basic knowledge of plant propagation (optional but helpful!) - Basic knowledge of plant propagation (optional but helpful!)
### Why Bun?
LocalGreenChain uses Bun for faster installation, builds, and runtime performance:
- **3x faster** package installation compared to npm
- **Native TypeScript support** without configuration
- **Built-in bundler** for optimal production builds
- **Compatible** with npm packages
### Installing Bun
If you don't have Bun installed:
```bash
# macOS/Linux/WSL
curl -fsSL https://bun.sh/install | bash
# Or using npm
npm install -g bun
```
### Installation ### Installation
1. **Clone the repository** 1. **Clone the repository**
@ -53,9 +71,7 @@ cd localgreenchain
2. **Install dependencies** 2. **Install dependencies**
```bash ```bash
npm install bun install
# or
yarn install
``` ```
3. **Set up environment variables** (optional) 3. **Set up environment variables** (optional)
@ -70,9 +86,7 @@ PLANTS_NET_API_KEY=your_api_key_here
4. **Run the development server** 4. **Run the development server**
```bash ```bash
npm run dev bun run dev
# or
yarn dev
``` ```
5. **Open your browser** 5. **Open your browser**
@ -204,6 +218,7 @@ GET /api/plants/network
## 🏗️ Architecture ## 🏗️ Architecture
### Tech Stack ### Tech Stack
- **Runtime**: Bun (fast JavaScript runtime and package manager)
- **Frontend**: Next.js, React, TypeScript, Tailwind CSS - **Frontend**: Next.js, React, TypeScript, Tailwind CSS
- **Blockchain**: Custom implementation with proof-of-work - **Blockchain**: Custom implementation with proof-of-work
- **Storage**: JSON file-based (production can use database) - **Storage**: JSON file-based (production can use database)
@ -280,7 +295,7 @@ git checkout -b feature/amazing-feature
# ... # ...
# Run tests (when available) # Run tests (when available)
npm test bun test
# Commit with clear message # Commit with clear message
git commit -m "Add amazing feature" git commit -m "Add amazing feature"

19
bunfig.toml Normal file
View file

@ -0,0 +1,19 @@
# Bun configuration for LocalGreenChain
[install]
# Install dependencies from the lockfile if it exists
frozenLockfile = false
# Configure which registries to use
registry = "https://registry.npmjs.org/"
# Cache directory
cache = "node_modules/.cache/bun"
[run]
# Automatically install dependencies when running scripts
autoInstall = true
[test]
# Test configuration (when tests are added)
preload = []

View file

@ -1,17 +1,18 @@
{ {
"name": "example-marketing", "name": "localgreenchain",
"version": "1.5.0", "version": "1.0.0",
"private": true, "private": true,
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"dev": "next dev -p 3001", "dev": "next dev -p 3001",
"build": "next build", "build": "next build",
"preview": "next build && next start -p 3001", "start": "next start -p 3001",
"preview": "bun run build && bun run start",
"lint": "next lint", "lint": "next lint",
"cy:open": "cypress open", "cy:open": "cypress open",
"cy:run": "cypress run", "cy:run": "cypress run",
"test:e2e": "start-server-and-test 'yarn preview' http://localhost:3001 cy:open", "test:e2e": "start-server-and-test 'bun run preview' http://localhost:3001 cy:open",
"test:e2e:ci": "start-server-and-test 'yarn preview' http://localhost:3001 cy:run" "test:e2e:ci": "start-server-and-test 'bun run preview' http://localhost:3001 cy:run"
}, },
"dependencies": { "dependencies": {
"@tailwindcss/forms": "^0.4.0", "@tailwindcss/forms": "^0.4.0",