about-this-app

Utility functions to query package.json

Usage no npm install needed!

<script type="module">
  import aboutThisApp from 'https://cdn.skypack.dev/about-this-app';
</script>

README

about-this-app

Greenkeeper badge

Build Status

Utility functions to query a project's package.json file.

const app = require('about-this-app');

Properties

root

The app's root directory (where package.json is located)

pkg

The parsed package.json

dirs

The directories field (or an empty object)

Methods

dir(name)

The resolved path to a named directory. If the name is not found in app.dirs the absolute path to <app.root>/<name> is returned.

hasPkgProp(name)

Returns whether package.json has a property with the given name .

hasDep(name /*, name2, ... */)

Returns whether dependencies contains any of the names.

hasDevDep(name /*, name2, ... */)

Returns whether devDependencies contains any of the names.

hasPeerDep(name /*, name2, ... */)

Returns whether peerDependencies contains any of the names.

hasAnyDep(name /*, name2, ... */)

Returns whether any of the names is listed as any kind of dependency.

hasScript(name /*, name2, ... */)

Returns whether scripts contains any of the names.

hasFile(name)

Returns whether a file with the given name exists relative to app.root.

License

MIT