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

Flatten React-DnD Directory Structure #3038

Merged
merged 12 commits into from Feb 19, 2021

Conversation

darthtrevino
Copy link
Member

@darthtrevino darthtrevino commented Feb 18, 2021

The scope of this PR has changed quite a bit. Separate packages helped to clarify top-level concerns, but practically this is problematic. It would bifurcate whether library-authors would use @react-dnd/core or react-dnd, and resolving context types would become a nightmare. Instead this just reorganizes the existing react-dnd package around these high-level concerns and flattens the directory structure a bit.

The primary driver of this refactor is separating the hooks-based API from the decorators-based API. The decorators pattern is a little flakier, but has been around much longer. It requires some dependencies that the hooks API does not. They are basically independent surface areas achieving the same thing. We will still publish react-dnd with both the hooks and decorator API, but these APIs will have the ability to be consumed independently of each other.

New Packages:
### Public Facing
@react-dnd/hooks - The Hooks API
@react-dnd/decorators - The Decorators API
@react-dnd/core - Context Types, Provider API (required peer of hooks/decorators)
### Internal
@react-dnd/internal - Common internal components (not intended for client usage)
@react-dnd/types (to eliminate dep cycle between core/internals. Re-experted by core)

@codecov
Copy link

codecov bot commented Feb 18, 2021

Codecov Report

Merging #3038 (d42f9c1) into main (120a6bf) will increase coverage by 4.38%.
The diff coverage is 31.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3038      +/-   ##
==========================================
+ Coverage   40.81%   45.19%   +4.38%     
==========================================
  Files         253      248       -5     
  Lines        3788     3790       +2     
  Branches      768      770       +2     
==========================================
+ Hits         1546     1713     +167     
+ Misses       2241     2076     -165     
  Partials        1        1              
Impacted Files Coverage Δ
...ckages/dnd-core/src/classes/DragDropMonitorImpl.ts 96.22% <ø> (ø)
...ckages/dnd-core/src/classes/HandlerRegistryImpl.ts 84.53% <ø> (ø)
packages/react-dnd/src/core/DragPreviewImage.tsx 7.14% <ø> (ø)
packages/react-dnd/src/decorators/DragLayer.tsx 20.96% <ø> (ø)
packages/react-dnd/src/decorators/DragSource.ts 87.50% <ø> (ø)
packages/react-dnd/src/decorators/DropTarget.ts 100.00% <ø> (ø)
...es/react-dnd/src/decorators/createSourceFactory.ts 20.93% <ø> (ø)
...es/react-dnd/src/decorators/createTargetFactory.ts 45.45% <ø> (ø)
...kages/react-dnd/src/decorators/decorateHandler.tsx 86.90% <ø> (ø)
packages/react-dnd/src/decorators/disposables.ts 52.94% <ø> (ø)
... and 26 more

@darthtrevino darthtrevino changed the title Refactor React-DnD's internal Package Structure Flatten React-DnD Directory Structure Feb 18, 2021
@darthtrevino darthtrevino merged commit 0f6e8c5 into main Feb 19, 2021
@darthtrevino darthtrevino deleted the refactor/hooks_decorators_packages branch February 19, 2021 00:37
darthtrevino added a commit that referenced this pull request Feb 3, 2022
* refactor: break out react-dnd's internal package structure

* chore: cut major semver due to re-layout

* fix: remove extraneous deps

* fix: jest tests

* chore: cut semver

* fix: tsconfig updates

* refactor: roll pkgs back into react-dnd using a flattened folder structure

* refactor: update DragDropManager construction; fix tests/linting

* chore: update semver document

* ci: remove redundant build script

* build: nvm

* fix: top-level build steps
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.

None yet

1 participant