DefinitelyTyped / tsd

[DEPRECATED] TypeScript Definition manager for DefinitelyTyped
Apache License 2.0
1.12k stars 135 forks source link

tsd link --implicit proposal #115

Open Toilal opened 9 years ago

Toilal commented 9 years ago

In my project, many dependencies defined in bower.json and package.json have definition files existing in this repository, but I still have to install all those dependencies manually.

I've finally manage to write a gulp script that retrieves all dependency names from bower and npm json files, and tsd install them based on their name.

It would be great if such features exists in tsd as a new command, or maybe an additionnal option to tsd link command, maybe tsd link --implicit.

FYI, here's the gulp task that handles this.

  var bower = require(path.join(process.cwd(), 'bower.json'));
  var npm = require(path.join(process.cwd(), 'package.json'));

  var dependencies = [].concat(
    Object.keys(bower.dependencies),
    Object.keys(bower.devDependencies),
    Object.keys(npm.dependencies),
    Object.keys(npm.devDependencies)
  );

  gutil.log('> tsd install ' + dependencies.join(' ') + ' -ros');
  exec('tsd install ' + dependencies.join(' ') + ' -ros', function (err, stdout, stderr) {
    gutil.log(stdout);
    gutil.log(stderr);
    if (!err) {
      gutil.log('Required d.ts files have been installed in typings/ directory');
    }
    done(err);
  });
joeskeen commented 9 years ago

This would be a fantastic feature, as you could set up npm and bower to run tsd as a post-install / uninstall to keep your definition files up to date.