Repository navigation
chore: fix generate-function-bindings tool - #262
Closed
X-Guardian wants to merge 2 commits into
Closed
X-Guardian wants to merge 2 commits into
X-Guardian wants to merge 2 commits into
Conversation
This was referenced Jun 12, 2026
so0k
added a commit
that referenced
this pull request
Jun 13, 2026
## Summary - Supersedes #262 by carrying forward the existing X-Guardian `generate-function-bindings` fix history and adding a minimal follow-up fix. - Preserves the original X-Guardian contribution commits in this branch history for author attribution, including `3e3741298 chore: fix generate-function-bindings tool`. - Fixes the root generator command to run through the pnpm workspace instead of running a nested install. - Avoids requiring `@cdktn/commons` as a tool package workspace dependency by using a type-only source import for `AttributeType`. ## Test Plan - `pnpm install --frozen-lockfile --ignore-scripts` - `pnpm run generate-function-bindings` - `git diff --exit-code -- packages/cdktn/src/functions/terraform-functions.generated.ts packages/@cdktn/hcl2cdk/src/function-bindings/functions.generated.ts` - `pnpm --filter generate-function-bindings exec tsc --noEmit` - `pnpm exec prettier --check package.json tools/generate-function-bindings/package.json tools/generate-function-bindings/scripts/generate.ts pnpm-lock.yaml` ## Notes - I could not push the branch directly to `open-constructs/cdk-terrain` with the available `sakul-learning` GitHub token (`403 Permission denied`), so this PR uses `sakul-learning:chore/supersede-262-generate-function-bindings` as the head while targeting `open-constructs/cdk-terrain:main`. - The submitted branch preserves the original commit SHAs where possible instead of cherry-picking/squashing them. Supersedes #262. --------- Co-authored-by: Simon Heather <simon.heather@yulife.com> Co-authored-by: Simon Heather <32168619+X-Guardian@users.noreply.github.com> Co-authored-by: so0k <vincent.drl@gmail.com>
Contributor
|
merged via #273 |
Contributor
|
I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Repairs the
tools/generate-function-bindingstool, which broke during the yarn→pnpm migration, and removes its dead library/test/publish scaffolding. No runtime/library behaviour changes — the two generated files (packages/cdktn/src/functions/terraform-functions.generated.tsandpackages/@cdktn/hcl2cdk/src/function-bindings/functions.generated.ts) regenerate byte-for-byte identically to what's already committed, so this is tooling-only.Why it was broken: the migration bumped Prettier v2→v3 and tightened pnpm's dependency isolation, and an earlier
@cdktnrestructure had moved sources tosrc/. None of that was reflected in this tool, sopnpm run generate-function-bindingsfailed.Fixes (each surfaced as a failure when running the tool):
prettier.format()now returnsPromise<string>; the tool was writing the unresolved promise to disk. Addedawaitat both call sites ingenerate.tsand the one infetch-metadata.ts.babelparser rejects TypeScript. The generator emits TS type annotations (e.g.static "abs"(num: number)), so formatting failed with a syntax error. Switched bothgenerate.tscalls fromparser: "babel"toparser: "babel-ts".lib/. Sources live insrc/(lib/buildare gitignored tsc output); the tool wrote a stray file intocdktn/lib/and failed withENOENTforhcl2cdk/lib/(whose build dir isbuild/, notlib/). Repointed both output paths tosrc/.@babel/*type declarations.@types/babel__generatorand@types/babel__templatewere present at the workspace root but hidden from the tool by pnpm's strict isolation, sots-nodefailed to type-check. Declared both as direct devDependencies.Cleanup of dead scaffolding (this is a private, run-via-
ts-nodescript collection — no tests, no build output, no consumers):jest.config.js(no*.test.tsfiles exist — jest never ran),package.sh+.npmignore(the tool isprivateand outside lerna/nx scope, so it's never packed/published),ambient.d.ts(augmentedSpawnOptions.signal, which nothing here uses —fetch-metadataonly callsexecSync, and@types/node20.x already declares it), and.gitignore(every rule was a no-op or vestigial boilerplate copied from the@cdktn/*packages; the root.gitignorealready covers anything this tool produces).package.jsonto the two scripts that are actually invoked (fetch-metadata,generate); removed the never-runbuild/watch/test/package/dist-cleanlifecycle and themain/typesfields (which pointed at a non-existentsrc/index.*).tsconfig.jsonincludeand thelint-stagedglob fromsrc/**toscripts/**so they point at the real code (both previously matched nothing); dropped the now-obsoletefiles: [ambient.d.ts]and*.test.tsxexclude.generate-function-bindingsscript to drive the tool by workspace filter (pnpm --filter generate-function-bindings run …) instead ofcd … && pnpm install, since the tool is a workspace member whose deps are installed by the root.Checklist