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:
parent
1e14a700c7
commit
5a93b3e680
4 changed files with 49 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -25,6 +25,7 @@ npm-debug.log*
|
|||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
bun-debug.log*
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
|
|
|
|||
31
README.md
31
README.md
|
|
@ -40,9 +40,27 @@ LocalGreenChain is a revolutionary plant tracking system that uses blockchain te
|
|||
## 🚀 Quick Start
|
||||
|
||||
### 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!)
|
||||
|
||||
### 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
|
||||
|
||||
1. **Clone the repository**
|
||||
|
|
@ -53,9 +71,7 @@ cd localgreenchain
|
|||
|
||||
2. **Install dependencies**
|
||||
```bash
|
||||
npm install
|
||||
# or
|
||||
yarn install
|
||||
bun install
|
||||
```
|
||||
|
||||
3. **Set up environment variables** (optional)
|
||||
|
|
@ -70,9 +86,7 @@ PLANTS_NET_API_KEY=your_api_key_here
|
|||
|
||||
4. **Run the development server**
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
bun run dev
|
||||
```
|
||||
|
||||
5. **Open your browser**
|
||||
|
|
@ -204,6 +218,7 @@ GET /api/plants/network
|
|||
## 🏗️ Architecture
|
||||
|
||||
### Tech Stack
|
||||
- **Runtime**: Bun (fast JavaScript runtime and package manager)
|
||||
- **Frontend**: Next.js, React, TypeScript, Tailwind CSS
|
||||
- **Blockchain**: Custom implementation with proof-of-work
|
||||
- **Storage**: JSON file-based (production can use database)
|
||||
|
|
@ -280,7 +295,7 @@ git checkout -b feature/amazing-feature
|
|||
# ...
|
||||
|
||||
# Run tests (when available)
|
||||
npm test
|
||||
bun test
|
||||
|
||||
# Commit with clear message
|
||||
git commit -m "Add amazing feature"
|
||||
|
|
|
|||
19
bunfig.toml
Normal file
19
bunfig.toml
Normal 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 = []
|
||||
11
package.json
11
package.json
|
|
@ -1,17 +1,18 @@
|
|||
{
|
||||
"name": "example-marketing",
|
||||
"version": "1.5.0",
|
||||
"name": "localgreenchain",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3001",
|
||||
"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",
|
||||
"cy:open": "cypress open",
|
||||
"cy:run": "cypress run",
|
||||
"test:e2e": "start-server-and-test 'yarn preview' http://localhost:3001 cy:open",
|
||||
"test:e2e:ci": "start-server-and-test 'yarn preview' http://localhost:3001 cy:run"
|
||||
"test:e2e": "start-server-and-test 'bun run preview' http://localhost:3001 cy:open",
|
||||
"test:e2e:ci": "start-server-and-test 'bun run preview' http://localhost:3001 cy:run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tailwindcss/forms": "^0.4.0",
|
||||
|
|
|
|||
Loading…
Reference in a new issue