VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /proc/thread-self/root/usr/local/lib/node_modules/forever/node_modules/pkginfo/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/thread-self/root/usr/local/lib/node_modules/forever/node_modules/pkginfo/README.md
# node-pkginfo

An easy way to expose properties on a module from a package.json

## Installation

### Installing npm (node package manager)
```
  curl http://npmjs.org/install.sh | sh
```

### Installing pkginfo
```
  [sudo] npm install pkginfo
```

## Motivation
How often when writing node.js modules have you written the following line(s) of code? 

* Hard code your version string into your code

``` js
  exports.version = '0.1.0';
```

* Programmatically expose the version from the package.json

``` js
  exports.version = require('/path/to/package.json').version;
```

In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!**

## Usage

Using `pkginfo` is idiot-proof, just require and invoke it. 

``` js
  var pkginfo = require('pkginfo')(module);
  
  console.dir(module.exports);
```

By invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). 

Here's a sample of the output:

```
  { name: 'simple-app',
    description: 'A test fixture for pkginfo',
    version: '0.1.0',
    author: 'Charlie Robbins <charlie.robbins@gmail.com>',
    keywords: [ 'test', 'fixture' ],
    main: './index.js',
    scripts: { test: 'vows test/*-test.js --spec' },
    engines: { node: '>= 0.4.0' } }
```

### Expose specific properties
If you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function:

``` js
  var pkginfo = require('pkginfo')(module, 'version', 'author');
  
  console.dir(module.exports);
```

```
  { version: '0.1.0',
    author: 'Charlie Robbins <charlie.robbins@gmail.com>' }
```

If you're looking for further usage see the [examples][0] included in this repository. 

## Run Tests
Tests are written in [vows][1] and give complete coverage of all APIs.

```
  vows test/*-test.js --spec
```

[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples
[1]: http://vowsjs.org

#### Author: [Charlie Robbins](http://nodejitsu.com)
#### License: MIT

VaKeR 2022