{"size": 927, "ext": "js", "max_stars_repo_path": "resources/build/tasks/tsd-tests.js", "max_stars_repo_name": "stefb965/Ionic-TypeScript-Starter", "max_stars_repo_stars_event_min_datetime": "2015-05-25T21:04:21.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-29T00:32:06.000Z", "max_issues_repo_path": "resources/build/tasks/tsd-tests.js", "max_issues_repo_name": "stefb965/Ionic-TypeScript-Starter", "max_issues_repo_issues_event_min_datetime": "2015-06-08T06:40:09.000Z", "max_issues_repo_issues_event_max_datetime": "2017-03-22T17:07:14.000Z", "max_forks_repo_path": "resources/build/tasks/tsd-tests.js", "max_forks_repo_name": "Justin-Credible/the-week-magazine-unofficial", "max_forks_repo_forks_event_min_datetime": "2015-06-16T17:43:34.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-04T07:11:05.000Z"}
{"max_stars_count": 149, "max_issues_count": 63, "max_forks_count": 48, "avg_line_length": 25.0540540541, "max_line_length": 82, "alphanum_fraction": 0.5879180151}

// Native Node Modules
var path = require("path");

// Other Node Modules
var sh = require("shelljs");

/**
 * Uses the tsd command to restore TypeScript definitions to the typings
 * directory and rebuild the tsd.d.ts typings bundle (for the unit tests).
 */
module.exports = function(gulp, plugins) {

    return function(cb) {

        var tsdBin = path.join("node_modules", ".bin", "tsd");

        // First reinstall any missing definitions to the typings-tests directory.
        var result = sh.exec(tsdBin + " reinstall --config tsd.tests.json");

        if (result.code !== 0) {
            cb(new Error(result.output));
            return;
        }

        // Rebuild the tests/tsd.d.ts bundle reference file.
        result = sh.exec(tsdBin + " rebundle --config tsd.tests.json");

        if (result.code !== 0) {
            cb(new Error(result.output));
            return;
        }

        cb();
    };
};
