Port a Cloud Function from hmd-lineup to dgstn-lineup. Reads the source, rewrites it as TypeScript v2 gen2, wires the export, and updates the migration checklist.
Install
npx skillscat add francodgstn/dgstn-linyup/port-function Install via the SkillsCat registry.
Port a Cloud Function from hmd-lineup. Usage: /port-function <functionName>
Steps
Verify it's not already ported — check
packages/functions/src/index.tsfor an existing export of<functionName>. If it exists (and is not a stub comment), stop and tell the user.Read the source function:
C:\git\hmd\hmd-lineup\functions\src\<functionName>\index.js
Also read any util files it calls fromC:\git\hmd\hmd-lineup\functions\src\utils\.Check target utils — scan
packages/functions/src/utils/to see if equivalent helpers already exist. Use them instead of re-porting the same logic.Identify what to omit — skip or generalise any HMD-specific logic:
- Swiss QR bill, belt ranks, federation identifiers → remove
teacherfield fallback (data.teacher || data.teamId) → keep for now (legacy compat)- HMD-specific
regionalFunctions→ replace with v2 pattern
Write the ported function in
packages/functions/src/<functionName>/index.tsusing:import { onCall, HttpsError } from 'firebase-functions/v2/https'(or appropriate v2 trigger)setGlobalOptions({ region: 'europe-west6' })at top- TypeScript types; no
anyunless unavoidable to()helper from../utils/asyncfor async error handling
Wire the export — add to
packages/functions/src/index.ts:export { <functionName> } from './<functionName>'Remove the stub comment if one existed.
Build check:
pnpm --filter @linyup/functions run build
Fix any type errors before finishing.Update migration checklist — mark the function as ✅ in
docs/migration-checklist.md.Report what was ported, what was omitted, and any caveats (e.g. firestore.rules or indexes that may need updating).