{"id":25180680,"url":"https://github.com/base-repos/base-pkg","last_synced_at":"2025-05-07T06:04:44.491Z","repository":{"id":57189223,"uuid":"52154596","full_name":"base-repos/base-pkg","owner":"base-repos","description":"Base plugin for adding a `pkg` object with get/set methods for getting data from package.json or setting data to package.json.","archived":false,"fork":false,"pushed_at":"2017-12-21T08:51:23.000Z","size":199,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T06:04:39.002Z","etag":null,"topics":["config","data","libary","module","npm","package","package-json","project","store"],"latest_commit_sha":null,"homepage":null,"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/base-repos.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":"2016-02-20T13:27:42.000Z","updated_at":"2025-01-31T00:39:36.000Z","dependencies_parsed_at":"2022-09-15T03:53:30.955Z","dependency_job_id":null,"html_url":"https://github.com/base-repos/base-pkg","commit_stats":null,"previous_names":["node-base/base-pkg","base-repos/base-pkg","base/base-pkg"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-repos%2Fbase-pkg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-repos%2Fbase-pkg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-repos%2Fbase-pkg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base-repos%2Fbase-pkg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/base-repos","download_url":"https://codeload.github.com/base-repos/base-pkg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252823920,"owners_count":21809713,"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":["config","data","libary","module","npm","package","package-json","project","store"],"created_at":"2025-02-09T16:19:15.991Z","updated_at":"2025-05-07T06:04:44.471Z","avatar_url":"https://github.com/base-repos.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# base-pkg [![NPM version](https://img.shields.io/npm/v/base-pkg.svg?style=flat)](https://www.npmjs.com/package/base-pkg) [![NPM monthly downloads](https://img.shields.io/npm/dm/base-pkg.svg?style=flat)](https://npmjs.org/package/base-pkg) [![NPM total downloads](https://img.shields.io/npm/dt/base-pkg.svg?style=flat)](https://npmjs.org/package/base-pkg) [![Linux Build Status](https://img.shields.io/travis/node-base/base-pkg.svg?style=flat\u0026label=Travis)](https://travis-ci.org/node-base/base-pkg)\n\n\u003e Plugin for adding a `pkg` method that exposes pkg-store to your base application.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save base-pkg\n```\n\n## Usage\n\n```js\nvar pkg = require('base-pkg');\nvar Base = require('base');\nvar app = new Base();\n\napp.use(pkg());\n\nconsole.log(app.pkg.data);\n//=\u003e {\"name\": \"my-project\", ...}\n```\n\n## API\n\nVisit [pkg-store](https://github.com/jonschlinkert/pkg-store) for additional API details and documentation.\n\n### .pkg.set\n\n```js\napp.pkg.set(key, value);\n```\n\nSet property `key` with the given `value`.\n\n**Example**\n\n```js\n// given {\"name\": \"my-project\"}\napp.pkg.set('bin.foo', 'bar');\n\nconsole.log(app.pkg.data);\n//=\u003e {\"name\": \"my-project\", \"bin\": {\"foo\": \"bar\"}}\n```\n\n### .pkg.save\n\nPersist package.json to the file system at `app.pkg.path`.\n\n```js\napp.pkg.save();\n```\n\n### .pkg.get\n\n```js\napp.pkg.get(key);\n```\n\nGet property `key` from package.json.\n\n**Example**\n\n```js\n// given {\"name\": \"my-project\"}\napp.pkg.set('bin.foo', 'bar');\n\nconsole.log(app.pkg.get('bin'));\n//=\u003e {\"foo\": \"bar\"}\n```\n\n### .pkg.has\n\n```js\napp.pkg.has(key);\n```\n\nReturns `true` if `package.json` has property `key`.\n\n**Example**\n\n```js\n// given: {\"name\": \"my-project\"}\nconsole.log(app.pkg.has('name'));\n//=\u003e true\nconsole.log(app.pkg.has('zzzzzzz'));\n//=\u003e false\n```\n\n### .pkg.union\n\n```js\napp.pkg.union(key, val);\n```\n\nCreate array `key`, or concatenate values to array `key`. Also uniquifies the array.\n\n**Example**\n\n```js\napp.pkg.union('keywords', 'foo');\napp.pkg.union('keywords', ['bar', 'baz']);\n\nconsole.log(app.pkg.get('keywords'));\n//=\u003e ['foo', 'bar', 'baz']\n```\n\n## .pkg.expand\n\nCreates a get/set API using [cache-base](https://github.com/jonschlinkert/cache-base), where the cache is populated with a shallow clone of `package.json` with values expanded by [expand-pkg](https://github.com/jonschlinkert/expand-pkg).\n\n**Example**\n\n```js\nconsole.log(app.pkg.get('author'));\n//=\u003e 'Jon Schlinkert (https://github.com/jonschlinkert)'\n\nvar expanded = app.pkg.expand();\nvar author = expanded.get('author');\n//=\u003e {name: 'Jon Schlinkert', url: 'https://github.com/jonschlinkert'}\n```\n\n## About\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eContributing\u003c/strong\u003e\u003c/summary\u003e\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRunning Tests\u003c/strong\u003e\u003c/summary\u003e\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBuilding docs\u003c/strong\u003e\u003c/summary\u003e\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n\u003c/details\u003e\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [base-options](https://www.npmjs.com/package/base-options): Adds a few options methods to base-methods, like `option`, `enable` and `disable`. See the readme… [more](https://github.com/jonschlinkert/base-options) | [homepage](https://github.com/jonschlinkert/base-options \"Adds a few options methods to base-methods, like `option`, `enable` and `disable`. See the readme for the full API.\")\n* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base \"Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks\")\n* [cache-base](https://www.npmjs.com/package/cache-base): Basic object cache with `get`, `set`, `del`, and `has` methods for node.js/javascript projects. | [homepage](https://github.com/jonschlinkert/cache-base \"Basic object cache with `get`, `set`, `del`, and `has` methods for node.js/javascript projects.\")\n* [pkg-store](https://www.npmjs.com/package/pkg-store): Use package.json as a config store. | [homepage](https://github.com/jonschlinkert/pkg-store \"Use package.json as a config store.\")\n\n### Author\n\n**Jon Schlinkert**\n\n* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on December 21, 2017._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbase-repos%2Fbase-pkg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbase-repos%2Fbase-pkg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbase-repos%2Fbase-pkg/lists"}