Open youzi opened 8 years ago
When having:
tl
in adm-app should check out all tags/versions according to adm-app/package.json
and
tl
in sbs-app should check out all tags/versions according to sbs-app/package.json
Find common dependency versions between semver modules. eg.
project A needs vigour-observable@^1.0.0 project B needs vigour-observable@^1.2.0
Get available versions:
git tag
npm view <module> versions
List npm dependencies:
npm view <module> dependencies
folder
/dir
/projectA
/projectB
/projectC
/shared_modules
/depFromAandB
/depFromBandC
shared dependency tree:
{
projectA: {
depA: '^2.0.0',
},
projectB: {
depA: '<=2.0.9'
},
shared_node_modules: {
depA: [ '2.0.6', '2.0.5', '2.0.4', '2.0.3', '2.0.2', '2.0.1', '2.0.0' ]
}
}
Is there a need to account for all possible versions? Or do we just use the latest in the possible range?
{
depA: '2.0.6'
depB: '1.1.1'
}
Could be an idea to create a package.json and let npm i
handle the installation of the shared node_modules.
/dir
/projectA
/projectB
/projectC
/node_modules
/depFromAandB
/depFromBandC
/package.json // has all shared dependencies in dependencies folder (devDependecies in devDependencies
npm i
would the install all shared dependencies. Advantage being that npm will handle all shared node_modules
Other potential issue:
Another way of handling shared dependencies is to have them live in the local node_modules:
/dir
/projectA
/node_modules
/depA
/projectB
/node_modules
/depA linked from projectA
/projectC
/projectB
/node_modules
/depA linked from projectA
Or let's install everything in shared_modules and link local projects to shared_modules as well. Then link accordingly to all projects.
/dir
/projectA
/node_modules // everything in here is a link to /shared_modules/something
/projectB
/node_modules
/projectC
/node_modules
/shared_modules/
/depA@1.2.0
/node_modules // everything in here is a link to /shared_modules/something
/depA@2.1.3
/projectA@1.0.0
/projectB@1.3.0
...
For this to work well we need to be able to install modules without their dependencies. Option? http://stackoverflow.com/questions/28382773/install-npm-package-without-dependencies
So:
1. npm view every dependency to find all dependencies with semver range
2. find the most common versions => list all dependencies (with version)
3. download every dependency@version into shared_modules:
a. download from npm
b. link from projects
4. link modules to correct node_modules in all modules
In order to link all modules most efficiently, we are downloading npm modules vs installing them: --> we can't do this for private modules ==> as a work around I'm cloning the git repo instead (this is no standard fallback for failed npm download)
Biggest need atm is versioning. We should link in a way that mimics a "npm clean install".
Another issue is updating the .turbolink file constantly. I propose passing a github key and turbolink will clone any dependency it can find on your user/organisation.
.turbolink file:
Challenges:
/cc @nfrade @marcusbesjes @jimdebeer