pottery-diary/docs/BUILD_INSTRUCTIONS.md

208 lines
4.1 KiB
Markdown

# Build Instructions - Pottery Diary
## Quick Start (Development)
```bash
# Navigate to project
cd pottery-diary
# Install dependencies (if not already done)
npm install
# Start Expo development server
npm start
# In another terminal, run on platform:
npm run ios # iOS Simulator (Mac only)
npm run android # Android Emulator
```
## Testing
```bash
# Run all unit tests
npm test
# Watch mode for development
npm run test:watch
# Expected output: All tests passing for:
# - Temperature conversions
# - Cone converter
# - Duration formatting
```
## Production Builds
### Prerequisites
1. Install EAS CLI: `npm install -g eas-cli`
2. Create Expo account: https://expo.dev/signup
3. Login: `eas login`
### Configure Project
```bash
# First time only
eas build:configure
# This creates/updates eas.json and app.json
```
### Build Commands
#### iOS
```bash
# Build for iOS
eas build --platform ios --profile production
# Build for iOS Simulator (testing)
eas build --platform ios --profile preview
```
#### Android
```bash
# Build APK for Android
eas build --platform android --profile production
# Build for testing
eas build --platform android --profile preview
```
#### Both Platforms
```bash
eas build --platform all --profile production
```
### Build Profiles (eas.json)
- **development**: Development client with debugging
- **preview**: Internal testing builds (APK for Android, Simulator for iOS)
- **production**: Store-ready builds
## Troubleshooting
### Common Issues
#### 1. SQLite not found
```bash
# Reinstall expo-sqlite
npx expo install expo-sqlite
```
#### 2. Navigation errors
```bash
# Clear cache and restart
npx expo start --clear
```
#### 3. TypeScript errors
```bash
# Check TypeScript compilation
npx tsc --noEmit
```
#### 4. Test failures
```bash
# Clear Jest cache
npm test -- --clearCache
npm test
```
### Platform-Specific
#### iOS
- **Xcode required**: Mac with Xcode 14+ for local builds
- **Simulator**: Install via Xcode → Preferences → Components
- **Certificates**: EAS handles signing for cloud builds
#### Android
- **Android Studio**: Install for local emulator
- **SDK**: API Level 26+ (Android 8.0+)
- **Emulator**: Create AVD with Google Play Store
## Environment Setup
### Required
- Node.js 18+
- npm 9+
- Expo CLI (installed via npx)
### Optional (for local builds)
- Xcode 14+ (iOS, Mac only)
- Android Studio 2022+ (Android)
- EAS CLI (cloud builds)
## Database Management
### Reset Database (Development)
```bash
# Uninstall app to clear SQLite database
# Or delete app data via device settings
# Database auto-migrates on next launch
```
### View Database
```bash
# Use a SQLite browser to inspect:
# iOS: ~/Library/Developer/CoreSimulator/Devices/[DEVICE_ID]/data/Containers/Data/Application/[APP_ID]/Library/Application Support/SQLite/pottery_diary.db
# Android: Use adb or Device File Explorer in Android Studio
```
## Performance Optimization
### App Size
- Current: ~20-30 MB (target < 30 MB)
- Photos are compressed on import
- No large assets bundled
### Speed
- Cold start: <1s (target)
- List scrolling: 60 FPS
- Database queries: <50ms for most operations
## Release Checklist
- [ ] All tests passing (`npm test`)
- [ ] TypeScript compiles (`npx tsc --noEmit`)
- [ ] No console errors in dev mode
- [ ] Test on both iOS and Android
- [ ] Accessibility check (VoiceOver/TalkBack)
- [ ] Update version in app.json
- [ ] Update CHANGELOG.md
- [ ] Build with EAS
- [ ] Test build on physical devices
- [ ] Submit to App Store / Play Store
## Continuous Integration (Future)
Recommended setup:
- GitHub Actions for automated testing
- EAS Build on push to main
- Detox for E2E testing
Example `.github/workflows/test.yml`:
```yaml
name: Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- run: npm test
```
## Support
- Issues: https://github.com/yourusername/pottery-diary/issues
- Expo Docs: https://docs.expo.dev/
- React Native Docs: https://reactnative.dev/
---
Last Updated: 2025-01-15