-
Notifications
You must be signed in to change notification settings - Fork 5
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
Move top level modules into utils #2604
base: main
Are you sure you want to change the base?
Conversation
@@ -4,15 +4,5 @@ | |||
"require": [ | |||
"tsconfig-paths/register" | |||
] | |||
}, |
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.
Are you sure this is not needed? I think the issue without it was that ts-node couldn't resolve the module paths.
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.
Pretty sure - these all exist in the top level tsconfig. I might be missing something though.
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.
This is in fact needed to run pnpm --filter product-catalog generateTypes
. Put back in 8f31213.
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.
This is great, arguably errors
and stage
don't really belong in a utils
directory. They might be better off in their own specific directory? Don't mind too much about that though.
As I've commented elsewhere, are you sure we don't need those paths in the ts configs?
Supporting files at the top level of the modules dir was a bit of an exception and meant we needed an additional rule in the jest config. It's only one line but it doubled the cognitive load of understanding how the module mappings worked, and it lead to some inconsistency of how modules were imported. Because of the exception, it also meant top level modules tests weren't getting run in CI.
For some reason things break with ts-node when this is removed, like it doesn't properly use the extended tsconfig. This broke: $ pnpm --filter product-catalog generateTypes
8f31213
to
854c068
Compare
What does this change?
All files at the top level of
modules
have been moved intoutils
and are now imported as such (e.g.import { getIfDefined } from '@modules/utils/nullAndUndefined'
. Supporting files at the top level of the modules dir was a bit of an exception and meant we needed an additional rule in the jest config. It's only one line but it doubled the cognitive load of understanding how the module mappings worked, and it lead to some inconsistency of how modules were imported.Because of the exception, it also meant top level modules tests weren't getting run in CI.
How to test
How can we measure success?
Have we considered potential risks?
Images
Accessibility