I'm in the process of creating 2 projects. Project 1 will be like a library. Project 2 will be an application which uses Project 1's library code.
So I wish to do a npm link from Project 1 to Project 2. I can do this at the command line using the follow:
- cd ../project1 npm link
- cd ../project2 npm link project1_name
and it works fine. But I don't wish to do that, I want when I install the package.json to not only set up the various dependencies to also set up the link.
So how would I do that in a npm script? I thought possibly - "preinstall": "cd ../project1 npm link && cd ../project2 npm link project1_name",
but that fails and I think it may have to do with what's the correct way to split up the various commands.