← Workflows

阅读中文版本

File Structure Organize Workflow

Reorganize project file structure to follow a consistent pattern that makes it easy to find and add new files.

beginner~45 minstructureorganizationworkflow

Objective

Reorganize the project directory structure for clarity and consistency.

Environment

  • A project with an inconsistent file structure
  • Team agreement on the target structure
  • A search tool for finding import references

Steps

1. Document current structure

Map the existing file structure and identify inconsistencies.

Expected state: A diagram or list of the current structure is created.

2. Plan target structure

Design the target structure following the team agreed pattern.

Expected state: A target structure plan is documented.

3. Move files

Move files to their new locations, updating import paths as needed.

Expected state: All files are in their new locations with correct imports.

4. Verify build

Run the build and test suite to confirm nothing is broken after the reorganization.

Expected state: The build succeeds and all tests pass.

Decision points

Feature-based or layer-based?

  • Feature-based for large apps
  • Layer-based for small apps

Use feature-based for projects with many features; layer-based is fine for small, simple projects.

Expected outcome

The project follows a consistent file structure that is documented and verified by a passing build.

Verification

Run the build and full test suite; confirm all imports resolve correctly.

Cleanup

Use git to revert the reorganization if the build fails and cannot be quickly fixed.

A good structure scales

A consistent file structure helps new team members find code quickly and makes it obvious where new files should go.

Implementation Notes

This workflow provides a structured approach to ensure consistent results across team members and environments.

Common Pitfalls

Skipping verification steps or rushing through the process can lead to incomplete results. Always follow each step in order and verify before proceeding.

Quick Reference

# Execute the workflow steps as documented above
echo "Workflow completed successfully"