-
Notifications
You must be signed in to change notification settings - Fork 194
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
refactor(store): update tablegen with namespaces output #2972
Conversation
🦋 Changeset detectedLatest commit: e9071c7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
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 |
320f7f4
to
a6f9179
Compare
TestTypeInt64: { filePath: "./contracts/src/types.sol", type: "int64" }, | ||
TestTypeBool: { filePath: "./contracts/src/types.sol", type: "bool" }, | ||
TestTypeUint128: { filePath: "./contracts/src/types.sol", type: "uint128" }, | ||
TestTypeAddress: { filePath: "../contracts/src/types.sol", type: "address" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously, codegen expected this path to be relative to process.cwd()
(almost always the project root/same dir as the mud.config.ts
)
once I changed the paths to be relative to the project root/mud.config.ts
, this broke, because for this particular script, the config is in a slightly different place
this was an inconsistency/edge case that should now be more consistent and predictable and enables better resolving of user types from within namespaced directories
TestTypeAddress: { filePath: "../contracts/src/types.sol", type: "address" }, | ||
TestTypeInt64: { filePath: "../contracts/src/types.sol", type: "int64" }, | ||
"TestTypeLibrary.TestTypeBool": { filePath: "../contracts/src/types.sol", type: "bool" }, | ||
"TestTypeLibrary.TestTypeUint128": { filePath: "../contracts/src/types.sol", type: "uint128" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously, codegen would parse the file at filePath
to determine where in the file was the specified user type and then propagate the fully qualified name everywhere
this felt too "automagic" to me and added a lot of complexity to codegen that I was able to remove by not automatically inferring the code path for the user type (with the nice side effect that we no longer need remappings for tablegen)
we can still support this (imo rare) case by specifying the fully qualified type name like above
(maybe in the future could improve this with a similar "label" approach where the label is used in config references like schemas, and allow specifying a fully qualified code path override of internalType
that gets used in codegen)
@@ -2,7 +2,7 @@ import { defineStore } from "./ts/config/v2/store"; | |||
|
|||
export default defineStore({ | |||
codegen: { | |||
storeImportPath: "../../", | |||
storeImportPath: "./src", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi this is an internal config option
reminders to self when refactoring worldgen:
worldImportPath
like we did here forstoreImportPath
usedInPath
and then get rid ofsolidityRelativeImportPath
and related code