Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: organize code in modules, absolute imports, better exports #47

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Lukapetro
Copy link

@Lukapetro Lukapetro commented Jan 8, 2025

Refactor: Reorganize Project Structure with Modular Design

Reorganizes codebase with a modular, feature-based architecture:

src/
  core/                   # Core functionality
    auth/
    api/
    types/
    utils/
  features/              # Feature modules
    tweets/
    profiles/
    search/
    relationships/
    messages/
    spaces/
      core/
      plugins/
    trends/
  timeline/              # Timeline related functionality
    components/
    types/
  platform/              # Platform specific code
  cli/                   # Command line interface
  scraper/               # Main scraper functionality
  index.ts              # Main library entry point

Changes:

  • Moves files into feature-based modules
  • Each feature has its own types, tests, and utils
  • Core functionality separated from features
  • Path aliases enable clean imports (@/core/auth vs ../../core/auth)

Example changes:

  • Before: import { TwitterAuth } from '../../core/auth/auth'
  • After: import { TwitterAuth } from '@/core/auth'

⚠️ NOTE: This refactor has high impact! Thorough testing needed to catch any broken imports or functionality.

Testing Strategy:

  1. Do manual testing of core features
  2. Test import functionality in various modules
  3. Verify build process works
  4. Test published package imports

@Lukapetro
Copy link
Author

@wtfsayo after this is merged i can take a look at:

@Lukapetro
Copy link
Author

⚠️ NOTE: This refactor has high impact! Thorough testing needed to catch any broken imports or functionality. DO NOT MERGE BLINDLY, it may break features around

@HashWarlock
Copy link

I see some imports use @ then others use ../../src is there a reason for this that I'm missing or can they all move to use @ with this change now?

@Lukapetro
Copy link
Author

we can use absolute import everywhere @HashWarlock, where you see the imports with ../../ is because there is the old import left that I missed

@wtfsayo
Copy link
Collaborator

wtfsayo commented Jan 9, 2025

why inconsistent with @/... path and ../

@Lukapetro
Copy link
Author

why inconsistent with @/... path and ../

aight let me fix those, also another thing I've seen is having a convention for naming files. Example:

  • ChatClient.ts -> PascalCase
  • testParticipant.ts -> camelCase
  • platform-interface.ts -> kebab-case

For convenience I would say define a standard and adapt the code. Maybe just a separate doc for the whole elizaOS organization, which applies to all repos @wtfsayo @lalalune

@wtfsayo
Copy link
Collaborator

wtfsayo commented Jan 10, 2025

hey so I think the code organisation is good but its hard to truly test unless this is followed up #44;

if you take on #44 you can base it off this branch and can merge together

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants