The Doh.Install function in Doh provides a powerful mechanism for defining installation instructions for modules, allowing server-side execution of setup tasks during various package management operations.
Doh.Install takes the following form:
Doh.Install(module_name, install_instructions);
module_name
: String identifying the moduleinstall_instructions
: Object or Array specifying npm packages to installInstall instructions can be provided in multiple formats:
Doh.Install('my-module', {
'npm:package-name': '^1.2.3',
'npm:another-package': '~2.0.0'
});
Doh.Install('my-module', [
'npm:package-name',
'npm:another-package'
]);
Doh.Install can be included in browser-facing files, but its execution is server-side:
// This file can be loaded in the browser
Doh.Module('my-module', ['dependency1'], function() {
// Browser-side module code
});
Doh.Install('my-module', {
// installed on the server
'npm:server-package': '^1.0.0'
});