npm promotes metadefinitions

npm

Need private packages and team management tools?Check out npm Orgs. »

relative-package

1.0.0 • Public • Published

relative-package Build Status NPM version

Find the package.json (or another) relative to a given path

Getting Started

Install the module with: npm install relative-package

Usage

Find package.json:

var relativePackage = require('relative-package');
 
console.log('package.json relative to where relativePackage() is called:\n  %s',
  relativePackage())
 
console.log('package.json relative a given path:\n  %s',
  relativePackage('./test/relative-package.test.js'))
 
console.log('package.json relative to a given absolute path:\n  %s',
  relativePackage(__dirname + '/readme.md'))
 
console.log('package.json relative to a given package:\n  %s',
  relativePackage('mocha'))
 
console.log('package.json relative to a given package:\n  %s',
  relativePackage('mocha'))

Find any other file:

var relativePackage = require('relative-package');
 
console.log('.gitignore relative to where relativePackage() is called:\n  %s',
  relativePackage(null, '.gitignore'))
 
console.log('Readme.md of a given package:\n  %s',
  relativePackage('mocha', 'Readme.md'))

(see demo.js)

install

npm i relative-package

Downloadsweekly downloads

14

version

1.0.0

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability