refactor: 💡 modular file architecture (first pass)#832
Conversation
If that helps. So, if you're declaring a types file, that'd be component.types.ts and not types.ts. At the moment, we shouldn't have cross-type imports, unless I miss something in this pass, let me know if you found something. For internal exports, you have control over the types you want exposed in the ./index.js. If you'd find a situation where a particular type is shared (which I found in a few cases like that), you'd probably be interested in
At the component level, you're not allowed to import from ./index that's related to the safeguards for circular dependencies. I'm not sure if I'd block your PR because of an inline or local type? But if you do create a types file, that should be component.types.ts and not types.ts, e.g. we have component.test.ts, component.stories.ts, we'll have something similar for styles
That's fine, if you don't need a types file and wish to declare it inline or locally. But as the project grows, and you need one then I guess for consistency you'd use component.types.ts. |
…ar-file-architecture
…ar-file-architecture
|
Claude finished @punkbit's task in 2m 59s —— View job Code ReviewGreat structural work here — the modular file pattern is clean, consistent, and aligns with how major component libraries organize their code. The migration is well-scoped as a first pass and the new 🚨 Must Fix
💡 Suggestions (non-blocking)
Overall this is a well-executed, careful refactor. The one |
… exported ContextMenuItemProps interface and remove duplicate
|
Claude finished @punkbit's task in 1m 59s —— View job Code ReviewGreat structural work — the modular file pattern is clean, consistent, and well-executed for a first pass. The architecture makes components much easier to navigate. 🙌 🚨 Must Fix
💡 Suggestions (non-blocking)
Overall this is a clean, well-scoped refactor. The one residual issue with duplicate |
|
Claude finished @punkbit's task in 1m 10s —— View job Code ReviewGreat iteration — the issues flagged in previous reviews have been addressed cleanly. The 🚨 Must Fix
💡 Suggestions (non-blocking)
Architecture direction is solid and consistent across all 100 files. One small duplication to clean up in |
…ared twice in the same file
|
Claude finished @punkbit's task in 1m 32s —— View job Code ReviewGreat structural work overall — the modular file pattern is consistent and well-executed across all 100 files. The previous issues (ContextMenu duplicate types, Button 🚨 Must Fix
💡 Suggestions (non-blocking)
|
…definitions from Flyout.tsx
|
Claude finished @punkbit's task in 1m 45s —— View job Code Review
All previously flagged issues have been resolved across the review iterations: ContextMenu duplicate type declarations, Flyout stale types, Flyout duplicate declarations, and the Button 💡 Suggestions (non-blocking)
✅ Architecture is clean and consistent across all 100 files. The modular |
|
Claude finished @punkbit's task in 1m 8s —— View job
Code ReviewAll previously flagged issues have been resolved cleanly across this review cycle. The architecture is consistent, the type declarations are correct, and the changeset documents every fix. 🙌 Resolved in this iteration:
💡 Suggestions (non-blocking, carry-forward notes for future passes)
✅ Architecture is clean and consistent across all 100 files. The modular |
📚 Storybook Preview Deployed✅ Preview URL: https://click-nghyjyv0w-clickhouse.vercel.app Built from commit: |
* chore: 🤖 update required packages * chore: 🤖 provide styled components types * fix: 🐛 linter should ignore d.ts files * fix: 🐛 use double quotes * fix: 🐛 vite > v2 separates vitest config * chore: 🤖 reorder package * chore: 🤖 remove side property (deprecated) * fix: 🐛 dropdown amends * fix: 🐛 theme prop * fix: 🐛 type * chore: 🤖 TIAS build version supported on next v16 RSC * chore: 🤖 WIP ongoing styled-component v6.1.11 (non experimental) support * chore: 🤖 strict react version for dev * fix: 🐛 missing ref on forwardRef, might have plenty of these * chore: 🤖 update lockfile * chore: 🤖 remove optional flag from ref (typo) * chore: 🤖 add comment for future ref * refactor: 💡 banner * chore: 🤖 lint amends (double quotes) * refactor: 💡 removes style prop as typed prop * chore: 🤖 remove ajv * chore: 🤖 format * test: 💍 add aria pressed to ButtonGroup * chore: 🤖 format * test: 💍 use local getByText * chore: 🤖 update lockfile * chore: 🤖 add changeset * chore: 🤖 small text amend to trigger vercel deploy * chore: 🤖 prevent running on CI * chore: 🤖 add HUSKY to preven husky runnig pre-commit hook * fix: 🐛 conflict resolution * chore: 🤖 bump rc number * docs: 📝 build esm, how to use * chore: 🤖 ESM vite builder (wip) * fix: 🐛 remove .tsx extension from import statements * fix: 🐛 remove .tsx extension from import statements * fix: 🐛 remove .tsx extension from import statements * fix: 🐛 remove .ts extension from import statements * fix: 🐛 remove .ts extension from import statements * chore: 🤖 add eslint to assess import extensions not required * chore: 🤖 format * chore: 🤖 temporary custom resolve tsconfig path * refactor: 💡 export from correct theme boundary * chore: 🤖 node externals in vite, remove alias * chore: 🤖 use relative paths * chore: 🤖 use externalize deps * chore: 🤖 for ESM compatibility, tweak/handle CJS components * chore: revert ts alias rewrite to relative * chore: lint do not allow barrel imports * chore: remove excludes from tsconfig * chore: set vite settings to preserve file struct in output * fix: solve import cycles * fix: solve import cycles in stories * fix: build amends * fix: add .js extension * chore: analyze and visualise bundle * chore: split ESM, CJS distribution * chore: format * fix: 🐛 lint code block * fix: 🐛 import Separator * chore: format * fix: 🐛 import Separator * chore: 🤖 add changeset * chore: 🤖 use 0.0.251-rc.62 * chore: 🤖 resolve conflict resolution, deleted files which were removed in main branch * chore: 🤖 resolve conflict resolution, middle truncator * chore: 🤖 resolve conflict resolution, missing container changes * refactor: 💡 FileMultiUpload to follow FileUpload due to middle truncator * fix: 🐛 prevent icon success pushed right * fix: 🐛 remove file size from multiple file upload * chore: 🤖 merge conflict amend for ButtonGroup * chore: 🤖 remove comment * refactor: 💡 reduce import path redundancy (WIP, pt1) * refactor: 💡 accordion as index * refactor: 💡 rename component by directory name to index * refactor: 💡 update import statements to prefer index * chore: 🤖 remove old indexes (this was a failed attempt, which imported the reduntant name) * fix: 🐛 import statements * fix: 🐛 import statements * fix: 🐛 import statements * fix: 🐛 icon names in types * chore: 🤖 add note * chore: 🤖 format * fix: 🐛 icon names location * fix: 🐛 icon names location * chore: 🤖 update changeset * refactor: 💡 use component level barrel, to allow devs see component name on editor * fix: 🐛 import statements * chore: 🤖 add eslint to prevent imports from index and request use of leafs when possible * fix: 🐛 dayjs version * fix: 🐛 merge from main,m incorrectly changed * chore: 🤖 prepare merge main * fix: 🐛 merge conflicts * refactor: 💡 further paths pass * chore: 🤖 add note * chore: 🤖 format * refactor: 💡 further paths pass for AutoComplete * fix: 🐛 merge conflict * refactor: 💡 further paths pass for Collapsible * chore: 🤖 init changeset * fix: 🐛 merge conflict * fix: 🐛 file extension * fix: 🐛 file extension * refactor: 💡 init GenericMenu structure * chore: 🤖 add generic menu test * chore: 🤖 add generic menu story * refactor: 💡 make components/Common to avoid loose files * refactor: 💡 move types * refactor: 💡 update path changes for common components * refactor: 💡 add Text index/exports * refactor: 💡 first pass, move types to *.types.ts * refactor: 💡 second pass, move types to *.types.ts * refactor: 💡 third pass, move types to *.types.ts * refactor: 💡 forth pass, move types to *.types.ts * refactor: 💡 fifth pass, move types to *.types.ts * refactor: 💡 export size color * refactor: 💡 move types for Avatar * fix: 🐛 imports * fix: 🐛 types * fix: 🐛 linter * fix: 🐛 test * chore: 🤖 add hmr benchmark * chore: 🤖 make component build name index to remove redundancy * chore: 🤖 generate exports, e.g. expose direct component imports and its types chore: 🤖 generate exports, e.g. expose direct component imports and its types * perf: ⚡ benchmark hmr deep nested components * chore: 🤖 link @clickhouse/click-ui to itself, required for benchmark * perf: ⚡ generate component exports, e.g. speedy component and type access * refactor: 💡 remove unused re-export files * chore: 🤖 update changeset * chore: 🤖 remove comments * chore: 🤖 merge conflict * fix: 🐛 resole theme conflicts * fix: 🐛 resolve theme types * refactor: 💡 theme * fix: 🐛 resolve merge conflicts due to circular deps * refactor: 💡 theme * refactor: 💡 remove hard typed theme * fix: 🐛 types deps * test: 💍 update test (due to merge issues) * chore: 🤖 the asset system has to be updated to reflect architecture decisions, since its automated, here done manual changes * fix: 🐛 error TS2724: './IconButton' has no exported member named 'IconButtonSize'. * chore: 🤖 add TODO * chore: 🤖 resolve merge conflict missing type * chore: 🤖 remove deprecated * fix: 🐛 ContextMenu.types.ts: Added type?: 'default' | 'danger' to the exported ContextMenuItemProps interface and remove duplicate * refactor: 💡 move local type * refactor: 💡 move local type (missed track file) * refactor: 💡 changeset * refactor: 💡 move ContextMenu types * chore: 🤖 remove FlyoutHeaderProps and FlyoutFooterProps are each declared twice in the same file * refactor: 💡 Replaced stale types in Flyout.types.ts with the correct definitions from Flyout.tsx * fix: 🐛 typo, should be orientation * refactor: 💡 changeset
Why?
Provide an elegant file architecture pattern inspired by major component libraries. It has a main component, whose name serves as a namespace for types, styles, tests, stories (storybook) and a public export file. This is a first pass; further passes and iterations will be required, which is done to lower the risk of breaking changes.
🤖 TODO: once #798 merged change base to main branch
It aims to provide the following:
How?
Preview?
Button
Primary card
Toast