diff --git a/packages/dts-critic/index.js b/packages/dts-critic/index.js index 85bd1014d1..3780940efd 100644 --- a/packages/dts-critic/index.js +++ b/packages/dts-critic/index.js @@ -4,12 +4,17 @@ const fs = require("fs"); const path = require("path"); const download = require("download-file-sync"); const semver = require("semver"); +const commandExistsSync = require("command-exists").sync; /** * @param {string} dtsPath * @param {string} [sourcePath] */ function dtsCritic(dtsPath, sourcePath) { + if (!commandExistsSync('curl')) { + throw new Error("You need to have curl installed to run dts-critic, you can get it from https://curl.haxx.se/download.html") + } + const dts = fs.readFileSync(dtsPath, "utf-8"); let header; try { diff --git a/packages/dts-critic/package-lock.json b/packages/dts-critic/package-lock.json index 8a534553d0..2efdb6de74 100644 --- a/packages/dts-critic/package-lock.json +++ b/packages/dts-critic/package-lock.json @@ -1,6 +1,6 @@ { "name": "dts-critic", - "version": "1.2.0", + "version": "2.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1028,6 +1028,11 @@ "delayed-stream": "~1.0.0" } }, + "command-exists": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.8.tgz", + "integrity": "sha512-PM54PkseWbiiD/mMsbvW351/u+dafwTJ0ye2qB60G1aGQP9j3xK2gmMDc+R34L3nDtx4qMCitXT75mkbkGJDLw==" + }, "commander": { "version": "2.20.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", diff --git a/packages/dts-critic/package.json b/packages/dts-critic/package.json index 233bda98b8..db58eab7eb 100644 --- a/packages/dts-critic/package.json +++ b/packages/dts-critic/package.json @@ -4,6 +4,7 @@ "author": "Nathan Shively-Sanders", "description": "Checks a new .d.ts against the Javascript source and tells you what problems it has", "dependencies": { + "command-exists": "^1.2.8", "definitelytyped-header-parser": "^1.2.0", "download-file-sync": "^1.0.4", "semver": "^6.2.0",