|
| 1 | +# Publishing Guide |
| 2 | + |
| 3 | +## Package Info |
| 4 | + |
| 5 | +- **Name**: `autosizes` |
| 6 | +- **Repository**: https://github.com/yournextagency/autosizes |
| 7 | +- **Size**: |
| 8 | + - Source: 8.2 KB |
| 9 | + - Minified: 2.3 KB |
| 10 | + - Gzipped: 1.1 KB |
| 11 | + |
| 12 | +## Publishing to npm |
| 13 | + |
| 14 | +### Prerequisites |
| 15 | + |
| 16 | +1. **npm account**: Create at https://www.npmjs.com/signup |
| 17 | +2. **Login**: `npm login` |
| 18 | +3. **Verify**: `npm whoami` |
| 19 | + |
| 20 | +### Before Publishing |
| 21 | + |
| 22 | +1. **Test build**: |
| 23 | + ```bash |
| 24 | + npm run build |
| 25 | + ``` |
| 26 | + |
| 27 | +2. **Verify files**: |
| 28 | + ```bash |
| 29 | + npm pack --dry-run |
| 30 | + ``` |
| 31 | + |
| 32 | + Should include: |
| 33 | + - autosizes.js |
| 34 | + - autosizes.min.js |
| 35 | + - index.js |
| 36 | + - LICENSE |
| 37 | + - README.md |
| 38 | + - package.json |
| 39 | + |
| 40 | +3. **Test locally**: |
| 41 | + ```bash |
| 42 | + npm pack |
| 43 | + # Creates autosizes-1.0.0.tgz |
| 44 | + # Test in another project: |
| 45 | + npm install /path/to/autosizes-1.0.0.tgz |
| 46 | + ``` |
| 47 | + |
| 48 | +### Publishing |
| 49 | + |
| 50 | +```bash |
| 51 | +# First time publish |
| 52 | +npm publish |
| 53 | + |
| 54 | +# Future updates |
| 55 | +npm version patch # 1.0.0 -> 1.0.1 |
| 56 | +npm version minor # 1.0.0 -> 1.1.0 |
| 57 | +npm version major # 1.0.0 -> 2.0.0 |
| 58 | +npm publish |
| 59 | +``` |
| 60 | + |
| 61 | +## After Publishing |
| 62 | + |
| 63 | +### CDN Links |
| 64 | + |
| 65 | +Once published, the package will be automatically available on these CDNs: |
| 66 | + |
| 67 | +#### unpkg (fastest, recommended) |
| 68 | +```html |
| 69 | +<!-- Latest version --> |
| 70 | +<script type="module" src="https://unpkg.com/autosizes"></script> |
| 71 | + |
| 72 | +<!-- Specific version --> |
| 73 | +<script type="module" src="https://unpkg.com/autosizes@1.0.0/index.js"></script> |
| 74 | + |
| 75 | +<!-- Minified --> |
| 76 | +<script src="https://unpkg.com/autosizes@1.0.0/autosizes.min.js"></script> |
| 77 | +``` |
| 78 | + |
| 79 | +#### jsDelivr (with fallback CDN) |
| 80 | +```html |
| 81 | +<!-- Latest version --> |
| 82 | +<script type="module" src="https://cdn.jsdelivr.net/npm/autosizes"></script> |
| 83 | + |
| 84 | +<!-- Specific version --> |
| 85 | +<script type="module" src="https://cdn.jsdelivr.net/npm/autosizes@1.0.0/index.js"></script> |
| 86 | + |
| 87 | +<!-- Minified --> |
| 88 | +<script src="https://cdn.jsdelivr.net/npm/autosizes@1.0.0/autosizes.min.js"></script> |
| 89 | +``` |
| 90 | + |
| 91 | +### Verify CDN Availability |
| 92 | + |
| 93 | +After publishing, wait 5-10 minutes, then check: |
| 94 | + |
| 95 | +- unpkg: https://unpkg.com/autosizes |
| 96 | +- jsDelivr: https://cdn.jsdelivr.net/npm/autosizes |
| 97 | + |
| 98 | +## GitHub Release |
| 99 | + |
| 100 | +Create a GitHub release to match the npm version: |
| 101 | + |
| 102 | +1. Go to: https://github.com/yournextagency/autosizes/releases/new |
| 103 | +2. Tag: `v1.0.0` |
| 104 | +3. Title: `v1.0.0 - Initial Release` |
| 105 | +4. Description: |
| 106 | + ```markdown |
| 107 | + ## Features |
| 108 | + - Automatic `sizes` attribute calculation |
| 109 | + - Smart picture element support |
| 110 | + - Modern ES6 implementation |
| 111 | + - Only 2.3KB minified, 1.1KB gzipped |
| 112 | + |
| 113 | + ## Installation |
| 114 | + ```bash |
| 115 | + npm install autosizes |
| 116 | + ``` |
| 117 | + |
| 118 | + ## CDN |
| 119 | + ```html |
| 120 | + <script type="module" src="https://unpkg.com/autosizes@1.0.0"></script> |
| 121 | + ``` |
| 122 | + ``` |
| 123 | +5. Attach files: |
| 124 | + - autosizes.min.js |
| 125 | + - autosizes.js |
| 126 | + |
| 127 | +## CDNJS (Optional) |
| 128 | + |
| 129 | +For CDNJS inclusion, create a request at: |
| 130 | +https://github.com/cdnjs/packages/issues |
| 131 | + |
| 132 | +Requirements: |
| 133 | +- Published to npm |
| 134 | +- At least 800 stars on GitHub OR |
| 135 | +- 200 downloads/week on npm |
| 136 | + |
| 137 | +## Marketing |
| 138 | + |
| 139 | +After publishing, announce on: |
| 140 | +- Twitter/X |
| 141 | +- Dev.to |
| 142 | +- Reddit (r/webdev, r/javascript) |
| 143 | +- Hacker News |
| 144 | + |
| 145 | +Example tweet: |
| 146 | +``` |
| 147 | +🚀 Just published autosizes - automatic sizes calculation for responsive images! |
| 148 | +
|
| 149 | +📦 Only 1.1KB gzipped |
| 150 | +⚡️ Based on lazysizes |
| 151 | +🎯 Modern ES6 |
| 152 | +✨ Zero config |
| 153 | +
|
| 154 | +npm install autosizes |
| 155 | +
|
| 156 | +https://github.com/yournextagency/autosizes |
| 157 | +``` |
| 158 | + |
| 159 | +## Maintenance |
| 160 | + |
| 161 | +### Update README on npm |
| 162 | + |
| 163 | +After publishing, the README on npm will automatically update from the GitHub repo. |
| 164 | + |
| 165 | +### Monitor |
| 166 | + |
| 167 | +- npm downloads: https://npm-stat.com/charts.html?package=autosizes |
| 168 | +- Bundle size: https://bundlephobia.com/package/autosizes |
| 169 | +- GitHub stats: Watch stars, issues, PRs |
| 170 | + |
| 171 | +### Support |
| 172 | + |
| 173 | +- Issues: https://github.com/yournextagency/autosizes/issues |
| 174 | +- Email: support@yournextagency.com (if applicable) |
| 175 | + |
| 176 | +## Unpublishing (Emergency Only) |
| 177 | + |
| 178 | +```bash |
| 179 | +# Only within 72 hours of publishing |
| 180 | +npm unpublish autosizes@1.0.0 |
| 181 | + |
| 182 | +# Deprecate instead (preferred) |
| 183 | +npm deprecate autosizes@1.0.0 "Security issue, please upgrade" |
| 184 | +``` |
| 185 | + |
| 186 | +**Note**: Never unpublish unless absolutely necessary (security issue). Use `npm deprecate` instead. |
0 commit comments