Skip to content

Refactor store architecture and remove build step from shared package#847

Closed
usagizmo wants to merge 2 commits into
mainfrom
refactor/simplify-store-comments-and-exports
Closed

Refactor store architecture and remove build step from shared package#847
usagizmo wants to merge 2 commits into
mainfrom
refactor/simplify-store-comments-and-exports

Conversation

@usagizmo

@usagizmo usagizmo commented Nov 5, 2025

Copy link
Copy Markdown
Owner

Summary

  • Rename composables/ directory to stores/local/ for clearer distinction between global and component-scoped state management
  • Remove @sveltejs/package build step from @repo/shared package, now exports source files directly
  • Simplify package.json exports configuration to use direct source file paths
  • Add comprehensive documentation for Global/Local store patterns in README with updated directory structure

Changes

Store Architecture

  • Before: src/lib/composables/useCounter.svelte.ts
  • After: src/lib/stores/local/LocalCounter.svelte.ts
  • Clearer separation: global stores (singleton) vs local stores (component-scoped)

Shared Package

  • Removed build scripts (dev, build) that used @sveltejs/package
  • Removed @sveltejs/package dependency
  • Simplified exports to point directly to source files instead of compiled dist/
  • No build step required, type information available directly from source

Documentation

  • Added stores/local/ to directory structure diagram
  • Added State Management section with clear table explaining Global vs Local stores
  • Simplified comments in store files (concise, English-only)

Benefits

  • Faster development: No build step needed for shared package
  • Better DX: Direct source code references, easier debugging
  • Clearer architecture: Explicit naming convention for component-scoped stores
  • Type safety: TypeScript type information directly from source files

Test Plan

  • All tests pass
  • Linter passes
  • Type checking passes

- Rename `composables/` to `stores/local/` for clearer component-scoped state management
- Remove @sveltejs/package build step, export source files directly from @repo/shared
- Simplify package.json exports to use direct source file paths
- Add documentation for Global/Local store patterns with directory structure
@vercel

vercel Bot commented Nov 5, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
webapp-template-pages Ready Ready Preview Comment Nov 5, 2025 5:56pm
webapp-template-web Ready Ready Preview Comment Nov 5, 2025 5:56pm

@usagizmo

usagizmo commented Nov 5, 2025

Copy link
Copy Markdown
Owner Author

Reverted changes to @repo/shared/

@usagizmo usagizmo closed this Nov 5, 2025
@usagizmo usagizmo deleted the refactor/simplify-store-comments-and-exports branch November 5, 2025 19:13
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.

1 participant