UNPKG

valid-directory

Version:

Check whether or not a directory and its descendants are valid

25 lines (24 loc) 776 B
#!/usr/bin/env node "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const index_js_1 = __importDefault(require("./index.js")); const path = process.argv[2] || process.cwd(); (0, index_js_1.default)(path) .then(([valid, invalidPaths]) => { if (valid) { console.log(`${path} is valid`); } else { console.error(`${path} is invalid, due to the following paths:\n`, invalidPaths); process.exitCode = 1; } }) .catch((err) => { console.error(`can't validate ${path}, due to:\n${err.message}`); if (!process.exitCode) { process.exitCode = 2; } });