|
1 | | -# Publishing Guide: Node.js SDK v0.5.0 |
2 | | - |
3 | | -## Pre-Publishing Checklist |
4 | | - |
5 | | -✅ Version bumped to 0.5.0 in package.json |
6 | | -✅ CHANGELOG.md updated with v0.5.0 release notes |
7 | | -✅ README.md updated with alerts examples |
8 | | -✅ All tests passing (43/43) |
9 | | -✅ TypeScript compilation successful |
10 | | -✅ Code committed and pushed to GitHub |
11 | | - |
12 | | -## Publishing to npm |
13 | | - |
14 | | -### Step 1: Verify npm Authentication |
15 | | - |
16 | | -```bash |
17 | | -npm whoami |
18 | | -# Should show: oilpriceapi (or your npm username) |
19 | | -``` |
20 | | - |
21 | | -If not logged in: |
22 | | -```bash |
23 | | -npm login |
24 | | -``` |
25 | | - |
26 | | -### Step 2: Run Final Checks |
27 | | - |
28 | | -```bash |
29 | | -# Ensure clean working directory |
30 | | -git status |
31 | | - |
32 | | -# Run tests one more time |
33 | | -npm test |
34 | | - |
35 | | -# Build production bundle |
36 | | -npm run build |
37 | | - |
38 | | -# Check what will be published |
39 | | -npm pack --dry-run |
40 | | -``` |
41 | | - |
42 | | -### Step 3: Publish to npm |
43 | | - |
44 | | -```bash |
45 | | -# Publish to npm registry |
46 | | -npm publish |
47 | | - |
48 | | -# Expected output: |
49 | | -# + oilpriceapi@0.5.0 |
50 | | -``` |
51 | | - |
52 | | -### Step 4: Verify Publication |
53 | | - |
54 | | -```bash |
55 | | -# Check npm registry |
56 | | -npm view oilpriceapi |
57 | | - |
58 | | -# Install in test project |
59 | | -mkdir /tmp/test-npm-install |
60 | | -cd /tmp/test-npm-install |
61 | | -npm init -y |
62 | | -npm install oilpriceapi@0.5.0 |
63 | | - |
64 | | -# Verify version |
65 | | -npm list oilpriceapi |
66 | | -``` |
67 | | - |
68 | | -### Step 5: Tag Release on GitHub |
69 | | - |
70 | | -```bash |
71 | | -git tag -a v0.5.0 -m "Release v0.5.0: Price Alerts Support" |
72 | | -git push origin v0.5.0 |
73 | | -``` |
74 | | - |
75 | | -### Step 6: Create GitHub Release |
76 | | - |
77 | | -Go to: https://github.com/OilpriceAPI/oilpriceapi-node/releases/new |
78 | | - |
79 | | -- Tag: v0.5.0 |
80 | | -- Title: v0.5.0 - Price Alerts Support |
81 | | -- Description: Copy from CHANGELOG.md v0.5.0 section |
82 | | -- Attach: None needed (published to npm) |
83 | | - |
84 | | -## Post-Publishing |
85 | | - |
86 | | -### Update Documentation Website |
87 | | - |
88 | | -```bash |
89 | | -# If you have a docs deployment script |
90 | | -npm run deploy:docs |
91 | | -``` |
92 | | - |
93 | | -### Announce Release |
94 | | - |
95 | | -1. **Twitter/X**: |
96 | | - ``` |
97 | | - 🚀 OilPriceAPI Node.js SDK v0.5.0 is now live! |
98 | | -
|
99 | | - New: Price Alerts 🔔 |
100 | | - • Monitor commodity prices 24/7 |
101 | | - • Webhook notifications |
102 | | - • 5 comparison operators |
103 | | - • Alert cooldown periods |
104 | | -
|
105 | | - npm install oilpriceapi@0.5.0 |
106 | | -
|
107 | | - Docs: https://docs.oilpriceapi.com/sdk/nodejs |
108 | | - ``` |
109 | | - |
110 | | -2. **Reddit** (r/node, r/javascript): |
111 | | - - Title: "OilPriceAPI Node.js SDK v0.5.0: Price Alerts Feature" |
112 | | - - Link to GitHub release |
113 | | - |
114 | | -3. **Email to Users**: |
115 | | - - Subject: "New Feature: Price Alerts Now Available" |
116 | | - - Highlight webhook notifications and automation |
117 | | - |
118 | | -## Troubleshooting |
119 | | - |
120 | | -### "You do not have permission to publish" |
121 | | -- Verify npm account has publish rights to @oilpriceapi scope |
122 | | -- Check npm organization membership |
123 | | - |
124 | | -### "Version already published" |
125 | | -- Version 0.5.0 already exists on npm |
126 | | -- Bump to 0.5.1 if you need to republish |
127 | | - |
128 | | -### "Invalid package.json" |
129 | | -- Run `npm pack --dry-run` to check package contents |
130 | | -- Verify all required fields present |
131 | | - |
132 | | -## Quick Publish Command |
133 | | - |
134 | | -```bash |
135 | | -# One-liner (use with caution) |
136 | | -npm test && npm run build && npm publish && git tag -a v0.5.0 -m "Release v0.5.0" && git push origin v0.5.0 |
137 | | -``` |
138 | | - |
139 | | -## Rollback (If Needed) |
140 | | - |
141 | | -```bash |
142 | | -# Deprecate version (don't unpublish) |
143 | | -npm deprecate oilpriceapi@0.5.0 "This version has issues, use 0.5.1" |
144 | | - |
145 | | -# Publish fixed version |
146 | | -npm version patch # Bumps to 0.5.1 |
147 | | -npm publish |
148 | | -``` |
149 | | - |
150 | | -## Success Indicators |
151 | | - |
152 | | -✅ Package appears on npm: https://www.npmjs.com/package/oilpriceapi |
153 | | -✅ Version 0.5.0 listed in versions tab |
154 | | -✅ `npm install oilpriceapi@0.5.0` works globally |
155 | | -✅ GitHub release created |
156 | | -✅ Git tag pushed |
157 | | -✅ Downloads counter incrementing |
158 | | - |
159 | | ---- |
160 | | - |
161 | | -**Ready to publish!** 🚀 |
162 | | - |
163 | | -Run: `npm publish` |
| 1 | +# Publishing Guide: Node.js SDK |
| 2 | + |
| 3 | +## Automated Publishing (Recommended) |
| 4 | + |
| 5 | +Publishing is now automated via GitHub Actions. Simply: |
| 6 | + |
| 7 | +1. Update version in `package.json` and `src/version.ts` |
| 8 | +2. Update `CHANGELOG.md` |
| 9 | +3. Commit and push to `main` |
| 10 | +4. Create a GitHub Release with the version tag |
| 11 | + |
| 12 | +The `.github/workflows/publish.yml` workflow will: |
| 13 | + |
| 14 | +- Run tests |
| 15 | +- Build ESM + CJS |
| 16 | +- Publish to npm with provenance |
| 17 | + |
| 18 | +## Manual Publishing |
| 19 | + |
| 20 | +### Pre-Publishing Checklist |
| 21 | + |
| 22 | +- [ ] Version bumped in `package.json` and `src/version.ts` |
| 23 | +- [ ] CHANGELOG.md updated |
| 24 | +- [ ] All tests passing (185+) |
| 25 | +- [ ] TypeScript compilation successful |
| 26 | +- [ ] ESLint passes (`npm run lint`) |
| 27 | + |
| 28 | +### Steps |
| 29 | + |
| 30 | +```bash |
| 31 | +# 1. Verify clean state |
| 32 | +git status |
| 33 | +npm test |
| 34 | +npm run lint |
| 35 | +npm run build |
| 36 | + |
| 37 | +# 2. Check package contents |
| 38 | +npm pack --dry-run |
| 39 | + |
| 40 | +# 3. Publish |
| 41 | +npm publish |
| 42 | + |
| 43 | +# 4. Tag and push |
| 44 | +git tag -a vX.Y.Z -m "Release vX.Y.Z" |
| 45 | +git push origin vX.Y.Z |
| 46 | + |
| 47 | +# 5. Create GitHub Release at: |
| 48 | +# https://github.com/OilpriceAPI/oilpriceapi-node/releases/new |
| 49 | +``` |
| 50 | + |
| 51 | +### Verify |
| 52 | + |
| 53 | +```bash |
| 54 | +npm view oilpriceapi versions |
| 55 | +npm install oilpriceapi@latest |
| 56 | +``` |
| 57 | + |
| 58 | +## Rollback |
| 59 | + |
| 60 | +```bash |
| 61 | +npm deprecate oilpriceapi@X.Y.Z "Use X.Y.Z+1 instead" |
| 62 | +``` |
0 commit comments