Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(store,world): add option to codegen tables into namespace dirs #2840

Merged
merged 15 commits into from
May 23, 2024

Conversation

holic
Copy link
Member

@holic holic commented May 16, 2024

No description provided.

Copy link

changeset-bot bot commented May 16, 2024

🦋 Changeset detected

Latest commit: a5d2afd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 23 packages
Name Type
@latticexyz/store Patch
@latticexyz/world Patch
@latticexyz/cli Patch
@latticexyz/dev-tools Patch
@latticexyz/query Patch
@latticexyz/react Patch
@latticexyz/store-indexer Patch
@latticexyz/store-sync Patch
@latticexyz/world-modules Patch
mock-game-contracts Patch
@latticexyz/abi-ts Patch
@latticexyz/block-logs-stream Patch
@latticexyz/common Patch
@latticexyz/config Patch
create-mud Patch
@latticexyz/faucet Patch
@latticexyz/gas-report Patch
@latticexyz/protocol-parser Patch
@latticexyz/recs Patch
@latticexyz/schema-type Patch
solhint-config-mud Patch
solhint-plugin-mud Patch
@latticexyz/utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@holic holic changed the title WIP codegen namespace dirs feat(store,world): add option to codegen tables into namespace dirs May 22, 2024
@holic holic marked this pull request as ready for review May 22, 2024 09:13
@holic holic requested review from alvrs and yonadaaa as code owners May 22, 2024 09:13
@@ -4,7 +4,7 @@ export default defineStore({
codegen: {
storeImportPath: "../../",
},
namespace: "store" as const,
Copy link
Contributor

Choose a reason for hiding this comment

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

What happened to this? Is the namespace strongly typed without it?

Copy link
Member Author

@holic holic May 22, 2024

Choose a reason for hiding this comment

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

yep! this was leftover from previous iterations, it's still strongly typed without it (as enforced by store config tests)

@@ -126,7 +126,7 @@ export function resolveTableCodegen<input extends TableInput>(input: input): res
storeArgument: get(options, "storeArgument") ?? TABLE_CODEGEN_DEFAULTS.storeArgument,
// dataStruct is true if there are at least 2 value fields
dataStruct: get(options, "dataStruct") ?? Object.keys(input.schema).length - input.key.length > 1,
} satisfies TableCodegen as resolveTableCodegen<input>;
} satisfies TableCodegen as never;
Copy link
Contributor

Choose a reason for hiding this comment

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

🫨

Copy link
Member Author

Choose a reason for hiding this comment

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

this just aligns with the rest of our as never usage, context here: https://discord.com/channels/865335009915961364/1199772289495990404/1230849460842532915

Copy link
Contributor

Choose a reason for hiding this comment

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

very interesting, thank you!

},
namespace: "store",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this removed?

And shouldn't we have an example of a namespaced table?

Copy link
Member Author

@holic holic May 22, 2024

Choose a reason for hiding this comment

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

these test tables don't need to live in the same namespace as store-default tables (and this change was an artifact of some earlier refactoring but decided to leave it because it felt closer to the intent of these test tables)

Copy link
Contributor

@yonadaaa yonadaaa left a comment

Choose a reason for hiding this comment

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

works for me!

@holic holic merged commit c10c9fb into main May 23, 2024
12 checks passed
@holic holic deleted the holic/codegen-namespaces branch May 23, 2024 10:22
@holic holic mentioned this pull request Jul 16, 2024
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