|
| 1 | +# Dynamic Sentry Wizard Version Implementation |
| 2 | + |
| 3 | +## Current State |
| 4 | +The Flutter and Android documentation now includes comprehensive installation options for sentry-wizard, but the version is currently hardcoded to v5.1.0 (updated from the previous v4.0.1). |
| 5 | + |
| 6 | +## Problem Solved |
| 7 | +- ✅ Added comprehensive platform support (Windows, macOS Intel/ARM, Linux x64/ARM) |
| 8 | +- ✅ Updated to latest version (v5.1.0 from v4.0.1) |
| 9 | +- ✅ Windows users no longer forced to use `brew` |
| 10 | +- ✅ Flutter developers can avoid JavaScript tooling (`npx`) if preferred |
| 11 | +- ✅ Consistent with Android documentation approach |
| 12 | + |
| 13 | +## Future Enhancement: Dynamic Version Fetching |
| 14 | + |
| 15 | +### Approach 1: Build-time Version Fetching (Recommended) |
| 16 | +Create a build script that fetches the latest version during the build process: |
| 17 | + |
| 18 | +```javascript |
| 19 | +// scripts/fetch-sentry-wizard-version.js |
| 20 | +const fs = require('fs'); |
| 21 | +const path = require('path'); |
| 22 | + |
| 23 | +async function fetchLatestVersion() { |
| 24 | + try { |
| 25 | + const response = await fetch('https://api.github.com/repos/getsentry/sentry-wizard/releases/latest'); |
| 26 | + const data = await response.json(); |
| 27 | + const version = data.tag_name.startsWith('v') ? data.tag_name : `v${data.tag_name}`; |
| 28 | + |
| 29 | + // Save to a JSON file that can be imported |
| 30 | + const versionData = { sentryWizardVersion: version }; |
| 31 | + fs.writeFileSync( |
| 32 | + path.join(__dirname, '../src/data/versions.json'), |
| 33 | + JSON.stringify(versionData, null, 2) |
| 34 | + ); |
| 35 | + |
| 36 | + console.log(`Fetched sentry-wizard version: ${version}`); |
| 37 | + } catch (error) { |
| 38 | + console.warn('Failed to fetch latest version, keeping existing version'); |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | +fetchLatestVersion(); |
| 43 | +``` |
| 44 | + |
| 45 | +### Approach 2: Runtime Component |
| 46 | +Create a React component that fetches the version dynamically: |
| 47 | + |
| 48 | +```typescript |
| 49 | +// src/components/SentryWizardInstall.tsx |
| 50 | +import { useEffect, useState } from 'react'; |
| 51 | + |
| 52 | +export function SentryWizardInstall({ platform }: { platform: string }) { |
| 53 | + const [version, setVersion] = useState('v5.1.0'); // fallback |
| 54 | + |
| 55 | + useEffect(() => { |
| 56 | + fetch('/api/sentry-wizard-version') |
| 57 | + .then(res => res.json()) |
| 58 | + .then(data => setVersion(data.version)) |
| 59 | + .catch(() => console.warn('Failed to fetch version')); |
| 60 | + }, []); |
| 61 | + |
| 62 | + // Render installation commands with dynamic version |
| 63 | + return ( |
| 64 | + // ... code blocks with ${version} interpolation |
| 65 | + ); |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | +### Approach 3: MDX Variable Replacement |
| 70 | +Use MDX processing to replace version placeholders: |
| 71 | + |
| 72 | +```javascript |
| 73 | +// In MDX processing pipeline |
| 74 | +const sentryWizardVersion = await fetchLatestVersion(); |
| 75 | +const processedContent = content.replace( |
| 76 | + /\{\{SENTRY_WIZARD_VERSION\}\}/g, |
| 77 | + sentryWizardVersion |
| 78 | +); |
| 79 | +``` |
| 80 | + |
| 81 | +### Integration Points |
| 82 | +1. **Build process**: Add version fetching to the build pipeline |
| 83 | +2. **CI/CD**: Cache GitHub API responses to avoid rate limits |
| 84 | +3. **Fallback**: Always have a recent known version as fallback |
| 85 | +4. **Consistency**: Apply to all platforms (Flutter, Android, React Native, etc.) |
| 86 | + |
| 87 | +### Implementation Priority |
| 88 | +1. **Phase 1**: ✅ Update hardcoded versions to latest (COMPLETED) |
| 89 | +2. **Phase 2**: Implement build-time version fetching |
| 90 | +3. **Phase 3**: Add runtime version checking for validation |
| 91 | +4. **Phase 4**: Automate version updates across all platforms |
| 92 | + |
| 93 | +## Files Updated |
| 94 | +- `docs/platforms/dart/guides/flutter/index.mdx` - Updated to v5.1.0 |
| 95 | +- `docs/platforms/android/index.mdx` - Updated to v5.1.0 |
| 96 | + |
| 97 | +## Benefits Achieved |
| 98 | +- **Better Windows support**: No more forcing Windows users to use `brew` |
| 99 | +- **Ecosystem alignment**: Flutter developers can avoid JavaScript tooling |
| 100 | +- **Platform consistency**: All major OS/architecture combinations supported |
| 101 | +- **Up-to-date tooling**: Using latest version instead of outdated v4.0.1 |
| 102 | +- **Maintainability**: When dynamic fetching is implemented, versions will stay current automatically |
0 commit comments