ouchadam
Hello, I've had a quick play around with #28 and have noticed it no longer links the modules into `node_modules`. All dependencies come through of the submodules but not the modules themselves. Using `2.0.2` works as expected.
#29 ยท closed ยท 16 comments
Hello, I've had a quick play around with #28 and have noticed it no longer links the modules into `node_modules`. All dependencies come through of the submodules but not the modules themselves. Using `2.0.2` works as expected.
@ouchadam i'm not sure i fully understand. the linking works very different in 3.0.0, but the effect (that the local modules are interlinked and can be required directly) should be the same. See [the changelog](https://github.com/heikomat/minstall/blob/6c786302204156bf59631cf94960c4733360399a/CHANGELOG.md#breaking-changes) for infos on how the linking changed. If you can provide an example that doesn't behave as expected, i'd very much appreciate that and would have a look at it
๐ I'll produce an example repo and update the issue
https://github.com/ouchadam/minstall-example only [changing the version](https://github.com/ouchadam/minstall-example/blob/master/package.json#L9) ``` "minstall": "^2.0.2" ``` to ``` "minstall": "git+ssh://[email protected]/heikomat/minstall.git#feature/dependency_tree" ``` causes `module-1` to no longer be found (isn't linked in node_modules). Apologies if the setup is incorrect!
give me a moment, i'll have a loook
@ouchadam i see the problem. You are indeed correct, the local modules are no longer linked to the root-node_modules. this however, is intended behaviour. if you have a second local module, (let's say `module-2`), and you want it to be able to use your first local module (`module-1`), then `module-1` has to be in the dependency-list of `module-2`. If you do this, then minstall 3.0.0 will create a symlink at `module-2/node_modules/module-1` that points to `module-1`, and will therefore allow you to require it directly. So your problem is probably that you don't list your local modules in your package.json files. This was not a requirement with minstall 2.0.2, but is a requirement for 3.0.0.
Thanks for clearing that up ๐ I've been unsuccessful with applying local modules and v3 of `"postinstall": minstall` as it seems to overwrite the local module in `node_modules` ```json "scripts": { "postinstall": "minstall modules" }, "dependencies": { "module-1": "file:modules/module-1", "minstall": "git+ssh://[email protected]/heikomat/minstall.git#feature/dependency_tree" } } ``` Removing the `postinstall` step retains the local module.
@ouchadam There is another important breaking change [mentioned in the changelog](https://github.com/heikomat/minstall/blob/feature/dependency_tree/CHANGELOG.md#breaking-changes): previously, if you wanted to use local sub-sub-modules, you'd have to add minstall as postinstall to every layer of your local modules. This is no longer necessary/allowed. now you have to add minstall as depenency and postinstall to your parent-project **only**, and not to your modules and sub-modules!
@ouchadam does that info help with your setup? if not, could you update the example-repo so i can reproduce it?
unfortunately not ๐ I've updated the example repo to contain 2 sub modules, one relying on the other and including one of the sub modules in the parent. https://github.com/ouchadam/minstall-example
i'll have a look, give me a moment
@ouchadam i can reproduce your issue. I have missed the cases, where the parent module itself has local modules as dependencies. This is indeed something that needs fixing, i'm on it. I'll let you know when it's fixed! Thanks for the find!
thanks for your help! looking forward to the 3.0.0 release ๐ฏ
@ouchadam Ok, i got it running, albeit with a little caveat: - minstall 3.0.0 needs you to mention the dependencies you want to have linked. There is no way around that - minstall doesn't support cases where the version is a `file:`-reference - you can't necessarily mention you local modules in the dependencies of the parent-module using their version, because npm would then try to install them when running `npm install` - Therefore you need to add the local modules you want to use within your parent module, in the parent-modules `peerDependencies`: These do not get installed on `npm install`, but minstall will handle them like any other dependency! So here is what you need to do: - in the parents `package.json`, move the `module-2`-dependency to the peerDependencies, and use version `1.0.0` instead of `file:modules/module-2` - in the `package.json` of `module-2`, add `"module-1": "1.0.0"` to the dependencies - run the `run.sh` by the way, the current version from the feature-branch is also published to npm as version 3.0.3
@ouchadam does this resolve your issue?
can confirm it's working great ๐ฏ feel free to close the issue
Thanks for confirming :)