Problem:
The current wikibase.wbui2025 directory structure does not follow Vue.js 3 best practices and has several issues:
- Flat directory structure: All components, utilities, and assets are mixed in a single directory.
- Verbose file naming: Files use the pattern wikibase.wbui2025.[COMPONENT_NAME].[vue/less/js] which is redundant and hard to read.
- Poor organization: Related files (components, styles, utilities) are not grouped logically.
- Inconsistent with modern Vue.js practices: Missing proper folder structure for components, styles, etc.
Current structure
Proposed structure:
Refactor the directory structure to follow Vue.js 3 best practices with proper organization and clean file naming:
File naming changes examples:
| Current name | New name |
|---|---|
| wikibase.wbui2025.addStatementButton.vue | components/addStatementButton.vue |
| wikibase.wbui2025.editStatement.vue | components/editStatement.vue |
| wikibase.wbui2025.editStatementGroup.vue | components/editStatementGroup.vue |
| wikibase.wbui2025.qualifiers.less | components/qualifiers.less |
| tests/jest/wikibase.wbui2025.addQualifier.spec.js | tests/jest/components/addQualifier.spec.js |
Acceptance criteria:
- File names no longer contain the wikibase.wbui2025. prefix but the names inside the components should not be changed.
- The components directory will be created and to have all the .vue and .less files in that folder as a flat hierarchy.
- All import paths are updated and working.
- The refactoring should be done in two phases (two patches), one for file renames, and one for the new directories restructuring.
- ResourceLoader module registration is updated.
- The Jest tests in tests/jest should also be reflected to the new structure and should not include the prefix in the filenames.
- All existing tests pass.
- No functionality is broken and no new functionality should be added within this refactoring.
- Documentation file should be created that reflects the current structure.
Notes:
- This refactoring should be done carefully to avoid breaking the existing functionality.
- The directories api and store will remain unchanged.
- Consider adding other directories of different types in case we need them (ike helpers/constants ... etc.).
- If we have one file (like utils.js, it is better to not make it inside a directory utils, we add the directory if there are more files).
- Entry files like lib.js and entityViewInit.js will stay in the root directory wikibase.wbui.2025 as they are now.
- Related refactoring: Let wbui2025 server-side rendering serve <style>s of .vue files to no-JS clients (T409827)
