ImmoweltGroup / flow-mono-cli

A command line interface that aims to solve a few issues while working with flow typed codebases in a mono-repo.
https://immoweltgroup.gitbooks.io/flow-mono-cli/
MIT License
87 stars 12 forks source link

create-symlinks occasionaly miss-place symlinks into the packages root #233

Open kubijo opened 5 years ago

kubijo commented 5 years ago

Hi.

Did you ever encounter a behavior where the create-symlinks commands occasionaly miss-places symlinks from the root node_modules into the root, instead of packages/*/node_modules/?

To possibly illustrate this more clearly:

- package.json
- node_modules/
    - addon-notes
    - …
-  ↗ addon-notes
- packages/xyz/node_modules/

The ↗ addon-notes is the misplaced link to node_modules/addon_notes/. It should be in packages/xyz/node_modules/, but it's missing there (so it's not a copy, but rather a misfire).

We've bump into this because it fails our lint CI jobs as it get's picked up by eslint, but would eventually cause flow errors as well since the module wouldn't be found in the package…

As of yesterday this started to happen semi-regularly on my dev machine as well (like 2 out of 4 tries).

If you have a hunch for a place that might be the culprit for some race-condition type of error, I'd be ready to help with tracking it down.

kubijo commented 5 years ago

Our current hacky way around this is

find . -maxdepth 1 -type l | xargs --no-run-if-empty -i mv {} packages/xyz/node_modules/
desmondgong commented 5 years ago

I encounter the same issue sometimes. Not just into the root, the symlinks would occasionally be created into the wrong folder for the package include a scope. For example, I have 2 dependencies: '@material-ui/core', '@ckeditor/ckeditor5-react', sometimes, the symlink for 'core' would go to the folder '@ckeditor'. Screen Shot 2019-05-01 at 8 48 09 AM

btw, my ENV is macOS Mojave 10.14.4, node v11.12.0.

IanVS commented 4 years ago

I'm also experiencing this when packaging for our production deploys. For now I haven't noticed it in other situations, and I'm addressing by correctly setting NODE_ENV=production and not running flow-mono (should have been doing this all along), but it worries me that this could happen at any time.