From 67155452dfc99db840c7c3fc95dac4de200c99e1 Mon Sep 17 00:00:00 2001 From: nurra01 Date: Wed, 24 Oct 2018 18:18:56 +0200 Subject: [PATCH] add more comments to installPackages function --- .../src/plugins/utilities/NpmApiFunctions.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/imperative/src/plugins/utilities/NpmApiFunctions.ts b/packages/imperative/src/plugins/utilities/NpmApiFunctions.ts index c6c5c15f8..b3a869f5c 100644 --- a/packages/imperative/src/plugins/utilities/NpmApiFunctions.ts +++ b/packages/imperative/src/plugins/utilities/NpmApiFunctions.ts @@ -16,8 +16,15 @@ const npm = require("npm"); const iConsole = Logger.getImperativeLogger(); /** - * Common function that installs a npm package. - * + * Common function that installs a npm package using npm APIs. + * npm.load doesn't install with passed configuration values such as global and prefix + * that's why need to use npm.config functions to install packages globally and to a specific prefix + * The link for all configuration values and descriptions: + * https://docs.npmjs.com/misc/config + * The link for use case: + * https://stackoverflow.com/questions/15957529/can-i-install-a-npm-package-from-javascript-running-in-node-js/15957574#15957574 + * The link how to use NPM programmatically from npm-cli.js documentation: + * https://github.com/npm/cli/blob/latest/bin/npm-cli.js#L75 * @param {string} prefix Path where to install npm the npm package. * * @param {string} global Option to install a package globally or not.