{"id":13487435,"url":"https://github.com/indexzero/node-pkginfo","last_synced_at":"2025-05-16T14:05:03.101Z","repository":{"id":41490398,"uuid":"1845418","full_name":"indexzero/node-pkginfo","owner":"indexzero","description":"An easy way to expose properties on a module from a package.json","archived":false,"fork":false,"pushed_at":"2018-02-15T03:08:23.000Z","size":31,"stargazers_count":163,"open_issues_count":4,"forks_count":26,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-12T11:00:06.122Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://github.com/indexzero/node-pkginfo","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indexzero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-06-04T02:17:22.000Z","updated_at":"2025-04-08T21:41:09.000Z","dependencies_parsed_at":"2022-08-25T10:41:05.500Z","dependency_job_id":null,"html_url":"https://github.com/indexzero/node-pkginfo","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fnode-pkginfo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fnode-pkginfo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fnode-pkginfo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fnode-pkginfo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indexzero","download_url":"https://codeload.github.com/indexzero/node-pkginfo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254233751,"owners_count":22036779,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T18:00:59.240Z","updated_at":"2025-05-16T14:05:03.078Z","avatar_url":"https://github.com/indexzero.png","language":"JavaScript","readme":"# node-pkginfo\n\nAn easy way to expose properties on a module from a package.json\n\n### Installing pkginfo\n```\n  npm install pkginfo\n```\n\n## Motivation\nHow often when writing node.js modules have you written the following line(s) of code?\n\n* Hard code your version string into your code\n\n``` js\n  exports.version = '0.1.0';\n```\n\n* Programmatically expose the version from the package.json\n\n``` js\n  exports.version = require('/path/to/package.json').version;\n```\n\nIn other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!**\n\n## Usage\n\nUsing `pkginfo` is idiot-proof, just require and invoke it.\n\n``` js\n  var pkginfo = require('pkginfo')(module);\n\n  console.dir(module.exports);\n```\n\nBy 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`).\n\nHere's a sample of the output:\n\n```\n  { name: 'simple-app',\n    description: 'A test fixture for pkginfo',\n    version: '0.1.0',\n    author: 'Charlie Robbins \u003ccharlie.robbins@gmail.com\u003e',\n    keywords: [ 'test', 'fixture' ],\n    main: './index.js',\n    scripts: { test: 'vows test/*-test.js --spec' },\n    engines: { node: '\u003e= 0.4.0' } }\n```\n\n### Expose specific properties\nIf 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:\n\n``` js\n  var pkginfo = require('pkginfo')(module, 'version', 'author');\n\n  console.dir(module.exports);\n```\n\n```\n  { version: '0.1.0',\n    author: 'Charlie Robbins \u003ccharlie.robbins@gmail.com\u003e' }\n```\n\nIf you're looking for further usage see the [examples][0] included in this repository.\n\n## Run Tests\nTests are written in [vows][1] and give complete coverage of all APIs.\n\n```\n  npm install\n  npm test\n```\n\n[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples\n[1]: http://vowsjs.org\n\n#### Author: [Charlie Robbins](http://github.com/indexzero)\n#### License: MIT\n","funding_links":[],"categories":["Npm","Repository"],"sub_categories":["NPM"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findexzero%2Fnode-pkginfo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findexzero%2Fnode-pkginfo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findexzero%2Fnode-pkginfo/lists"}