check-deps.js 487 B

1234567891011121314151617181920
  1. "use strict";
  2. const pkg = require("../package.json");
  3. const chalk = require("chalk");
  4. validateDependencyObject(pkg.dependencies);
  5. validateDependencyObject(pkg.devDependencies);
  6. function validateDependencyObject(object) {
  7. Object.keys(object).forEach(key => {
  8. if (object[key][0] === "^" || object[key][0] === "~") {
  9. console.error(
  10. chalk.red("error"),
  11. `Dependency "${chalk.bold.red(key)}" should be pinned.`
  12. );
  13. process.exitCode = 1;
  14. }
  15. });
  16. }