npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

project-info-scanner

v1.0.1

Published

This project searches and reads hierarchically a configuration file in a path provided by params.

Downloads

3

Readme

Project-info

Travis Coveralls github License: GPL v3 Known Vulnerabilities

NPM

This project searches and reads hierarchically a configuration file in a path provided by params; (e.g. This package can be used to scan and map a set os custom information to feedback and help a CLI code generation tool, making it clever enough to change across mapped directories and do what it takes to its successfuly execution).

Getting started

To make use of this package in your project, just npm install like this:

$ npm i project-info-scanner

How it works

The scan process works in two different phases:

  • First, the package get the path provided as first parameter and tries to find a .project-info.json file with a true valued root property (this filename should be provided as second parameter, but the default value is .project-info.json); If the path does not have a configuration file, it'll look upwards until find it. (When the seach process reaches the root path in filesystem, an error is thrown).
  • The second part is the scan process itself. It will start to read the root config file (that it found in First phase) and also reads all children folder seeking for another config files; If the child folder does not contain a config file, the tree search stops there and continue in siblings.

Usage example

This package have only one method called "from". The method from has only two parameters:

  • path: required string to be used as initial path of First search phase.
  • configFilename: optional string that reffers to the config filename that will be seeked; The default value is .project-info.json

from(absolutePath [, configFileName])

var projectInfoScanner = require('project-info-scanner');

projectInfoScanner.from('/any/path/you/want');
// If you named your configfile unlike the default value
projectInfoScanner.from('/any/path/you/want', 'your-custom-name.json');

See a detailed usage HERE

The config file structure

The config file should always be written with JSON syntax. Its default name is .project-info.json, but can be provided another one as second parameter in from method.

Restricted properties

There are only two required properties:

  • name: A required string property that must contains the project name (An error is thrown if it's empty or not provided)
  • root: It's only required in the root config file and must contains the value true; If not provided, the package will consider as non root file, even if it was the last existing one in seach process.

Besides those required properties, we have another couple that are created when the config file is read:

  • dir: A string containing the full path to config file itself.
  • branches: An array containing others config files found in children folder (and it keeps going search whenever a child path contains a config file)

Obs: If you manually set any of this properties (dir and branches), the package will overwrite them with the correct values.

Custom properties

Respecting the JSON syntax, you can add any custom property you want and it will be included in the final output.

if you want a detailed example, see this GIST

How to contribute

Just create a pull request that passes in build process (see travis-ci) and maximum descreases the coverage percentage by 10%.