Skip to content

feat(codegen): add cleanStaleTargets option to generateMulti#1247

Merged
pyramation merged 2 commits into
mainfrom
feat/codegen-clean-stale-targets
May 31, 2026
Merged

feat(codegen): add cleanStaleTargets option to generateMulti#1247
pyramation merged 2 commits into
mainfrom
feat/codegen-clean-stale-targets

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

@pyramation pyramation commented May 31, 2026

Summary

Eliminates hardcoded target directory lists across the SDK generation pipeline. Two changes:

  1. graphql-codegen: Adds cleanStaleTargets?: boolean to GenerateMultiOptions and exports removeStaleTargetDirs(). When enabled, generateMulti() auto-removes output subdirectories that don't match any current target name before generating — replacing manual rimraf cleanup.

  2. All 3 SDK generate scripts (constructive-sdk, constructive-cli, constructive-react): Pass cleanStaleTargets: true to generateMulti(). Remove pregenerate scripts that hardcoded rimraf src/admin src/auth src/objects src/public src/index.ts — stale cleanup is now automatic and schema-driven.

Part of a 3-PR series:

  • This PR (codegen + SDK scripts)
  • constructive-db #1444 — auto-derive API_NAMES from API_SCHEMA_MAP
  • constructive-hub — glob-based schema propagation (pending)

Link to Devin session: https://app.devin.ai/sessions/169e0931b82147e3b52ad3d8d704c17d
Requested by: @pyramation

Add removeStaleTargetDirs() utility and cleanStaleTargets option to
generateMulti(). When enabled, scans the output root and removes
subdirectories that don't match any current target name — eliminating
the need for pregenerate scripts with hardcoded directory lists.

Exported as a standalone function for direct use by generate scripts.
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

All three SDK generate scripts (constructive-sdk, constructive-cli,
constructive-react) now pass cleanStaleTargets: true to generateMulti.
Remove the pregenerate npm scripts with hardcoded target directories —
stale directory cleanup is now handled automatically by the codegen.
@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​types/​semver@​7.7.11001007581100
Added@​types/​react-dom@​19.2.31001007585100
Added@​types/​react@​19.2.151001007995100
Added@​types/​request-ip@​0.0.411001008580100

View full report

@pyramation pyramation merged commit 0932516 into main May 31, 2026
38 checks passed
@pyramation pyramation deleted the feat/codegen-clean-stale-targets branch May 31, 2026 04:46
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