faye-redis-ng 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.github/SETUP.md DELETED
@@ -1,251 +0,0 @@
1
- # GitHub Actions Setup Guide
2
-
3
- This document explains how to set up automated publishing for faye-redis-ng using **Trusted Publishing (OIDC)**.
4
-
5
- ## Prerequisites
6
-
7
- 1. ✅ GitHub repository created
8
- 2. ✅ npm account created (https://www.npmjs.com/signup)
9
- 3. ✅ Package name `faye-redis-ng` available on npm
10
-
11
- ## 🔒 What is Trusted Publishing?
12
-
13
- **Trusted Publishing** is npm's modern authentication method using OpenID Connect (OIDC). It's:
14
- - ✅ **More secure** - No tokens to manage or leak
15
- - ✅ **Easier** - No manual token creation needed
16
- - ✅ **Automatic** - GitHub authenticates directly with npm
17
- - ✅ **Recommended** by npm for all new projects
18
-
19
- **Old way**: Create npm token → Store in GitHub Secrets → Hope it doesn't leak
20
- **New way**: Configure once on npm → GitHub handles authentication automatically
21
-
22
- ---
23
-
24
- ## Step 1: Configure Trusted Publishing on npm
25
-
26
- ### 1.1 First Publish (Manual, One-time)
27
-
28
- For the **first publish only**, you need to create the package manually:
29
-
30
- ```bash
31
- # Login to npm
32
- npm login
33
-
34
- # Publish the first version
35
- npm publish --access public
36
- ```
37
-
38
- This creates the package on npm. After this, you can use automated publishing.
39
-
40
- ### 1.2 Configure Trusted Publishing
41
-
42
- After the first manual publish:
43
-
44
- 1. Go to your package on npm: `https://www.npmjs.com/package/faye-redis-ng`
45
- 2. Click **Settings** tab
46
- 3. Scroll to **Publishing access**
47
- 4. Click **Add trusted publisher**
48
- 5. Fill in the form:
49
- - **Provider**: GitHub Actions
50
- - **Repository owner**: `YOUR-GITHUB-USERNAME`
51
- - **Repository name**: `faye-redis-ng`
52
- - **Workflow name**: `publish.yml`
53
- - **Environment name**: Leave empty (not using environments)
54
- 6. Click **Add**
55
-
56
- **That's it!** No tokens needed, no GitHub secrets to manage.
57
-
58
- ## Step 2: Verify Configuration
59
-
60
- Check your npm package settings page:
61
- - ✅ Trusted publisher should show: `github:YOUR-USERNAME/faye-redis-ng`
62
- - ✅ Workflow: `publish.yml`
63
-
64
- ## Step 3: How to Publish
65
-
66
- Publishing is now fully automated! Here's the workflow:
67
-
68
- ### Option A: Using Git Commands (Recommended)
69
-
70
- ```bash
71
- # 1. Update version in package.json (already done for v1.0.1)
72
-
73
- # 2. Commit all changes
74
- git add .
75
- git commit -m "Release v1.0.1"
76
-
77
- # 3. Create and push tag
78
- git tag v1.0.1
79
- git push origin master
80
- git push origin v1.0.1
81
-
82
- # 4. GitHub Actions will automatically:
83
- # ✓ Run tests
84
- # ✓ Publish to npm
85
- # ✓ Create GitHub Release
86
- ```
87
-
88
- ### Option B: Using npm version Command
89
-
90
- ```bash
91
- # This automatically updates package.json, creates git tag, and commits
92
- npm version patch -m "Release %s"
93
- git push origin master --follow-tags
94
-
95
- # GitHub Actions will handle the rest!
96
- ```
97
-
98
- ## Step 4: Verify Automated Publishing
99
-
100
- After pushing a tag, check:
101
-
102
- 1. **GitHub Actions Tab**:
103
- - https://github.com/YOUR-USERNAME/faye-redis-ng/actions
104
- - You should see "Publish to npm" workflow running
105
-
106
- 2. **npm Package**:
107
- - Wait 1-2 minutes
108
- - Visit: https://www.npmjs.com/package/faye-redis-ng
109
- - Verify new version is published
110
-
111
- 3. **GitHub Releases**:
112
- - https://github.com/YOUR-USERNAME/faye-redis-ng/releases
113
- - A new release should be created automatically
114
-
115
- ## Workflow Details
116
-
117
- ### CI Workflow (ci.yml)
118
-
119
- Runs on every push and PR:
120
- - ✅ Syntax checks
121
- - ✅ Integration tests (with Redis)
122
- - ✅ Package validation
123
-
124
- ### Publish Workflow (publish.yml)
125
-
126
- Runs when you push a tag (e.g., `v1.0.1`):
127
- - ✅ Verifies tag matches package.json version
128
- - ✅ Runs tests
129
- - ✅ Publishes to npm with provenance
130
- - ✅ Creates GitHub Release with changelog
131
- - ✅ Uploads package tarball to release
132
-
133
- ## Version Bumping Guide
134
-
135
- ### Patch Release (Bug fixes)
136
- ```bash
137
- npm version patch
138
- # 1.0.1 → 1.0.2
139
- ```
140
-
141
- ### Minor Release (New features, backward compatible)
142
- ```bash
143
- npm version minor
144
- # 1.0.1 → 1.1.0
145
- ```
146
-
147
- ### Major Release (Breaking changes)
148
- ```bash
149
- npm version major
150
- # 1.0.1 → 2.0.0
151
- ```
152
-
153
- Then push:
154
- ```bash
155
- git push origin master --follow-tags
156
- ```
157
-
158
- ## Troubleshooting
159
-
160
- ### "npm ERR! 403 Forbidden" or "E403"
161
-
162
- **Problem**: Trusted publishing not configured correctly
163
-
164
- **Solution**:
165
- 1. Go to https://www.npmjs.com/package/faye-redis-ng/access
166
- 2. Verify trusted publisher is configured
167
- 3. Check repository owner and name match exactly
168
- 4. Workflow name must be `publish.yml` (not `.github/workflows/publish.yml`)
169
- 5. Try removing and re-adding the trusted publisher
170
-
171
- ### "npm ERR! 404 Not Found"
172
-
173
- **Problem**: Package doesn't exist yet
174
-
175
- **Solution**: Do the first manual publish:
176
- ```bash
177
- npm login
178
- npm publish --access public
179
- ```
180
- Then configure trusted publishing on npm
181
-
182
- ### "Version mismatch"
183
-
184
- **Problem**: Tag version doesn't match package.json
185
-
186
- **Solution**:
187
- ```bash
188
- # If tag is v1.0.1 but package.json shows 1.0.0
189
- # Delete the tag
190
- git tag -d v1.0.1
191
- git push origin :refs/tags/v1.0.1
192
-
193
- # Update package.json version to 1.0.1
194
- # Then create tag again
195
- git tag v1.0.1
196
- git push origin v1.0.1
197
- ```
198
-
199
- ### Tests fail in CI but work locally
200
-
201
- **Problem**: Redis not available or different environment
202
-
203
- **Solution**:
204
- - The CI workflow includes Redis service
205
- - Check if test expects specific Redis configuration
206
- - Review workflow logs for specific errors
207
-
208
- ## Security Best Practices
209
-
210
- ✅ **DO**:
211
- - Use Trusted Publishing (already configured)
212
- - Enable 2FA on your npm account
213
- - Use npm provenance (already configured)
214
- - Keep your GitHub repository secure
215
-
216
- ❌ **DON'T**:
217
- - Create automation tokens (not needed with Trusted Publishing)
218
- - Store npm tokens in GitHub Secrets (not needed)
219
- - Share publishing access unnecessarily
220
-
221
- ## Manual Override
222
-
223
- If you need to publish manually (emergency or first publish):
224
-
225
- ```bash
226
- # Publish manually
227
- npm login
228
- npm publish --access public
229
- ```
230
-
231
- This works even with Trusted Publishing configured.
232
-
233
- ## Next Steps
234
-
235
- After setup is complete:
236
-
237
- 1. ✅ Test the workflow with a patch release
238
- 2. ✅ Monitor first automated publish
239
- 3. ✅ Update README with automation badges (optional)
240
- 4. ✅ Set up branch protection rules (optional)
241
-
242
- ## Questions?
243
-
244
- - GitHub Actions Docs: https://docs.github.com/en/actions
245
- - npm Publishing Guide: https://docs.npmjs.com/creating-and-publishing-scoped-public-packages
246
- - GitHub Actions for npm: https://docs.npmjs.com/generating-provenance-statements
247
-
248
- ---
249
-
250
- **Setup by**: Claude Code
251
- **Last updated**: January 2026
@@ -1,219 +0,0 @@
1
- # Trusted Publishing Quick Reference
2
-
3
- ## What is Trusted Publishing?
4
-
5
- **Trusted Publishing** uses OpenID Connect (OIDC) to allow GitHub Actions to publish directly to npm without requiring authentication tokens.
6
-
7
- ### Benefits
8
-
9
- ✅ **More Secure**
10
- - No long-lived tokens to manage
11
- - No risk of token leakage in logs
12
- - Authentication happens per-publish
13
-
14
- ✅ **Easier to Use**
15
- - No GitHub Secrets to configure
16
- - No token rotation needed
17
- - One-time setup on npm
18
-
19
- ✅ **npm Recommended**
20
- - Official recommendation from npm
21
- - Industry best practice
22
- - Future-proof authentication
23
-
24
- ## Setup (5 minutes)
25
-
26
- ### Step 1: First Manual Publish
27
-
28
- ```bash
29
- npm login
30
- npm publish --access public
31
- ```
32
-
33
- This creates the package on npm. Only needed once.
34
-
35
- ### Step 2: Configure Trusted Publisher
36
-
37
- 1. **Go to your package settings**:
38
- ```
39
- https://www.npmjs.com/package/faye-redis-ng/settings
40
- ```
41
-
42
- 2. **Scroll to "Publishing access"**
43
-
44
- 3. **Click "Add trusted publisher"**
45
-
46
- 4. **Fill in the form**:
47
- - **Provider**: Select "GitHub Actions"
48
- - **Repository owner**: Your GitHub username (e.g., `johndoe`)
49
- - **Repository name**: `faye-redis-ng`
50
- - **Workflow name**: `publish.yml` (exactly this, not the full path)
51
- - **Environment name**: Leave empty
52
-
53
- 5. **Click "Add"**
54
-
55
- ### Step 3: Verify
56
-
57
- Check that the trusted publisher appears:
58
- ```
59
- Provider: GitHub Actions
60
- Repository: YOUR-USERNAME/faye-redis-ng
61
- Workflow: publish.yml
62
- ```
63
-
64
- ## How It Works
65
-
66
- ```mermaid
67
- sequenceDiagram
68
- participant Dev as Developer
69
- participant GH as GitHub
70
- participant npm as npm Registry
71
-
72
- Dev->>GH: Push tag v1.0.1
73
- GH->>GH: Run workflow
74
- GH->>npm: Request OIDC token
75
- npm->>npm: Verify repository & workflow
76
- npm->>GH: Grant publish permission
77
- GH->>npm: Publish package
78
- npm->>Dev: Package published!
79
- ```
80
-
81
- 1. You push a git tag
82
- 2. GitHub Actions workflow starts
83
- 3. GitHub requests OIDC token from npm
84
- 4. npm verifies the request matches trusted publisher config
85
- 5. npm grants temporary publish permission
86
- 6. GitHub publishes your package
87
- 7. Done! Token expires immediately
88
-
89
- ## Configuration in Workflow
90
-
91
- In `.github/workflows/publish.yml`:
92
-
93
- ```yaml
94
- permissions:
95
- id-token: write # Required for OIDC
96
- contents: write # Required for GitHub Releases
97
-
98
- steps:
99
- - name: Setup Node.js
100
- uses: actions/setup-node@v4
101
- with:
102
- node-version: '22'
103
- registry-url: 'https://registry.npmjs.org'
104
- # No NODE_AUTH_TOKEN needed!
105
-
106
- - name: Publish to npm
107
- run: npm publish --access public --provenance
108
- # No env variables needed!
109
- ```
110
-
111
- ## Troubleshooting
112
-
113
- ### 403 Forbidden Error
114
-
115
- **Problem**: npm rejects publish with 403
116
-
117
- **Checklist**:
118
- - [ ] Did you do the first manual publish?
119
- - [ ] Is trusted publisher configured on npm?
120
- - [ ] Does repository owner match exactly?
121
- - [ ] Is workflow name exactly `publish.yml` (not full path)?
122
- - [ ] Is the package scoped correctly?
123
-
124
- **Solution**:
125
- 1. Verify at: `https://www.npmjs.com/package/faye-redis-ng/access`
126
- 2. Check repository name matches exactly
127
- 3. Remove and re-add trusted publisher if needed
128
-
129
- ### 404 Not Found Error
130
-
131
- **Problem**: Package doesn't exist
132
-
133
- **Solution**: Do the first manual publish:
134
- ```bash
135
- npm login
136
- npm publish --access public
137
- ```
138
-
139
- ### Workflow Doesn't Run
140
-
141
- **Problem**: Push tag but no workflow triggered
142
-
143
- **Checklist**:
144
- - [ ] Tag starts with `v` (e.g., `v1.0.1`)
145
- - [ ] Workflow file exists: `.github/workflows/publish.yml`
146
- - [ ] GitHub Actions enabled in repository settings
147
-
148
- ### Permission Denied
149
-
150
- **Problem**: "Permission denied" or "id-token: write not set"
151
-
152
- **Solution**: Check workflow has correct permissions:
153
- ```yaml
154
- permissions:
155
- id-token: write
156
- contents: write
157
- ```
158
-
159
- ## Comparison: Token vs Trusted Publishing
160
-
161
- | Feature | npm Token | Trusted Publishing |
162
- |---------|-----------|-------------------|
163
- | **Setup** | Create token, add to secrets | Configure once on npm |
164
- | **Security** | Token can leak | No tokens to leak |
165
- | **Rotation** | Manual every 90 days | Automatic per-publish |
166
- | **Revocation** | Manual | Automatic on workflow end |
167
- | **Best Practice** | ❌ Legacy | ✅ Recommended |
168
- | **npm Recommendation** | No | Yes |
169
-
170
- ## Migration from Token-Based
171
-
172
- If you're switching from token-based publishing:
173
-
174
- 1. **Remove the token**:
175
- - Go to GitHub: Settings → Secrets → Actions
176
- - Delete `NPM_TOKEN` secret (if exists)
177
-
178
- 2. **Remove from workflow**:
179
- ```yaml
180
- # Delete this:
181
- env:
182
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
183
- ```
184
-
185
- 3. **Configure Trusted Publishing** (see Step 2 above)
186
-
187
- 4. **Test**: Push a tag and verify it works
188
-
189
- ## Resources
190
-
191
- - [npm Trusted Publishing Docs](https://docs.npmjs.com/generating-provenance-statements)
192
- - [GitHub OIDC Docs](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
193
- - [Provenance Guide](https://docs.npmjs.com/generating-provenance-statements)
194
-
195
- ## FAQ
196
-
197
- **Q: Do I need to do anything special in my workflow?**
198
- A: No! Just `npm publish` without any tokens.
199
-
200
- **Q: Can I still publish manually?**
201
- A: Yes! `npm login && npm publish` still works.
202
-
203
- **Q: Does this work with private packages?**
204
- A: Yes, works with both public and private packages.
205
-
206
- **Q: Can I use this with multiple repositories?**
207
- A: Yes, add each repository as a trusted publisher.
208
-
209
- **Q: What if I change the repository name?**
210
- A: Update the trusted publisher config on npm.
211
-
212
- **Q: Is this production-ready?**
213
- A: Yes! Used by thousands of packages, recommended by npm.
214
-
215
- ---
216
-
217
- **Last Updated**: January 2026
218
- **Status**: ✅ Production Ready
219
- **Security**: 🔒 Industry Best Practice
@@ -1,70 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches: [master]
6
- pull_request:
7
- branches: [master]
8
-
9
- jobs:
10
- test:
11
- runs-on: ubuntu-latest
12
-
13
- strategy:
14
- matrix:
15
- node-version: [22.x]
16
-
17
- services:
18
- redis:
19
- image: valkey/valkey:9-alpine
20
- ports:
21
- - 6379:6379
22
- options: >-
23
- --health-cmd "redis-cli ping"
24
- --health-interval 10s
25
- --health-timeout 5s
26
- --health-retries 5
27
-
28
- steps:
29
- - name: Checkout code
30
- uses: actions/checkout@v4
31
- with:
32
- submodules: recursive
33
-
34
- - name: Setup Node.js ${{ matrix.node-version }}
35
- uses: actions/setup-node@v4
36
- with:
37
- node-version: ${{ matrix.node-version }}
38
- cache: "npm"
39
-
40
- - name: Install dependencies
41
- run: npm ci
42
-
43
- - name: Run syntax check
44
- run: node -c faye-redis.js
45
-
46
- - name: Verify package can be built
47
- run: npm pack --dry-run
48
-
49
- lint:
50
- runs-on: ubuntu-latest
51
-
52
- steps:
53
- - name: Checkout code
54
- uses: actions/checkout@v4
55
-
56
- - name: Setup Node.js
57
- uses: actions/setup-node@v4
58
- with:
59
- node-version: "22"
60
-
61
- - name: Install dependencies
62
- run: npm ci
63
-
64
- - name: Check package.json validity
65
- run: node -e "JSON.parse(require('fs').readFileSync('package.json', 'utf8'))"
66
-
67
- - name: Verify files for npm package
68
- run: |
69
- echo "Files that will be published:"
70
- npm pack --dry-run
@@ -1,77 +0,0 @@
1
- name: Publish to npm
2
-
3
- on:
4
- push:
5
- tags:
6
- - 'v*' # Triggers on version tags like v1.0.1, v1.2.0, etc.
7
-
8
- jobs:
9
- publish:
10
- runs-on: ubuntu-latest
11
-
12
- permissions:
13
- contents: write # Needed to create GitHub releases
14
- id-token: write # Needed for npm provenance and OIDC trusted publishing
15
-
16
- steps:
17
- - name: Checkout code
18
- uses: actions/checkout@v4
19
- with:
20
- fetch-depth: 0 # Fetch all history for changelog
21
-
22
- - name: Setup Node.js
23
- uses: actions/setup-node@v4
24
- with:
25
- node-version: '22'
26
- registry-url: 'https://registry.npmjs.org'
27
- # No need for NODE_AUTH_TOKEN with Trusted Publishing
28
-
29
- - name: Install dependencies
30
- run: npm ci
31
-
32
- - name: Verify package version matches tag
33
- run: |
34
- PACKAGE_VERSION=$(node -p "require('./package.json').version")
35
- TAG_VERSION=${GITHUB_REF#refs/tags/v}
36
- if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
37
- echo "❌ Package version ($PACKAGE_VERSION) doesn't match tag version ($TAG_VERSION)"
38
- exit 1
39
- fi
40
- echo "✅ Version match: $PACKAGE_VERSION"
41
-
42
- - name: Run tests (if available)
43
- run: npm test || echo "⚠️ Tests skipped (require Redis)"
44
- continue-on-error: true
45
-
46
- - name: Build package
47
- run: npm pack
48
-
49
- - name: Publish to npm (Trusted Publishing with OIDC)
50
- run: npm publish --access public --provenance
51
-
52
- - name: Extract changelog for this version
53
- id: changelog
54
- run: |
55
- TAG_VERSION=${GITHUB_REF#refs/tags/v}
56
- # Extract changelog section for this version
57
- CHANGELOG=$(awk "/## \[$TAG_VERSION\]/,/## \[/{if (/## \[/ && !/$TAG_VERSION/) exit; if (!/## \[$TAG_VERSION\]/) print}" CHANGELOG.md)
58
- # Save to file for GitHub release
59
- echo "$CHANGELOG" > .release-notes.md
60
- echo "✅ Extracted changelog for v$TAG_VERSION"
61
-
62
- - name: Create GitHub Release
63
- uses: softprops/action-gh-release@v1
64
- with:
65
- files: '*.tgz'
66
- body_path: .release-notes.md
67
- draft: false
68
- prerelease: false
69
- env:
70
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71
-
72
- - name: Success notification
73
- run: |
74
- TAG_VERSION=${GITHUB_REF#refs/tags/v}
75
- echo "🎉 Successfully published faye-redis-ng@$TAG_VERSION to npm"
76
- echo "📦 Package: https://www.npmjs.com/package/faye-redis-ng"
77
- echo "🏷️ Release: https://github.com/${{ github.repository }}/releases/tag/v$TAG_VERSION"