Part 3: Restructure Project - The Great Reorganization
· One min read
Restructuring a codebase is the software equivalent of moving chaos. You know where things should go. Getting them there without breaking everything is the challenge.
Creating the New Rooms
mkdir -p src/components src/pages src/css docs static/img blog
Moving Day: Components
Move React components to src/components/.
The Import Path Problem
After moving files, update imports:
// Before
import MyComponent from './components/MyComponent';
// After (in Docusaurus pages)
import MyComponent from '@site/src/components/MyComponent';
The Checklist
- ✅ Created required directories
- ✅ Moved all React components
- ✅ Moved data files to
src/ - ✅ Moved static assets to
static/ - ✅ Updated import paths
- ✅ Verified no orphaned imports
Testing the Move
npm run clear
npm start
