Page MenuHomePhabricator

[MEX] Refactor: Restructure wikibase.wbui2025 to proper Vue 3 architecture
Closed, ResolvedPublic

Description

Problem:

The current wikibase.wbui2025 directory structure does not follow Vue.js 3 best practices and has several issues:

  1. Flat directory structure: All components, utilities, and assets are mixed in a single directory.
  2. Verbose file naming: Files use the pattern wikibase.wbui2025.[COMPONENT_NAME].[vue/less/js] which is redundant and hard to read.
  3. Poor organization: Related files (components, styles, utilities) are not grouped logically.
  4. Inconsistent with modern Vue.js practices: Missing proper folder structure for components, styles, etc.

Current structure

image.png (538×798 px, 196 KB)

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 nameNew name
wikibase.wbui2025.addStatementButton.vuecomponents/addStatementButton.vue
wikibase.wbui2025.editStatement.vuecomponents/editStatement.vue
wikibase.wbui2025.editStatementGroup.vuecomponents/editStatementGroup.vue
wikibase.wbui2025.qualifiers.lesscomponents/qualifiers.less
tests/jest/wikibase.wbui2025.addQualifier.spec.jstests/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)

Event Timeline

Story writing notes: @mahmoud.abdelsattar.wmde will create a meeting and share resources to discuss approaches to the new architecture to come to a team agreement

💬 Discussion Summary: Vue.js directory structure refactor proposal

In the MatterMost channel "Wikidata - Omega", we’ve discussed the proposed restructuring of the extensions/Wikibase/repo/resources/wikibase.wbui2025 directory in the thread.
The goal is to improve scalability, maintainability, and readability of the Vue.js codebase as the project (MEX) grows.


Summary of discussed points

✅ The proposal

  • Introduce a standardized, nested folder structure following Vue 3 ecosystem and community best practices.
  • Remove redundant prefixes like wikibase.wbui2025. from file names.
  • Organize files by feature/domain boundaries (e.g., statements, properties, qualifiers) to reduce cognitive load and improve onboarding.
  • Align with Vue.js conventions to make the codebase easier to navigate for both current and new developers.
  • Benefits highlighted:
    • Industry standardization: Familiar to most Vue developers.
    • Scalability: Easier to extend and maintain as components increase.
    • Maintainability: Logical grouping improves discoverability and reduces refactor cost later.
    • Team collaboration: Consistent structure helps onboarding and code ownership.
    • Future-proofing: Aligns with modern Vue architecture recommendations.

💡 Team's feedback

  • Arthur: Prefers to avoid over-engineering at this stage, as the current component count is low (~12–13). Supports renaming files and cleaning up naming, but finds creating many subdirectories premature until the structure proves necessary. Shared resources (e.g., Vue School: Large Scale Vue.js Structure).
  • Lucas: Agrees on simplifying naming but supports keeping a flatter structure until the project scales further.
  • Halima: Finds the flat structure confusing and supports restructuring to reduce technical debt and improve navigation.

Resources

Next Steps
  • Decide as a team in the ticket or follow up via a short meeting the best directory structure.
  • Decide if we should do the refactoring in one big patch, or as we go.

Change #1204600 had a related patch set uploaded (by Mahmoud-abdelsattar; author: Mahmoud-abdelsattar):

[mediawiki/extensions/Wikibase@master] Removing the wikibase.wbui2025 prefix

https://gerrit.wikimedia.org/r/1204600

Change #1204884 had a related patch set uploaded (by Mahmoud-abdelsattar; author: Mahmoud-abdelsattar):

[mediawiki/extensions/Wikibase@master] Restructuring the components

https://gerrit.wikimedia.org/r/1204884

🔄 Development Handover Summary

NOTE: 🟢 Move from "In Development" > "Ready for Peer Review"

📋 Overview

Restructure wikibase.wbui2025 to proper Vue 3 architecture.
Refactor the directory structure with proper organization and clean file naming.

✅ Work Completed

  • 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.

🔗 Related Resources

  • Related Gerrit Patch(s):

https://gerrit.wikimedia.org/r/c/1204600
https://gerrit.wikimedia.org/r/c/1204884


Handover Date: 13th November 2025
Last Updated By: Mahmoud

Change #1204600 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Removing the wikibase.wbui2025 prefix

https://gerrit.wikimedia.org/r/1204600

Change #1204884 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Restructuring the components

https://gerrit.wikimedia.org/r/1204884