From 6fdbe7b85c800409970b0fc662d19c1980e231cc Mon Sep 17 00:00:00 2001 From: ecksteij Date: Mon, 6 Dec 2021 15:13:41 -0500 Subject: [PATCH] Fix error documentation for util files --- lib/utils/get-dependencies.js | 1 + lib/utils/get-latest-tag.js | 2 +- lib/utils/get-latest-versions.js | 2 +- lib/utils/install-dev-packages.js | 1 + lib/utils/install-packages.js | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/utils/get-dependencies.js b/lib/utils/get-dependencies.js index 47af2c4..9ac3443 100644 --- a/lib/utils/get-dependencies.js +++ b/lib/utils/get-dependencies.js @@ -8,6 +8,7 @@ const path = require('path'); * @param {Object} obj - Object with parameters. * @param {string} [obj.dir=''] - Path to directory. * @returns {PackageJson} - Contects of package.json from the provided directory. + * @throws {Error} - When unable to find package.json. */ function getDependencies({ dir = '' }) { return require(path.join(dir, 'package.json')); diff --git a/lib/utils/get-latest-tag.js b/lib/utils/get-latest-tag.js index b4eaf77..8353002 100644 --- a/lib/utils/get-latest-tag.js +++ b/lib/utils/get-latest-tag.js @@ -10,7 +10,7 @@ const execAsync = promisify(exec); * * @param {string} name - Package name. * @returns {Promise} - Return latest version, if latest tag exists. - * @throws {Error} - Output failed JSON parse. + * @throws {Error} - When package name is invalid. */ function getLatestTag(name) { return execAsync(`npm view ${name} dist-tags --json`); diff --git a/lib/utils/get-latest-versions.js b/lib/utils/get-latest-versions.js index e43d79a..e14000c 100644 --- a/lib/utils/get-latest-versions.js +++ b/lib/utils/get-latest-versions.js @@ -10,7 +10,7 @@ const execAsync = promisify(exec); * * @param {string} name - Package name. * @returns {Promise} - List of available versions. - * @throws {Error} - Output failed JSON parse. + * @throws {Error} - When package name is invalid. */ function getLatestVersions(name) { return execAsync(`npm view ${name} versions --json`); diff --git a/lib/utils/install-dev-packages.js b/lib/utils/install-dev-packages.js index 19b298d..18a7438 100644 --- a/lib/utils/install-dev-packages.js +++ b/lib/utils/install-dev-packages.js @@ -10,6 +10,7 @@ const execAsync = promisify(exec); * * @param {string} pkgs - list of packages. * @returns {Promise} - Standard output. + * @throws {Error} - When unable to install development package. */ function installDevPackages(pkgs) { return execAsync(`npm i -D ${pkgs}`); diff --git a/lib/utils/install-packages.js b/lib/utils/install-packages.js index b82510c..a44e9bc 100644 --- a/lib/utils/install-packages.js +++ b/lib/utils/install-packages.js @@ -10,6 +10,7 @@ const execAsync = promisify(exec); * * @param {string} pkgs - list of packages. * @returns {Promise} - Standard output. + * @throws {Error} - When unable to install the package. */ function installPackages(pkgs) { return execAsync(`npm i ${pkgs}`);