Skip to content

fix(generate): declare @apso/crud deps in v1-template projects - #142

Merged
cultron merged 2 commits into
mainfrom
fix/svc52-compile
Oct 4, 2026
Merged

cultron merged 2 commits into
mainfrom
fix/svc52-compile

Conversation

@cultron

@cultron cultron commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Problem

Prod service 52 (Inventory Management, 9 entities) passes schema lint but the in-browser Build fails. The schema is fine. The cause is a template mismatch:

  • The prod starter (apso-workspaces-prod/starter/template/code.zip, dated 2025-12-01) is still the v1 template with @nestjsx/crud 4.5.0. Staging's starter was moved to v2 on 2026-08-12; prod was not.
  • CLI 0.38.4 (the client pin) and 0.39.2 both generate code that imports @apso/crud*.

Result on the prod starter: 117 errors, 13 per entity, regardless of schema shape:

  • TS2307: Cannot find module '@apso/crud' (36), '@apso/crud-request' (9), '@apso/crud-typeorm' (9)
  • TS2339: Property 'repo' does not exist on type 'XService' (45), 'getOne' (9), 'createOne' (9)

The same schema compiles cleanly (0 errors) on template v2.0.0 with both 0.38.4 and 0.39.2.

Fix

apso generate (TypeScript) now adds any missing @apso/crud, crud-core, crud-request, crud-typeorm (^1.0.1, matching template v2.0.0) to package.json and prints a line saying to run npm install. Existing @nestjsx deps stay because hand-written code may import them.

Verified: prod starter + this branch + svc52 schema, then npm install && npm run build exits 0.

Tests

  • test/lib/utils/crud-deps.test.ts: v1 project gets the deps, v2 project untouched, no package.json is a no-op, and a drift guard that generates the svc52 fixture and asserts every @apso/* import is in APSO_CRUD_DEPS.
  • scaffold-smoke: new APSORC_FIXTURE option and a typescript + fixture leg using test/fixtures/inventory-multi-fk.apsorc. Passes locally.

Note: scaffold-smoke clones template v2.0.0, so it could not have caught this; the gap was the prod starter zip, not codegen.

Companion: client PR runs npm install after scaffold when package.json gained deps.

Generated TypeScript code imports @apso/crud, crud-core, crud-request and
crud-typeorm. Projects created from the v1 template (@nestjsx/crud), which is
still the prod starter zip, don't declare them, so nest build failed with 117
errors on a 9-entity schema (TS2307 on @apso/crud*, then TS2339 repo/getOne/
createOne). generate now adds any missing ones to package.json and says to run
npm install. @nestjsx deps are left in place.

Also adds the failing prod schema as a fixture: a drift test asserts every
@apso import in generated code is a declared dep, and scaffold-smoke gets an
APSORC_FIXTURE option plus a typescript+fixture leg.
@cultron
cultron force-pushed the fix/svc52-compile branch from 0fe921c to ab4b602 Compare October 4, 2026 17:59
@cultron
cultron merged commit 18c9b49 into main Oct 4, 2026
3 checks passed
@cultron
cultron deleted the fix/svc52-compile branch October 4, 2026 18:01
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.

1 participant