Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Keep sibling npm scripts in sync for local and prod
Add the matching :prod script instead of leaving the production run as a hand-typed command.
Bad example
| 1 | "db:seed:defaults:local": "NODE_ENV=development tsx scripts/seed.ts", |
| 2 | "db:seed:defaults:prod": "NODE_ENV=production tsx scripts/seed.ts", |
| 3 | "db:import:journalists:local": "NODE_ENV=development tsx scripts/importJournalists.ts" |
| 4 | // no :prod sibling — the one run that touches production is hand-typed |
Explanation (EN)
Every other script in the file has both a :local and a :prod entry, but the new one only has :local — the operator running it against production has to remember and correctly hand-type NODE_ENV=production, exactly the kind of manual step where a typo goes unnoticed.
Objašnjenje (HR)
Svaki drugi skript u datoteci ima i :local i :prod unos, ali novi ima samo :local — operater koji ga pokreće na produkciji mora se sjetiti i ručno ispravno upisati NODE_ENV=production, upravo onakav ručni korak gdje tipfeler prođe neopaženo.
Good example
| 1 | "db:import:journalists:local": "NODE_ENV=development tsx scripts/importJournalists.ts", |
| 2 | "db:import:journalists:prod": "NODE_ENV=production tsx scripts/importJournalists.ts" |
Explanation (EN)
Add the matching :prod script alongside :local, following the same convention as every other script in the file, so the production run is a fixed, reviewable command rather than something typed from memory.
Objašnjenje (HR)
Dodaj odgovarajući :prod skript uz :local, prateći istu konvenciju kao svaki drugi skript u datoteci, tako da produkcijsko pokretanje bude fiksna, pregledna naredba, a ne nešto što se upisuje iz sjećanja.