node-project-validator

0.3.1 • Public • Published

node-project-validator

Node.js CI

A basic Node.js project validator

Install

npm i node-project-validator

Usage

const validator = require('node-project-validator');

// The first parameter is the project root directory
// The second parameter is a flag to choose if the validator
// will handle with an error message + process.exit(1)
// (in case flag === true) or return a boolean (flag === false)
// then you can handle with message you want.
validator.hasPackageJson('.', false);

console.log(validator.hasPackageJson('project_dir', false));
true

console.log(validator.hasPackageJson('project_dir/test/', true));
'This is not a Node.js project (no package.json found).'

// others functions:

validator.hasDependencies('.', false);
validator.hasDevDependencies('.', false);
validator.hasAnyDependencies('.', false);
validator.hasNodeModules('.', false);

Readme

Keywords

Package Sidebar

Install

npm i node-project-validator

Weekly Downloads

145

Version

0.3.1

License

MIT

Unpacked Size

3.14 kB

Total Files

3

Last publish

Collaborators

  • helio-frota