Lewati ke isi

Development Workflow - Scola FE v2

Pre-Commit & Pre-Push Checklist

WAJIB: Sebelum commit dan push, selalu jalankan validasi untuk memastikan tidak ada error di workflow GitHub Actions.


Quick Command

# Run pre-push validation
./scripts/pre-push.sh

Script ini akan otomatis: 1. ✅ Run ESLint (npm run lint) 2. ✅ Check build (skip di server, validated di CI/CD)


Manual Steps

1. Lint Check (WAJIB)

npm run lint

Expected Output:

✔ No lint errors found

Jika ada error: - Fix semua error yang muncul - Jangan gunakan --fix tanpa review - pastikan fix yang benar - Re-run npm run lint sampai pass

Common Lint Errors: - unused-imports/no-unused-imports - Hapus import yang tidak digunakan - vue/no-unused-vars - Hapus variable yang tidak digunakan - no-console - Ganti console.log dengan proper logging


npm run build

Di Server (srv550716): - Build akan OOM (Out of Memory) - ini normal - Build akan divalidasi di GitHub Actions - Cukup pastikan lint pass

Di Local Development: - Build harus pass sebelum push - Fix semua build errors sebelum commit

Common Build Errors: - Missing imports - Type errors (jika menggunakan TypeScript) - Circular dependencies - Missing environment variables


Workflow Steps

Before Commit

# 1. Check status
git status

# 2. Run lint
npm run lint

# 3. Fix any errors
# ... fix code ...

# 4. Add changes
git add -A

# 5. Commit with descriptive message
git commit -m "type: description

Details:
- Change 1
- Change 2

Testing: ✅ Lint passed"

Before Push

# 1. Run pre-push validation
./scripts/pre-push.sh

# 2. If all pass, push
git push origin develop

# 3. Monitor GitHub Actions
# Check https://github.com/salfath/scola-fe-v2/actions

Commit Message Format

type: Short description (max 72 chars)

Detailed explanation:
- What changed
- Why it changed
- Any breaking changes

Testing:
- ✅ Lint passed
- ✅ Build passed (or ⚠️ Skipped on server)
- ✅ Manual testing done

Types: - feat: - New feature - fix: - Bug fix - refactor: - Code refactoring (no behavior change) - perf: - Performance improvement - style: - Code style changes (formatting, etc) - docs: - Documentation changes - test: - Test changes - chore: - Build/tooling changes


GitHub Actions Workflow

After push, GitHub Actions akan otomatis:

  1. Lint Check - ESLint validation
  2. Build Check - Vite build
  3. Deploy - Deploy to Firebase (jika di develop branch)

Monitor di:

https://github.com/salfath/scola-fe-v2/actions

Jika workflow gagal: 1. Cek error di Actions tab 2. Fix error di local 3. Commit fix 4. Push lagi


Common Issues

Lint Fails After Merge

# Pull latest changes
git pull origin develop

# Re-run lint
npm run lint

# Fix any new errors from merged code

Build Fails in CI/CD but Works Locally

  • Check Node.js version match (.nvmrc)
  • Check environment variables
  • Check dependencies versions (package-lock.json)

Push Rejected

# Pull with rebase
git pull --rebase origin develop

# Resolve conflicts if any
# ... fix conflicts ...

# Continue rebase
git rebase --continue

# Push
git push origin develop

Best Practices

  1. Always run lint before commit - Prevents CI/CD failures
  2. Write descriptive commit messages - Helps team understand changes
  3. Test locally first - Don't rely on CI/CD to catch errors
  4. Keep commits atomic - One logical change per commit
  5. Review your own code - Check git diff before commit
  6. Monitor GitHub Actions - Ensure deployment succeeds

Quick Reference

# Pre-push validation (recommended)
./scripts/pre-push.sh

# Lint only
npm run lint

# Build only (skip on server)
npm run build

# Full workflow
npm run lint && git add -A && git commit -m "fix: description" && git push origin develop

Jika benar-benar urgent dan perlu push tanpa validasi:

# Push with --no-verify (skip git hooks)
git push origin develop --no-verify

⚠️ WARNING: Ini akan skip semua validasi dan bisa menyebabkan CI/CD failure. Hanya gunakan jika benar-benar emergency dan Anda yakin kode sudah benar.


Support

Jika ada masalah dengan workflow: 1. Check GitHub Actions logs 2. Check lint errors carefully 3. Ask team for help if stuck 4. Document new issues in this file