|
| 1 | +# @socketbin NPM Organization Setup Checklist |
| 2 | + |
| 3 | +## ✅ Completed |
| 4 | +- [x] Created @socketbin organization on npm |
| 5 | + |
| 6 | +## 🔧 Organization Configuration |
| 7 | + |
| 8 | +### 1. Security Settings (npmjs.com → Organization Settings) |
| 9 | +- [ ] **Enable 2FA requirement** for all members |
| 10 | + - Settings → Security → Require two-factor authentication |
| 11 | +- [ ] **Set package creation** to "Restricted" (owners only) |
| 12 | + - Settings → Package Creation → Restricted |
| 13 | +- [ ] **Add team members** (if needed) |
| 14 | + - Members → Invite → Add Socket team members as owners |
| 15 | + |
| 16 | +### 2. Trusted Publishing Setup |
| 17 | + |
| 18 | +#### Configure GitHub as Trusted Publisher: |
| 19 | +1. Go to: https://www.npmjs.com/settings/socketbin/integrations |
| 20 | +2. Click "Add Trusted Publisher" |
| 21 | +3. Add configuration: |
| 22 | + ``` |
| 23 | + Repository: SocketDev/socket-cli |
| 24 | + Workflow: .github/workflows/publish-socketbin.yml |
| 25 | + Environment: (leave blank for now) |
| 26 | + ``` |
| 27 | +4. Save configuration |
| 28 | + |
| 29 | +#### NPM Token for GitHub Actions: |
| 30 | +1. Create automation token: |
| 31 | + - Go to: https://www.npmjs.com/settings/~/tokens |
| 32 | + - Click "Generate New Token" → "Granular Access Token" |
| 33 | + - Name: `socket-cli-github-actions` |
| 34 | + - Expiration: 1 year (or as per policy) |
| 35 | + - Packages: Select "@socketbin" scope |
| 36 | + - Permissions: "Read and Write" |
| 37 | + |
| 38 | +2. Add to GitHub repository: |
| 39 | + - Go to: https://github.com/SocketDev/socket-cli/settings/secrets/actions |
| 40 | + - Click "New repository secret" |
| 41 | + - Name: `NPM_TOKEN` |
| 42 | + - Value: (paste token from npm) |
| 43 | + |
| 44 | +### 3. Package Publishing Settings |
| 45 | +- [ ] **Verify scope visibility**: Public packages only |
| 46 | +- [ ] **Set up package provenance**: |
| 47 | + - Each @socketbin/* package will show ✓ Verified publisher |
| 48 | + - Automatic with trusted publishing configured |
| 49 | + |
| 50 | +## 📦 Initial Package Setup |
| 51 | + |
| 52 | +### First Package Test (Dry Run): |
| 53 | +```bash |
| 54 | +# Build a test binary locally |
| 55 | +pnpm run build:sea -- --platform=darwin --arch=arm64 |
| 56 | + |
| 57 | +# Generate test package |
| 58 | +node scripts/generate-binary-package.mjs \ |
| 59 | + --platform=darwin \ |
| 60 | + --arch=arm64 \ |
| 61 | + --version=0.0.1-test |
| 62 | + |
| 63 | +# Check generated package |
| 64 | +cd packages/binaries/cli-darwin-arm64 |
| 65 | +npm pack --dry-run |
| 66 | +``` |
| 67 | + |
| 68 | +### Verify Package Structure: |
| 69 | +``` |
| 70 | +packages/binaries/cli-darwin-arm64/ |
| 71 | +├── package.json (with correct @socketbin/cli-darwin-arm64 name) |
| 72 | +├── README.md |
| 73 | +└── bin/ |
| 74 | + └── cli (the actual binary) |
| 75 | +``` |
| 76 | + |
| 77 | +## 🚀 First Deployment |
| 78 | + |
| 79 | +### 1. Test Workflow (Dry Run): |
| 80 | +```bash |
| 81 | +# Trigger workflow with dry-run |
| 82 | +gh workflow run publish-socketbin.yml \ |
| 83 | + -f version=0.0.1-test \ |
| 84 | + -f dry-run=true |
| 85 | +``` |
| 86 | + |
| 87 | +### 2. Publish Test Version: |
| 88 | +```bash |
| 89 | +# Publish a test version to verify everything works |
| 90 | +gh workflow run publish-socketbin.yml \ |
| 91 | + -f version=0.0.1-test \ |
| 92 | + -f dry-run=false |
| 93 | +``` |
| 94 | + |
| 95 | +### 3. Verify Published Packages: |
| 96 | +Check that packages appear at: |
| 97 | +- https://www.npmjs.com/package/@socketbin/cli-darwin-arm64 |
| 98 | +- https://www.npmjs.com/package/@socketbin/cli-darwin-x64 |
| 99 | +- https://www.npmjs.com/package/@socketbin/cli-linux-arm64 |
| 100 | +- https://www.npmjs.com/package/@socketbin/cli-linux-x64 |
| 101 | +- https://www.npmjs.com/package/@socketbin/cli-win32-arm64 |
| 102 | +- https://www.npmjs.com/package/@socketbin/cli-win32-x64 |
| 103 | + |
| 104 | +Each should show: |
| 105 | +- ✓ Published by socketbin |
| 106 | +- ✓ Verified publisher badge (if provenance is working) |
| 107 | + |
| 108 | +### 4. Test Installation: |
| 109 | +```bash |
| 110 | +# Test installing the main package |
| 111 | +npm install -g socket@0.0.1-test |
| 112 | + |
| 113 | +# Verify it works |
| 114 | +socket --version |
| 115 | +``` |
| 116 | + |
| 117 | +## 🐛 Troubleshooting |
| 118 | + |
| 119 | +### If Provenance Isn't Working: |
| 120 | +1. Verify `id-token: write` permission in workflow |
| 121 | +2. Check that workflow path matches trusted publisher config exactly |
| 122 | +3. Ensure using `npm publish --provenance` flag |
| 123 | + |
| 124 | +### If Package Not Found: |
| 125 | +1. Check npm scope spelling: `@socketbin` (not @socketbinary, etc.) |
| 126 | +2. Verify package was published as public: `--access public` |
| 127 | +3. Check optionalDependencies versions match published versions |
| 128 | + |
| 129 | +### If Binary Doesn't Execute: |
| 130 | +1. Verify binary permissions (should be executable) |
| 131 | +2. Check platform detection in dispatcher script |
| 132 | +3. Test with direct binary path: `node_modules/@socketbin/cli-*/bin/cli` |
| 133 | + |
| 134 | +## 📋 Final Production Checklist |
| 135 | + |
| 136 | +Before releasing v1.x: |
| 137 | +- [ ] All 6 platform binaries build successfully |
| 138 | +- [ ] Test installation on each platform |
| 139 | +- [ ] Provenance badges appear on all packages |
| 140 | +- [ ] Main `socket` package installs correctly |
| 141 | +- [ ] Update documentation to reference new install method |
| 142 | +- [ ] Plan migration communication for existing users |
| 143 | + |
| 144 | +## 🔄 Migration Plan |
| 145 | + |
| 146 | +### Phase 1: Parallel Publishing (Current) |
| 147 | +- Continue publishing to GitHub releases (existing flow) |
| 148 | +- Also publish to @socketbin/* (new flow) |
| 149 | +- Main package still uses postinstall |
| 150 | + |
| 151 | +### Phase 2: Soft Migration (Next) |
| 152 | +- Update main package to prefer @socketbin |
| 153 | +- Keep postinstall as fallback |
| 154 | +- Monitor adoption metrics |
| 155 | + |
| 156 | +### Phase 3: Full Migration (Future) |
| 157 | +- Remove postinstall completely |
| 158 | +- Archive old GitHub releases |
| 159 | +- Update all documentation |
| 160 | + |
| 161 | +## 📊 Success Metrics |
| 162 | + |
| 163 | +Monitor after deployment: |
| 164 | +- Download counts per @socketbin/* package |
| 165 | +- Install success rate (no more postinstall failures!) |
| 166 | +- Platform distribution (which OS/arch most common) |
| 167 | +- Issue reports related to installation |
| 168 | + |
| 169 | +## 🔗 Important URLs |
| 170 | + |
| 171 | +- **Organization**: https://www.npmjs.com/org/socketbin |
| 172 | +- **Settings**: https://www.npmjs.com/settings/socketbin |
| 173 | +- **Packages**: https://www.npmjs.com/~socketbin |
| 174 | +- **GitHub Workflow**: [publish-socketbin.yml](.github/workflows/publish-socketbin.yml) |
| 175 | + |
| 176 | +--- |
| 177 | + |
| 178 | +*Created: 2024-10-07* |
| 179 | +*Status: Organization created, awaiting configuration* |
0 commit comments