-
Notifications
You must be signed in to change notification settings - Fork 1
Module installation process
Heiko Mathes edited this page Feb 5, 2017
·
2 revisions
These are the steps minstall takes, to install the local modules:
- Look for a
modules
-folder, and for modules in it - Gather the module details from the package.json of every module.
- Remove all module-symlinks from the root-
node_modules
- check, what dependencies are missing, and what dependencies are conflicting with packages already installed in the root-node_modules
- check, if some (or all) of the conflicting dependencies are already installed in a possibly existing module-node_modules-folder
- if conflicting dependencies exist:
- create a new folder in the root-node_modules with the name
module.folderName + '_cache'
- move all the already installed packages that are in the root-node_modules and would conflict with the module-dependencies into that cache-folder
- create a new folder in the root-node_modules with the name
- if in step 5 fitting packages were found, move them to the root-node_modules (this is only to speed up things, so less packages need to be installed)
- if one exists, delete the module-node_modules folder
- now that there is no longer a conflicting package in the root-node_modules, install all the missing dependencies to the root-node_modules
- if the module has a postinstall-script:
- create a symlink in the module-folder, that points to the root-node_modules
- now that a node_modules-folder with all the fitting dependencies is in the module-folder, run the postinstall-script
- delete the previously created symlink
- if in step 4, conflicting dependencies were found:
- create a node_modules-folder in the module-folder
- move all the packages from the root-node_modules-folder that would have caused conflicts to the newly created module-node_modules-folder
- move all the cached packages from step 6.2 (those in
module.folderName + '_cache'
in the root-node_modules) out of that folder, to their original place in the root-node_modules - delete the
module.folderName + '_cache'
-folder created in step 6.1 from the root-node_modules
- update the list of installed packages
- start over at step 4 with the next module until all modules are installed
- if the
--no-link
flag is not set, symlink all the modules to the root-node_modules