Skip to content

Commit c8671bc

Browse files
✨ 📄 Added detailed metadta tp package.json and updated CI/CD workflows to utilize Bun for testing and publishing
1 parent 8611052 commit c8671bc

File tree

3 files changed

+56
-44
lines changed

3 files changed

+56
-44
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@ on:
88

99
jobs:
1010
test:
11-
name: Test
11+
name: Test with Bun
1212
runs-on: ubuntu-latest
1313

14-
strategy:
15-
matrix:
16-
node-version: [18, 20, 22]
17-
1814
steps:
1915
- name: Checkout code
2016
uses: actions/checkout@v4
@@ -52,9 +48,15 @@ jobs:
5248
fi
5349
echo "Build artifacts verified successfully"
5450
55-
# Test with Node.js as well to ensure compatibility
56-
test-node:
57-
name: Test with Node.js
51+
- name: Test package installation
52+
run: |
53+
# Pack the package to test it can be installed
54+
bun pm pack
55+
echo "Package packed successfully"
56+
57+
# Test Node.js compatibility without npm caching issues
58+
test-node-compat:
59+
name: Test Node.js Compatibility
5860
runs-on: ubuntu-latest
5961

6062
strategy:
@@ -69,16 +71,21 @@ jobs:
6971
uses: actions/setup-node@v4
7072
with:
7173
node-version: ${{ matrix.node-version }}
72-
cache: "npm"
74+
# Remove cache to avoid bun.lock vs package-lock.json conflicts
7375

74-
- name: Install dependencies
76+
- name: Create package-lock.json for npm
77+
run: |
78+
# Create a temporary package-lock for npm compatibility test
79+
npm install --package-lock-only
80+
81+
- name: Install dependencies with npm
7582
run: npm ci
7683

77-
- name: Run tests
84+
- name: Run tests with npm
7885
run: npm test
7986

80-
- name: Type check
87+
- name: Type check with npm
8188
run: npx tsc --noEmit
8289

83-
- name: Build package
90+
- name: Build package with npm
8491
run: npm run build

.github/workflows/release.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
release:
10-
name: Release and Publish
10+
name: Release and Publish with Bun
1111
runs-on: ubuntu-latest
1212
permissions:
1313
contents: write # Needed to create releases
@@ -67,16 +67,15 @@ jobs:
6767
require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2) + '\n');
6868
"
6969
70-
- name: Setup Node.js for npm publishing
71-
uses: actions/setup-node@v4
72-
with:
73-
node-version: "20"
74-
registry-url: "https://registry.npmjs.org"
70+
- name: Verify package can be packed
71+
run: |
72+
bun publish --dry-run
73+
echo "Package dry-run successful"
7574
76-
- name: Publish to npm
77-
run: npm publish --provenance --access public
75+
- name: Publish to npm with Bun
76+
run: bun publish --access public
7877
env:
79-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
78+
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
8079

8180
- name: Generate changelog
8281
id: changelog
@@ -136,6 +135,6 @@ jobs:
136135
137136
- name: Notify
138137
run: |
139-
echo "🎉 Successfully released id-ts v${{ steps.get_version.outputs.version }}"
138+
echo "🎉 Successfully released id-ts v${{ steps.get_version.outputs.version }} with Bun!"
140139
echo "📦 Published to npm: https://www.npmjs.com/package/id-ts"
141140
echo "🏷️ GitHub Release: https://github.com/max-programming/id-ts/releases/tag/v${{ steps.get_version.outputs.version }}"

package.json

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
{
22
"name": "id-ts",
33
"version": "1.0.0",
4+
"description": "A lightweight, type-safe TypeScript library for generating prefixed IDs with customizable options",
5+
"author": "Max Programming",
6+
"license": "MIT",
7+
"repository": {
8+
"type": "git",
9+
"url": "git+https://github.com/max-programming/id-ts.git"
10+
},
11+
"bugs": {
12+
"url": "https://github.com/max-programming/id-ts/issues"
13+
},
14+
"homepage": "https://github.com/max-programming/id-ts#readme",
15+
"keywords": [
16+
"id",
17+
"uuid",
18+
"nanoid",
19+
"typescript",
20+
"prefixed-ids",
21+
"type-safe",
22+
"id-generation",
23+
"unique-id"
24+
],
425
"types": "./dist/index.d.ts",
526
"main": "./dist/index.js",
627
"module": "./dist/index.js",
@@ -17,10 +38,11 @@
1738
"test": "vitest",
1839
"test:ui": "vitest --ui",
1940
"test:run": "vitest run",
20-
"release": "npm run test:run && npm run build && npm version",
21-
"release:patch": "npm run release patch && git push && git push --tags",
22-
"release:minor": "npm run release minor && git push && git push --tags",
23-
"release:major": "npm run release major && git push && git push --tags"
41+
"publish:dry": "bun publish --dry-run",
42+
"release": "bun test:run && bun run build",
43+
"release:patch": "bun run release && bun version patch && git push && git push --tags",
44+
"release:minor": "bun run release && bun version minor && git push && git push --tags",
45+
"release:major": "bun run release && bun version major && git push && git push --tags"
2446
},
2547
"files": [
2648
"dist",
@@ -45,21 +67,5 @@
4567
"zod": {
4668
"optional": true
4769
}
48-
},
49-
"repository": {
50-
"type": "git",
51-
"url": "https://github.com/max-programming/id-ts"
52-
},
53-
"homepage": "https://github.com/max-programming/id-ts#readme",
54-
"bugs": {
55-
"url": "https://github.com/max-programming/id-ts/issues"
56-
},
57-
"keywords": [
58-
"id",
59-
"nanoid",
60-
"unique",
61-
"identifier",
62-
"prefix"
63-
],
64-
"license": "MIT"
70+
}
6571
}

0 commit comments

Comments
 (0)