Skip to content

Conversation

@calintje
Copy link
Contributor

@calintje calintje commented Sep 24, 2025

  • Commit Codama-generated sources:

    • TypeScript: ts-sdk/client/src/generated
    • Rust: rust-sdk/client/src/generated
  • Add CI workflow verify-generated.yml:

    • Reuses ./.github/actions/anchor (Rust v1.84.0, Node v22.8.0, Solana v1.17.25, Anchor v0.29.0)
    • Runs anchor build, yarn generate:clients, and fails on diffs in generated dirs
  • Add generation scripts and Nx targets:

    • Root: generate:idl, generate:ts, generate:rs, generate:clients
    • Each client: generate script
  • Centralize Codama versions via root resolutions

  • Update .gitignore to ensure generated dirs are tracked

  • Add .prettierignore to exclude lint checks on generated code

- '.github/workflows/**'

jobs:
verify-generated:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can just add this to the checks.yml file?

.gitignore Outdated
solana-release
rust-sdk/integration/**/Cargo.lock
ts-sdk/integration/**/Cargo.lock
!/ts-sdk/client/src/generated/
Copy link
Member

Choose a reason for hiding this comment

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

Are there any other */generated files? We might just remove the whole entry

.prettierignore Outdated
@@ -0,0 +1,2 @@
/ts-sdk/client/src/generated/
Copy link
Member

Choose a reason for hiding this comment

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

I think as part of the generate script we should run formatter. Now it is publishing unformatted code

package.json Outdated
"lint": "nx run-many --target lint --projects",
"clean": "nx reset && nx run-many --target clean --projects"
"clean": "nx reset && nx run-many --target clean --projects",
"generate:idl": "anchor build",
Copy link
Member

Choose a reason for hiding this comment

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

I think you should instead of adding the scripts here use nx to delegate the generate command to each respective sub-project.

package.json Outdated
"tsup": "^8.4.0",
"vitest": "^3.0.9"
},
"resolutions": {
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need resolutions here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea is that the generator templates/formatting can change across releases, causing diffs without any program changes. The verify-generated check could fail on incidental upstream changes. I added resolutions to centralize the exact versions.

"scripts": {
"build": "node ./codama.js && cargo build",
"generate": "node ./codama.js",
"format:generated": "yarn workspace @orca-so/whirlpools-lint prettier --write ../../rust-sdk/client/src/generated",
Copy link
Member

Choose a reason for hiding this comment

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

The issue with prettier is that it infers most of the rules based on the existing code. You might have to run the normal format command. Also why are we running prettier on rust code? 👀

"scripts": {
"build": "node ./codama.js && tsup src/index.ts --format cjs,esm --dts --sourcemap",
"generate": "node ./codama.js",
"format:generated": "yarn workspace @orca-so/whirlpools-lint prettier --write ../../ts-sdk/client/src/generated",
Copy link
Member

Choose a reason for hiding this comment

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

Same thing with this one. I uguess just running the full formatter would work better

package.json Outdated
"generate:ts": "nx run @orca-so/whirlpools-client:generate || yarn --cwd ts-sdk/client run generate",
"generate:rs": "nx run @orca-so/whirlpools-rust-client:generate || yarn --cwd rust-sdk/client run generate",
"generate:clients": "yarn generate:ts && yarn generate:rs"
"generate:clients": "yarn generate:ts && yarn generate:rs && yarn format:generated",
Copy link
Member

Choose a reason for hiding this comment

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

These should be using nx and not defined manually as a script


"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/no-empty-object-type": "off",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the generated code has a lot of empty objects, so added this rule

Copy link
Member

@wjthieme wjthieme left a comment

Choose a reason for hiding this comment

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

🚢

@calintje calintje merged commit 634b06a into main Sep 26, 2025
7 checks passed
@calintje calintje deleted the calintje/commit-generated-code branch September 26, 2025 20:59
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.

3 participants