Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install typings programmatically

I want to install typings from my build.js file.

For example, to install my bower deps I use:

var bower = require("bower");
bower.commands.install();

Is it possible to install typings that way?

like image 572
Veikedo Avatar asked Jan 18 '26 03:01

Veikedo


1 Answers

I don't believe so, but as an alternative, you could probably get away with using child_process to run it.

If you have Typings installed globally, something along these lines should work:

var spawn = require("child_process").spawn;
var typings = spawn("typings", ["install"], { shell: true });

Or if you have it installed locally:

var spawn = require("child_process").spawn;
var typings = spawn("./node_modules/.bin/typings", ["install"], { shell: true });

I'd recommend reading the child_process docs to learn how to pipe the output from stdout/stderr to your build script - otherwise it'll run silently, I think.

like image 105
Joe Clay Avatar answered Jan 20 '26 20:01

Joe Clay