Skip to content

fix: add npcs.json and objs.json seed data with build validation - #98

Open
xusuxiang8 wants to merge 1 commit into
Bitcoindefi:mainfrom
xusuxiang8:fix/npcs-json-seed
Open

fix: add npcs.json and objs.json seed data with build validation#98
xusuxiang8 wants to merge 1 commit into
Bitcoindefi:mainfrom
xusuxiang8:fix/npcs-json-seed

Conversation

@xusuxiang8

Copy link
Copy Markdown

Closes #83 and #84

Changes

  • Added api/src/jsons/npcs.json - NPC seed data extracted from game DB
  • Added api/src/jsons/objs.json - Item/object definitions seed data
  • Updated build script: explicit file validation before copy instead of wildcard cp
  • Build now fails early if any critical JSON seed file is missing

Root Cause

Both issues (#83 market test, #84 wiki endpoint) failed because
the CI build was missing npcs.json in api/src/jsons/. The wildcard
cp src/jsons/*.json silently skipped missing files.

Verification

  • All 67 tests pass locally
  • Build script validates 6 required JSON files before copying

Comment thread api/package.json
"remove-newbie-items:prod": "node dist/scripts/removeNewbieItemsFromHighLevelCharacters.js",
"reset-spell-stats": "tsx src/scripts/resetSpellStats.ts",
"reset-spell-stats:prod": "node dist/scripts/resetSpellStats.js",
"build": "pnpm run clean && tsc && echo --- Verifying JSON seed files --- && test -f src/jsons/balance.json && test -f src/jsons/craftingRecipes.json && test -f src/jsons/npcs.json && test -f src/jsons/objs.json && test -f src/jsons/smeltingRecipes.json && test -f src/jsons/spells.json && echo All JSON seed files present && mkdir -p dist/jsons dist/mapas_source && cp src/jsons/balance.json src/jsons/craftingRecipes.json src/jsons/npcs.json src/jsons/objs.json src/jsons/smeltingRecipes.json src/jsons/spells.json dist/jsons/ && cp -R src/mapas_source/. dist/mapas_source/",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Quality: Build whitelist silently drops non-listed jsons/*.json files

The build was changed from cp src/jsons/*.json to an explicit list of 6 files, and each filename now appears twice (in the test -f guard and the cp argument). Any future or generated JSON seed file that is not added to both places will silently be excluded from dist/jsons/. Notably gameData.ts prefers objs.compact.json/npcs.compact.json when present via resolveSeedJsonPath; if those compact variants are ever generated into src/jsons, the old wildcard would have copied them but this new list will not, silently falling back to the full files. Consider keeping the wildcard copy (cp src/jsons/*.json dist/jsons/) for the copy step while retaining the explicit test -f checks only for the required files, so validation stays strict but no file is dropped.

Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 0 resolved / 1 findings

Adds npcs.json and objs.json seed data alongside strict build validation to prevent missing file failures. Consider adjusting the build whitelist to avoid silently dropping non-listed JSON files.

💡 Quality: Build whitelist silently drops non-listed jsons/*.json files

📄 api/package.json:25

The build was changed from cp src/jsons/*.json to an explicit list of 6 files, and each filename now appears twice (in the test -f guard and the cp argument). Any future or generated JSON seed file that is not added to both places will silently be excluded from dist/jsons/. Notably gameData.ts prefers objs.compact.json/npcs.compact.json when present via resolveSeedJsonPath; if those compact variants are ever generated into src/jsons, the old wildcard would have copied them but this new list will not, silently falling back to the full files. Consider keeping the wildcard copy (cp src/jsons/*.json dist/jsons/) for the copy step while retaining the explicit test -f checks only for the required files, so validation stays strict but no file is dropped.

🤖 Prompt for agents
Code Review: Adds npcs.json and objs.json seed data alongside strict build validation to prevent missing file failures. Consider adjusting the build whitelist to avoid silently dropping non-listed JSON files.

1. 💡 Quality: Build whitelist silently drops non-listed jsons/*.json files
   Files: api/package.json:25

   The build was changed from `cp src/jsons/*.json` to an explicit list of 6 files, and each filename now appears twice (in the `test -f` guard and the `cp` argument). Any future or generated JSON seed file that is not added to both places will silently be excluded from `dist/jsons/`. Notably `gameData.ts` prefers `objs.compact.json`/`npcs.compact.json` when present via `resolveSeedJsonPath`; if those compact variants are ever generated into `src/jsons`, the old wildcard would have copied them but this new list will not, silently falling back to the full files. Consider keeping the wildcard copy (`cp src/jsons/*.json dist/jsons/`) for the copy step while retaining the explicit `test -f` checks only for the required files, so validation stays strict but no file is dropped.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Falta api/src/jsons/npcs.json en el repositorio y el test de market no puede correr

1 participant