|
| 1 | +# Publishing Guide for CommitWeave |
| 2 | + |
| 3 | +## Versioning Strategy |
| 4 | + |
| 5 | +### Beta Phase (Current) |
| 6 | +- **Current version**: `0.1.0-beta.1` |
| 7 | +- **NPM tag**: `beta` |
| 8 | +- **Installation**: `npm install -g @typeweaver/commitweave@beta` |
| 9 | + |
| 10 | +### Version Format |
| 11 | +- **Beta releases**: `0.1.0-beta.1`, `0.1.0-beta.2`, etc. |
| 12 | +- **Stable releases**: `0.1.0`, `0.2.0`, `1.0.0`, etc. |
| 13 | +- **Alpha releases**: `0.1.0-alpha.1` (if needed) |
| 14 | + |
| 15 | +## Setup for NPM Publishing |
| 16 | + |
| 17 | +### 1. NPM Token Setup |
| 18 | +1. Create an NPM account at [npmjs.com](https://npmjs.com) |
| 19 | +2. Generate an automation token: |
| 20 | + ```bash |
| 21 | + npm login |
| 22 | + npm token create --type=automation |
| 23 | + ``` |
| 24 | +3. Add the token to GitHub Secrets: |
| 25 | + - Go to your repo: Settings → Secrets and variables → Actions |
| 26 | + - Add a new secret named `NPM_TOKEN` with your token value |
| 27 | + |
| 28 | +### 2. Publishing Process |
| 29 | + |
| 30 | +#### Beta Releases (Recommended for now) |
| 31 | +1. Update version in `package.json`: |
| 32 | + ```bash |
| 33 | + npm version 0.1.0-beta.2 --no-git-tag-version |
| 34 | + ``` |
| 35 | +2. Create and push beta tag: |
| 36 | + ```bash |
| 37 | + git add package.json |
| 38 | + git commit -m "chore: bump version to 0.1.0-beta.2" |
| 39 | + git tag v0.1.0-beta.2 |
| 40 | + git push origin main |
| 41 | + git push origin v0.1.0-beta.2 |
| 42 | + ``` |
| 43 | + |
| 44 | +#### Stable Releases (Future) |
| 45 | +1. Update to stable version: |
| 46 | + ```bash |
| 47 | + npm version 0.1.0 --no-git-tag-version |
| 48 | + ``` |
| 49 | +2. Create and push stable tag: |
| 50 | + ```bash |
| 51 | + git add package.json |
| 52 | + git commit -m "chore: release v0.1.0" |
| 53 | + git tag v0.1.0 |
| 54 | + git push origin main |
| 55 | + git push origin v0.1.0 |
| 56 | + ``` |
| 57 | + |
| 58 | +#### Manual Release |
| 59 | +1. Go to Actions → Release |
| 60 | +2. Click "Run workflow" |
| 61 | +3. Enter version and select prerelease option |
| 62 | + |
| 63 | +### 3. Tagging Strategy (Single Main Branch) |
| 64 | +```bash |
| 65 | +# Beta releases |
| 66 | +v0.1.0-beta.1, v0.1.0-beta.2, v0.1.0-beta.3 |
| 67 | + |
| 68 | +# Stable releases |
| 69 | +v0.1.0, v0.2.0, v1.0.0 |
| 70 | + |
| 71 | +# Current stable tag (latest stable) |
| 72 | +latest → points to most recent stable |
| 73 | +``` |
| 74 | + |
| 75 | +### 4. Installation Commands |
| 76 | +```bash |
| 77 | +# Beta (current) |
| 78 | +npm install -g @typeweaver/commitweave@beta |
| 79 | + |
| 80 | +# Stable (future) |
| 81 | +npm install -g @typeweaver/commitweave |
| 82 | + |
| 83 | +# Specific version |
| 84 | +npm install -g @typeweaver/ [email protected] |
| 85 | +``` |
| 86 | + |
| 87 | +### 5. Pre-publish Checklist |
| 88 | +- [ ] All tests pass: `npm test` |
| 89 | +- [ ] Build succeeds: `npm run build` |
| 90 | +- [ ] Package structure is correct: `ls -la dist/` |
| 91 | +- [ ] Version updated in `package.json` |
| 92 | +- [ ] NPM_TOKEN secret is configured in GitHub |
| 93 | +- [ ] Appropriate tag format (beta vs stable) |
| 94 | + |
| 95 | +### 6. Post-publish Verification |
| 96 | +```bash |
| 97 | +# Check beta release |
| 98 | +npm view @typeweaver/commitweave@beta |
| 99 | + |
| 100 | +# Check all versions |
| 101 | +npm view @typeweaver/commitweave versions --json |
| 102 | + |
| 103 | +# Test installation |
| 104 | +npm install -g @typeweaver/commitweave@beta |
| 105 | +commitweave init |
| 106 | +``` |
| 107 | + |
| 108 | +## Development vs Production |
| 109 | + |
| 110 | +- **Development**: Use `npx tsx bin/index.ts` for full functionality |
| 111 | +- **Production**: The built CLI has limited functionality (init works, create shows placeholder) |
| 112 | +- This is due to complex ESM/CommonJS module resolution in the build |
| 113 | + |
| 114 | +## Package Structure |
| 115 | +``` |
| 116 | +dist/ |
| 117 | +├── bin.js # CLI executable |
| 118 | +├── index.js # Main CommonJS entry |
| 119 | +├── index.mjs # ESM entry |
| 120 | +├── index.d.ts # TypeScript definitions |
| 121 | +└── lib/ # Internal modules |
| 122 | +``` |
| 123 | + |
| 124 | +The package is ready for publishing! 🚀 |
0 commit comments