How to use the node-project-validator.hasPackageJson function in node-project-validator

To help you get started, we’ve selected a few node-project-validator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bucharest-gold / szero / bin / cli.js View on Github external
const run = (options) => {
  const dir = options.directory;

  // validates the project.
  validator.hasPackageJson(dir, true);
  validator.hasAnyDependencies(dir, true);
  validator.hasNodeModules(dir, true);

  // ignores test directory by default.
  if (!options.dev) {
    options.ignore.push('test');
  }

  // all the require() found.
  const requireSet = new Set();

  // lists JS files.
  listJS(dir, options.ignore)
    .then((files) => {
      // searches the require() for each file.
      files.forEach((f) => {
github nodeshift / license-reporter / lib / commands / report.cmd.js View on Github external
exports.handler = (argv) => {
  npv.hasPackageJson(argv.cwd, true);
  npv.hasDependencies(argv.cwd, true);

  if (npv.hasNodeModules(argv.cwd, false)) {
    let canonicalNameMapper;
    if (fs.existsSync(argv.nm)) {
      const mappings = canonicalName.loadNameMapperFile(argv.nm);
      canonicalNameMapper = canonicalName.init(mappings);
    } else {
      console.error(`File not found: ${argv.nm}`);
      process.exit(1);
    }

    if (fs.existsSync(argv.ul)) {
      validator.validate(argv.ul);
      unifiedList.load(argv.ul);
    } else {
github nodeshift / license-reporter / lib / commands / save.cmd.js View on Github external
exports.handler = (argv) => {
  npv.hasPackageJson(argv.cwd, true);
  npv.hasDependencies(argv.cwd, true);

  if (npv.hasNodeModules(argv.cwd, false)) {
    let canonicalNameMapper;
    if (fs.existsSync(argv.nm)) {
      const mappings = canonicalName.loadNameMapperFile(argv.nm);
      canonicalNameMapper = canonicalName.init(mappings);
    } else {
      console.error(`File not found: ${argv.nm}`);
      process.exit(1);
    }

    if (fs.existsSync(argv.ul)) {
      validator.validate(argv.ul);
      unifiedList.load(argv.ul);
    } else {
github nodeshift / license-reporter / lib / commands / console.cmd.js View on Github external
exports.handler = (argv) => {
  npv.hasPackageJson(argv.cwd, true);
  npv.hasDependencies(argv.cwd, true);

  if (npv.hasNodeModules(argv.cwd, false)) {
    let canonicalNameMapper;
    if (fs.existsSync(argv.nm)) {
      const mappings = canonicalName.loadNameMapperFile(argv.nm);
      canonicalNameMapper = canonicalName.init(mappings);
    } else {
      console.error(`File not found: ${argv.nm}`);
      process.exit(1);
    }

    if (fs.existsSync(argv.ul)) {
      validator.validate(argv.ul);
      unifiedList.load(argv.ul);
    } else {

node-project-validator

A basic Node.js project validator

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis