React-sortable-tree: Fix distribution

Created on 10 Dec 2018  ·  13Comments  ·  Source: frontend-collective/react-sortable-tree

Reporting a Bug?

The recent changes to our dependencies #426 by @dolezel throws an error when installing.

error /Users/wuxx1045/Desktop/react-sortable-tree/example/node_modules/react-sortable-tree: Command failed.
Exit code: 127
Command: patch-package
Arguments:
Directory: /Users/wuxx1045/Desktop/react-sortable-tree/example/node_modules/react-sortable-tree
Output:
/bin/sh: patch-package: command not found

perhaps we should bundle our patched version of react-dnd-scrollzone

this was found after i released 2.4.0. For now i have set the latest tag back to 2.3.0, our previous release until this is resolved. I have also deprecated 2.4.0

bug investigate todo

All 13 comments

Sorry, my bad. That patch-package in postinstall should be needed only for dev.
https://docs.npmjs.com/misc/scripts seems prepare is right place to put the script in. Will make PR.

No problem. I'm trying to test some stuff out locally with the newly built one (with the updated dependencies), but the tree isn't rendering in the demo (uses the dist/index.esm.js) but the storybook works (uses src/index.js).

I might've screwed up the rollup build. Do you mind explaining what exports: named does? as we both export a default and a named export @

That is something you added to that file ;-)
https://github.com/frontend-collective/react-sortable-tree/commit/2c018328e218627483f5e4f59ebd56cd321325d6#diff-ff6e5f22a9c7e66987b19c0199636480R14
I updated rollup config only with name of file in external library https://github.com/frontend-collective/react-sortable-tree/commit/9343a55db0aaa1a60c2b07f2d7ee6467866dc404#diff-ff6e5f22a9c7e66987b19c0199636480R26
Maybe it is reason why it fails now? I see you changed it to

external: [
    ...Object.keys(pkg.dependencies),
    ...Object.keys(pkg.peerDependencies),
  ],

so react-dnd/lib/DragDropContext is now missing

Thanks for the help @dolezel :)

released in 2.5.0.

also curious, if react-dnd-scrollzone is external in rollup, but we depend on a patched version, shouldn't we remove it from external and package it with the distribution? @dolezel

True, it also need to be removed from external, 2.5.0 is not working now after fresh install 🤦‍♂️

It is so tangled and so hard to test in real life. :/

uh oh :(. I've been testing using the example directory.

@dolezel what happens after a fresh install right now?

I think we should roll back to using regular react-dnd-scrollzone or a github forked version under this organization.

getting this error in scrollzone

 161 |   // have to attach the listeners to the body
  162 |   window.document.body.addEventListener('touchmove', this.handleEvent);
  163 | 
> 164 |   this.clearMonitorSubscription = this.context.dragDropManager.getMonitor().subscribeToStateChange(function () {
  165 |     return _this2.handleMonitorChange();
  166 |   });
Uncaught TypeError: Cannot read property 'getMonitor' of undefined
    at ScrollingComponent.componentDidMount

It is using unpatched version of react-dnd-scrollzone

432 is fixing this. When I used build artefacts after that fix. It was working.

I thought that using that patching library would be easiest solution, but it came with more quirks than it solved. I agree that maintaining own fork of react-dnd-scrollzone under frontend-collective will be best 👍

@dolezel do you mind PRing your patch to https://github.com/frontend-collective/react-dnd-scrollzone

and then i will fix the version and everything should be fixed!

fixed in 2.6.0!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xmhscratch picture xmhscratch  ·  5Comments

CrazyCodingBanana picture CrazyCodingBanana  ·  4Comments

bigjujube picture bigjujube  ·  4Comments

brendanmoore picture brendanmoore  ·  5Comments

Suremotoo picture Suremotoo  ·  4Comments