ijavascript icon indicating copy to clipboard operation
ijavascript copied to clipboard

use $$ to install npm packages

Open n-riesco opened this issue 8 years ago • 3 comments

I need to document how to install an npm package so that it can be requested during an IJavascript session.

Alternatively, $$ could provide a function; e.g: $$.npm(), $$.yarn() or just $$.exec() to run a shell command in the session working directory.

n-riesco avatar Dec 26 '17 09:12 n-riesco

Is there any progress on this? Did you find out how to nstall an npm package during a IJavascript session?

guy1ziv2 avatar Jun 16 '18 14:06 guy1ziv2

This here works for me as a workaround - it pollutes the global file system.

$$.async(); require('child_process').exec('npm install node-fetch', (f, o, e) => $$.done({ f, o, e }))

freiit avatar Jun 19 '18 18:06 freiit

@freiit This should work: child_process.execSync("npm install node-fetch").

You may also find useful the discussion in #118 .


it pollutes the global file system

What do you mean by that?


Is there any progress on this?

I'm not working on this issue. Last time I checked npm and yarn didn't expose an API to JS. And I'm not convinced defining something like the below would be really useful:

$$.npm = function(args) {
    return child_process.execSync("npm " + args);
};

n-riesco avatar Jun 19 '18 20:06 n-riesco