Skip to content

Commit ede395d

Browse files
authored
Merge pull request #127 from xarlizard/dev
chore: migrate project to Bun, update setup and workflows
2 parents 52a05d4 + 50028fe commit ede395d

8 files changed

Lines changed: 76 additions & 6736 deletions

File tree

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22
updates:
3-
# Enable version updates for npm
4-
- package-ecosystem: "npm"
3+
# Enable version updates for bun
4+
- package-ecosystem: "bun"
55
directory: "/"
66
schedule:
77
interval: "daily"

.github/workflows/publish.yml

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,25 @@ jobs:
2222
- name: Checkout
2323
uses: actions/checkout@v6
2424

25-
- name: Setup Node.js
26-
uses: actions/setup-node@v6
25+
- name: Setup Bun
26+
uses: oven-sh/setup-bun@v1
2727
with:
28-
node-version: "18"
28+
bun-version: latest
2929

3030
- name: Install dependencies
31-
run: npm ci
31+
run: bun install --frozen-lockfile
3232

3333
- name: Run linting
34-
run: npm run lint
34+
run: bun run lint
3535

3636
- name: Run type checking
37-
run: npm run typecheck
37+
run: bun run typecheck
3838

3939
- name: Run tests
40-
run: npm run test
40+
run: bun run test
4141

4242
- name: Build package
43-
run: npm run build
43+
run: bun run build
4444

4545
publish-npm:
4646
needs: test
@@ -50,36 +50,35 @@ jobs:
5050
- name: Checkout
5151
uses: actions/checkout@v6
5252

53-
- name: Setup Node.js
54-
uses: actions/setup-node@v6
53+
- name: Setup Bun
54+
uses: oven-sh/setup-bun@v1
5555
with:
56-
node-version: "18"
57-
registry-url: "https://registry.npmjs.org"
56+
bun-version: latest
5857

5958
- name: Install dependencies
60-
run: npm ci
59+
run: bun install --frozen-lockfile
6160

6261
- name: Build package
63-
run: npm run build
62+
run: bun run build
6463

6564
- name: Publish to NPM (with fallback to scoped name)
6665
run: |
6766
# Backup original package.json
6867
cp package.json package.json.backup
6968
7069
# Try publishing with original name first
71-
ORIGINAL_NAME=$(node -p "require('./package.json').name")
70+
ORIGINAL_NAME=$(bun -e "console.log(require('./package.json').name)")
7271
echo "📦 Attempting to publish with original name: $ORIGINAL_NAME"
7372
74-
if npm publish; then
73+
if bun publish; then
7574
echo "✅ Successfully published with original name: $ORIGINAL_NAME"
7675
else
7776
echo "❌ Failed to publish with original name, trying with scoped name..."
7877
# Restore backup
7978
mv package.json.backup package.json
8079
8180
# Create scoped version using GitHub username
82-
node -e "
81+
bun -e "
8382
const pkg = require('./package.json');
8483
const owner = process.env.GITHUB_REPOSITORY.split('/')[0];
8584
const originalName = pkg.name.replace(/^@[^/]+\//, ''); // Remove existing scope if any
@@ -92,12 +91,12 @@ jobs:
9291
require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));
9392
"
9493
95-
SCOPED_NAME=$(node -p "require('./package.json').name")
94+
SCOPED_NAME=$(bun -e "console.log(require('./package.json').name)")
9695
echo "🚀 Publishing scoped package: $SCOPED_NAME"
9796
98-
if npm publish; then
97+
if bun publish; then
9998
echo "✅ Successfully published with scoped name: $SCOPED_NAME"
100-
echo "💡 Users can install with: npm install $SCOPED_NAME"
99+
echo "💡 Users can install with: bun add $SCOPED_NAME"
101100
else
102101
echo "❌ Failed to publish even with scoped name: $SCOPED_NAME"
103102
echo "🔍 Please check NPM_TOKEN permissions and package configuration"
@@ -124,23 +123,22 @@ jobs:
124123
- name: Checkout
125124
uses: actions/checkout@v6
126125

127-
- name: Setup Node.js
128-
uses: actions/setup-node@v6
126+
- name: Setup Bun
127+
uses: oven-sh/setup-bun@v1
129128
with:
130-
node-version: "18"
131-
registry-url: "https://npm.pkg.github.com"
129+
bun-version: latest
132130

133131
- name: Install dependencies
134-
run: npm ci
132+
run: bun install --frozen-lockfile
135133

136134
- name: Build package
137-
run: npm run build
135+
run: bun run build
138136

139137
- name: Configure package for GitHub
140138
run: |
141139
# Create a temporary package.json for GitHub publishing
142140
cp package.json package.json.backup
143-
node -e "
141+
bun -e "
144142
const pkg = require('./package.json');
145143
const owner = process.env.GITHUB_REPOSITORY.split('/')[0];
146144
const repoName = process.env.GITHUB_REPOSITORY.split('/')[1];
@@ -158,7 +156,7 @@ jobs:
158156
"
159157
160158
- name: Publish to GitHub Packages
161-
run: npm publish
159+
run: bun publish
162160
env:
163161
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
164162

.gitignore

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@ Thumbs.db
6868
# TypeScript cache
6969
*.tsbuildinfo
7070

71-
# Optional npm cache directory
72-
.npm
73-
74-
# Optional eslint cache
75-
.eslintcache
76-
7771
# Microbundle cache
7872
.rpt2_cache/
7973
.rts2_cache_cjs/
@@ -83,3 +77,7 @@ Thumbs.db
8377
# Temporary folders
8478
tmp/
8579
temp/
80+
81+
# Bun
82+
bun.lockb
83+
.bun/

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,20 @@ A flexible and robust React hook factory for creating API hooks with consistent
2727
npm install react-api-forge
2828
```
2929

30+
### Bun
31+
32+
```bash
33+
bun add react-api-forge
34+
```
35+
36+
### Yarn
37+
3038
```bash
3139
yarn add react-api-forge
3240
```
3341

42+
### PNPM
43+
3444
```bash
3545
pnpm add react-api-forge
3646
```

SETUP.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,25 @@
22

33
## Prerequisites
44

5-
- Node.js 18+
6-
- npm or yarn
5+
- Bun 1.0+ (replaces npm/Node.js for this project)
76
- Git
87

98
## Getting Started
109

1110
```bash
1211
git clone https://github.com/xarlizard/react-api-forge.git
1312
cd react-api-forge
14-
npm install
13+
bun install
1514
```
1615

1716
## Scripts
1817

1918
```bash
20-
npm run build # Build the package
21-
npm run test # Run tests
22-
npm run lint # Lint code
23-
npm run typecheck # Type checking
24-
npm run dev # Run all checks
19+
bun run build # Build the package
20+
bun run test # Run tests
21+
bun run lint # Lint code
22+
bun run typecheck # Type checking
23+
bun run dev # Run all checks
2524
```
2625

2726
## Publishing
@@ -34,9 +33,9 @@ npm run dev # Run all checks
3433
### Manual Release
3534

3635
```bash
37-
npm run release:ps # Patch version
38-
npm run release:ps:minor # Minor version
39-
npm run release:ps:major # Major version
36+
bun run release:ps # Patch version
37+
bun run release:ps:minor # Minor version
38+
bun run release:ps:major # Major version
4039
```
4140

4241
## Testing

bunfig.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Bun configuration for react-api-forge
2+
3+
[test]
4+
# Configure Jest test runner via Bun
5+
root = "src/__tests__"
6+
preload = []
7+
8+
[install]
9+
# Frozen lockfile for CI environments
10+
# frozen = true
11+
12+
# Use bun's native npm registry
13+
registry = "https://registry.npmjs.org/"
14+
15+
[build]
16+
# Optimize for production builds
17+
optimize = "size"
18+
19+
[bundle]
20+
# Configure bundling
21+
splitting = false
22+
bytecode = false

0 commit comments

Comments
 (0)