├── .editorconfig ├── .eslintrc.json ├── .gitattributes ├── .gitignore ├── .travis.yml ├── .verb.md ├── LICENSE ├── README.md ├── assets ├── log-error.jpg ├── log-info.jpg ├── log-success.jpg ├── log-value.jpg └── log-warning.jpg ├── example.js ├── index.js ├── package.json └── test.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org/ 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | indent_size = 2 8 | indent_style = space 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [{**/{actual,fixtures,expected,templates}/**,*.md}] 13 | trim_trailing_whitespace = false 14 | insert_final_newline = false 15 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": false, 4 | "es6": true, 5 | "node": true, 6 | "mocha": true 7 | }, 8 | 9 | "globals": { 10 | "document": false, 11 | "navigator": false, 12 | "window": false 13 | }, 14 | 15 | "rules": { 16 | "accessor-pairs": 2, 17 | "arrow-spacing": [2, { "before": true, "after": true }], 18 | "block-spacing": [2, "always"], 19 | "brace-style": [2, "1tbs", { "allowSingleLine": true }], 20 | "comma-dangle": [2, "never"], 21 | "comma-spacing": [2, { "before": false, "after": true }], 22 | "comma-style": [2, "last"], 23 | "constructor-super": 2, 24 | "curly": [2, "multi-line"], 25 | "dot-location": [2, "property"], 26 | "eol-last": 2, 27 | "eqeqeq": [2, "allow-null"], 28 | "generator-star-spacing": [2, { "before": true, "after": true }], 29 | "handle-callback-err": [2, "^(err|error)$" ], 30 | "indent": [2, 2, { "SwitchCase": 1 }], 31 | "key-spacing": [2, { "beforeColon": false, "afterColon": true }], 32 | "keyword-spacing": [2, { "before": true, "after": true }], 33 | "new-cap": [2, { "newIsCap": true, "capIsNew": false }], 34 | "new-parens": 2, 35 | "no-array-constructor": 2, 36 | "no-caller": 2, 37 | "no-class-assign": 2, 38 | "no-cond-assign": 2, 39 | "no-const-assign": 2, 40 | "no-control-regex": 2, 41 | "no-debugger": 2, 42 | "no-delete-var": 2, 43 | "no-dupe-args": 2, 44 | "no-dupe-class-members": 2, 45 | "no-dupe-keys": 2, 46 | "no-duplicate-case": 2, 47 | "no-empty-character-class": 2, 48 | "no-eval": 2, 49 | "no-ex-assign": 2, 50 | "no-extend-native": 2, 51 | "no-extra-bind": 2, 52 | "no-extra-boolean-cast": 2, 53 | "no-extra-parens": [2, "functions"], 54 | "no-fallthrough": 2, 55 | "no-floating-decimal": 2, 56 | "no-func-assign": 2, 57 | "no-implied-eval": 2, 58 | "no-inner-declarations": [2, "functions"], 59 | "no-invalid-regexp": 2, 60 | "no-irregular-whitespace": 2, 61 | "no-iterator": 2, 62 | "no-label-var": 2, 63 | "no-labels": 2, 64 | "no-lone-blocks": 2, 65 | "no-mixed-spaces-and-tabs": 2, 66 | "no-multi-spaces": 2, 67 | "no-multi-str": 2, 68 | "no-multiple-empty-lines": [2, { "max": 1 }], 69 | "no-native-reassign": 0, 70 | "no-negated-in-lhs": 2, 71 | "no-new": 2, 72 | "no-new-func": 2, 73 | "no-new-object": 2, 74 | "no-new-require": 2, 75 | "no-new-wrappers": 2, 76 | "no-obj-calls": 2, 77 | "no-octal": 2, 78 | "no-octal-escape": 2, 79 | "no-proto": 0, 80 | "no-redeclare": 2, 81 | "no-regex-spaces": 2, 82 | "no-return-assign": 2, 83 | "no-self-compare": 2, 84 | "no-sequences": 2, 85 | "no-shadow-restricted-names": 2, 86 | "no-spaced-func": 2, 87 | "no-sparse-arrays": 2, 88 | "no-this-before-super": 2, 89 | "no-throw-literal": 2, 90 | "no-trailing-spaces": 0, 91 | "no-undef": 2, 92 | "no-undef-init": 2, 93 | "no-unexpected-multiline": 2, 94 | "no-unneeded-ternary": [2, { "defaultAssignment": false }], 95 | "no-unreachable": 2, 96 | "no-unused-vars": [2, { "vars": "all", "args": "none" }], 97 | "no-useless-call": 0, 98 | "no-with": 2, 99 | "one-var": [0, { "initialized": "never" }], 100 | "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }], 101 | "padded-blocks": [0, "never"], 102 | "quotes": [2, "single", "avoid-escape"], 103 | "radix": 2, 104 | "semi": [2, "always"], 105 | "semi-spacing": [2, { "before": false, "after": true }], 106 | "space-before-blocks": [2, "always"], 107 | "space-before-function-paren": [2, "never"], 108 | "space-in-parens": [2, "never"], 109 | "space-infix-ops": 2, 110 | "space-unary-ops": [2, { "words": true, "nonwords": false }], 111 | "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }], 112 | "use-isnan": 2, 113 | "valid-typeof": 2, 114 | "wrap-iife": [2, "any"], 115 | "yoda": [2, "never"] 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Enforce Unix newlines 2 | * text eol=lf 3 | 4 | # binaries 5 | *.ai binary 6 | *.psd binary 7 | *.jpg binary 8 | *.gif binary 9 | *.png binary 10 | *.jpeg binary 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # always ignore files 2 | *.DS_Store 3 | .idea 4 | .vscode 5 | *.sublime-* 6 | 7 | # test related, or directories generated by tests 8 | test/actual 9 | actual 10 | coverage 11 | .nyc* 12 | 13 | # npm 14 | node_modules 15 | npm-debug.log 16 | 17 | # yarn 18 | yarn.lock 19 | yarn-error.log 20 | 21 | # misc 22 | _gh_pages 23 | _draft 24 | _drafts 25 | bower_components 26 | vendor 27 | temp 28 | tmp 29 | TODO.md 30 | package-lock.json -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | os: 3 | - linux 4 | - osx 5 | language: node_js 6 | node_js: 7 | - node 8 | - '9' 9 | - '8' 10 | - '7' 11 | - '6' 12 | -------------------------------------------------------------------------------- /.verb.md: -------------------------------------------------------------------------------- 1 | ## Usage 2 | 3 | ```js 4 | const pkg = require('{%= name %}'); 5 | const Base = require('base'); 6 | const app = new Base(); 7 | 8 | app.use(pkg()); 9 | 10 | console.log(app.pkg.data); 11 | //=> {"name": "my-project", ...} 12 | ``` 13 | 14 | ## API 15 | 16 | Visit [pkg-store][] for additional API details and documentation. 17 | 18 | 19 | ### .pkg.set 20 | 21 | ```js 22 | app.pkg.set(key, value); 23 | ``` 24 | 25 | Set property `key` with the given `value`. 26 | 27 | **Example** 28 | 29 | ```js 30 | // given {"name": "my-project"} 31 | app.pkg.set('bin.foo', 'bar'); 32 | 33 | console.log(app.pkg.data); 34 | //=> {"name": "my-project", "bin": {"foo": "bar"}} 35 | ``` 36 | 37 | ### .pkg.save 38 | 39 | Persist package.json to the file system at `app.pkg.path`. 40 | 41 | ```js 42 | app.pkg.save(); 43 | ``` 44 | 45 | ### .pkg.get 46 | 47 | ```js 48 | app.pkg.get(key); 49 | ``` 50 | 51 | Get property `key` from package.json. 52 | 53 | **Example** 54 | 55 | ```js 56 | // given {"name": "my-project"} 57 | app.pkg.set('bin.foo', 'bar'); 58 | 59 | console.log(app.pkg.get('bin')); 60 | //=> {"foo": "bar"} 61 | ``` 62 | 63 | ### .pkg.has 64 | 65 | ```js 66 | app.pkg.has(key); 67 | ``` 68 | 69 | Returns `true` if `package.json` has property `key`. 70 | 71 | **Example** 72 | 73 | ```js 74 | // given: {"name": "my-project"} 75 | console.log(app.pkg.has('name')); 76 | //=> true 77 | console.log(app.pkg.has('zzzzzzz')); 78 | //=> false 79 | ``` 80 | 81 | ### .pkg.union 82 | 83 | ```js 84 | app.pkg.union(key, val); 85 | ``` 86 | 87 | Create array `key`, or concatenate values to array `key`. Also uniquifies the array. 88 | 89 | **Example** 90 | 91 | ```js 92 | app.pkg.union('keywords', 'foo'); 93 | app.pkg.union('keywords', ['bar', 'baz']); 94 | 95 | console.log(app.pkg.get('keywords')); 96 | //=> ['foo', 'bar', 'baz'] 97 | ``` 98 | 99 | ## .pkg.expand 100 | 101 | Creates a shallow clone of `package.json` with values expanded by [expand-pkg][]. 102 | 103 | **Example** 104 | 105 | ```js 106 | console.log(app.pkg.get('author')); 107 | //=> 'Jon Schlinkert (https://github.com/jonschlinkert)' 108 | 109 | const expanded = app.pkg.expand(); 110 | console.log(expanded.author); 111 | //=> {name: 'Jon Schlinkert', url: 'https://github.com/jonschlinkert'} 112 | ``` 113 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-2017, Jon Schlinkert. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 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&label=Travis)](https://travis-ci.org/node-base/base-pkg) 2 | 3 | > Plugin for adding a `pkg` method that exposes pkg-store to your base application. 4 | 5 | Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. 6 | 7 | ## Install 8 | 9 | Install with [npm](https://www.npmjs.com/): 10 | 11 | ```sh 12 | $ npm install --save base-pkg 13 | ``` 14 | 15 | ## Usage 16 | 17 | ```js 18 | var pkg = require('base-pkg'); 19 | var Base = require('base'); 20 | var app = new Base(); 21 | 22 | app.use(pkg()); 23 | 24 | console.log(app.pkg.data); 25 | //=> {"name": "my-project", ...} 26 | ``` 27 | 28 | ## API 29 | 30 | Visit [pkg-store](https://github.com/jonschlinkert/pkg-store) for additional API details and documentation. 31 | 32 | ### .pkg.set 33 | 34 | ```js 35 | app.pkg.set(key, value); 36 | ``` 37 | 38 | Set property `key` with the given `value`. 39 | 40 | **Example** 41 | 42 | ```js 43 | // given {"name": "my-project"} 44 | app.pkg.set('bin.foo', 'bar'); 45 | 46 | console.log(app.pkg.data); 47 | //=> {"name": "my-project", "bin": {"foo": "bar"}} 48 | ``` 49 | 50 | ### .pkg.save 51 | 52 | Persist package.json to the file system at `app.pkg.path`. 53 | 54 | ```js 55 | app.pkg.save(); 56 | ``` 57 | 58 | ### .pkg.get 59 | 60 | ```js 61 | app.pkg.get(key); 62 | ``` 63 | 64 | Get property `key` from package.json. 65 | 66 | **Example** 67 | 68 | ```js 69 | // given {"name": "my-project"} 70 | app.pkg.set('bin.foo', 'bar'); 71 | 72 | console.log(app.pkg.get('bin')); 73 | //=> {"foo": "bar"} 74 | ``` 75 | 76 | ### .pkg.has 77 | 78 | ```js 79 | app.pkg.has(key); 80 | ``` 81 | 82 | Returns `true` if `package.json` has property `key`. 83 | 84 | **Example** 85 | 86 | ```js 87 | // given: {"name": "my-project"} 88 | console.log(app.pkg.has('name')); 89 | //=> true 90 | console.log(app.pkg.has('zzzzzzz')); 91 | //=> false 92 | ``` 93 | 94 | ### .pkg.union 95 | 96 | ```js 97 | app.pkg.union(key, val); 98 | ``` 99 | 100 | Create array `key`, or concatenate values to array `key`. Also uniquifies the array. 101 | 102 | **Example** 103 | 104 | ```js 105 | app.pkg.union('keywords', 'foo'); 106 | app.pkg.union('keywords', ['bar', 'baz']); 107 | 108 | console.log(app.pkg.get('keywords')); 109 | //=> ['foo', 'bar', 'baz'] 110 | ``` 111 | 112 | ## .pkg.expand 113 | 114 | Creates 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). 115 | 116 | **Example** 117 | 118 | ```js 119 | console.log(app.pkg.get('author')); 120 | //=> 'Jon Schlinkert (https://github.com/jonschlinkert)' 121 | 122 | var expanded = app.pkg.expand(); 123 | var author = expanded.get('author'); 124 | //=> {name: 'Jon Schlinkert', url: 'https://github.com/jonschlinkert'} 125 | ``` 126 | 127 | ## About 128 | 129 |
130 | Contributing 131 | 132 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). 133 | 134 |
135 | 136 |
137 | Running Tests 138 | 139 | Running 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: 140 | 141 | ```sh 142 | $ npm install && npm test 143 | ``` 144 | 145 |
146 |
147 | Building docs 148 | 149 | _(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.)_ 150 | 151 | To generate the readme, run the following command: 152 | 153 | ```sh 154 | $ npm install -g verbose/verb#dev verb-generate-readme && verb 155 | ``` 156 | 157 |
158 | 159 | ### Related projects 160 | 161 | You might also be interested in these projects: 162 | 163 | * [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.") 164 | * [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") 165 | * [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.") 166 | * [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.") 167 | 168 | ### Author 169 | 170 | **Jon Schlinkert** 171 | 172 | * [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert) 173 | * [github/jonschlinkert](https://github.com/jonschlinkert) 174 | * [twitter/jonschlinkert](https://twitter.com/jonschlinkert) 175 | 176 | ### License 177 | 178 | Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). 179 | Released under the [MIT License](LICENSE). 180 | 181 | *** 182 | 183 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on December 21, 2017._ -------------------------------------------------------------------------------- /assets/log-error.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base-repos/base-pkg/2f0a16da9c90170c824bcc01ece2861021660a3c/assets/log-error.jpg -------------------------------------------------------------------------------- /assets/log-info.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base-repos/base-pkg/2f0a16da9c90170c824bcc01ece2861021660a3c/assets/log-info.jpg -------------------------------------------------------------------------------- /assets/log-success.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base-repos/base-pkg/2f0a16da9c90170c824bcc01ece2861021660a3c/assets/log-success.jpg -------------------------------------------------------------------------------- /assets/log-value.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base-repos/base-pkg/2f0a16da9c90170c824bcc01ece2861021660a3c/assets/log-value.jpg -------------------------------------------------------------------------------- /assets/log-warning.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/base-repos/base-pkg/2f0a16da9c90170c824bcc01ece2861021660a3c/assets/log-warning.jpg -------------------------------------------------------------------------------- /example.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const pkg = require('./'); 4 | const Base = require('base'); 5 | const app = new Base(); 6 | app.use(pkg()); 7 | 8 | console.log(app.pkg.get('author')); 9 | console.log(app.pkg.expand()); 10 | 11 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * base-pkg 3 | * 4 | * Copyright (c) 2016-2017, Jon Schlinkert. 5 | * Released under the MIT License. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | const isValid = require('is-valid-app'); 11 | const debug = require('debug')('base-pkg'); 12 | const Expand = require('expand-pkg'); 13 | const Pkg = require('pkg-store'); 14 | 15 | module.exports = function(options) { 16 | if (typeof options === 'string') { 17 | options = { cwd: options }; 18 | } 19 | 20 | return function(app) { 21 | if (!isValid(app, 'base-pkg')) return; 22 | debug('initializing from <%s>', __filename); 23 | app.pkg = new Pkg(Object.assign({ cwd: process.cwd() }, app.options, options)); 24 | app.pkg.expand = function() { 25 | const pkg = new Expand(); 26 | return pkg.expand(Object.assign({}, app.pkg.data)); 27 | }; 28 | }; 29 | }; 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "base-pkg", 3 | "description": "Plugin for adding a `pkg` method that exposes pkg-store to your base application.", 4 | "version": "1.0.0", 5 | "homepage": "https://github.com/node-base/base-pkg", 6 | "author": "Jon Schlinkert (https://github.com/jonschlinkert)", 7 | "repository": "node-base/base-pkg", 8 | "bugs": { 9 | "url": "https://github.com/node-base/base-pkg/issues" 10 | }, 11 | "license": "MIT", 12 | "files": [ 13 | "index.js" 14 | ], 15 | "main": "index.js", 16 | "engines": { 17 | "node": ">=6" 18 | }, 19 | "scripts": { 20 | "test": "mocha" 21 | }, 22 | "dependencies": { 23 | "debug": "^3.1.0", 24 | "expand-pkg": "^0.1.8", 25 | "is-valid-app": "^0.3.0", 26 | "pkg-store": "^1.0.1" 27 | }, 28 | "devDependencies": { 29 | "base-cwd": "^0.3.4", 30 | "base": "^1.0.0", 31 | "gulp-format-md": "^1.0.0", 32 | "mocha": "^3.5.3" 33 | }, 34 | "keywords": [ 35 | "api", 36 | "app", 37 | "application", 38 | "base", 39 | "base-plugin", 40 | "baseplugin", 41 | "building-blocks", 42 | "create", 43 | "framework", 44 | "pkg", 45 | "plugin", 46 | "plugins", 47 | "tool", 48 | "toolkit", 49 | "tools" 50 | ], 51 | "verb": { 52 | "run": true, 53 | "toc": false, 54 | "layout": "default", 55 | "tasks": [ 56 | "readme" 57 | ], 58 | "plugins": [ 59 | "gulp-format-md" 60 | ], 61 | "related": { 62 | "list": [ 63 | "base", 64 | "base-options", 65 | "cache-base", 66 | "pkg-store" 67 | ] 68 | }, 69 | "lint": { 70 | "reflinks": true 71 | }, 72 | "reflinks": [ 73 | "cache-base", 74 | "expand-pkg", 75 | "pkg-store" 76 | ] 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('mocha'); 4 | var path = require('path'); 5 | var assert = require('assert'); 6 | var cwd = require('base-cwd'); 7 | var Base = require('base'); 8 | var app; 9 | 10 | var pkg = require('./'); 11 | Base.use(function() { 12 | this.isApp = true; 13 | }); 14 | 15 | describe('base-cwd', function() { 16 | beforeEach(function() { 17 | app = new Base(); 18 | app.use(cwd()); 19 | app.use(pkg(__dirname)); 20 | }); 21 | 22 | describe('main export', function() { 23 | it('should export a function', function() { 24 | assert.equal(typeof pkg, 'function'); 25 | }); 26 | 27 | it('should add a `pkg` property to app', function() { 28 | assert.equal(typeof app.pkg, 'object'); 29 | }); 30 | 31 | it('should add an `app.pkg.set` method', function() { 32 | assert.equal(typeof app.pkg.set, 'function'); 33 | }); 34 | 35 | it('should add an `app.pkg.get` method', function() { 36 | assert.equal(typeof app.pkg.get, 'function'); 37 | }); 38 | 39 | it('should add an `app.pkg.has` method', function() { 40 | assert.equal(typeof app.pkg.has, 'function'); 41 | }); 42 | 43 | it('should add an `app.pkg.del` method', function() { 44 | assert.equal(typeof app.pkg.del, 'function'); 45 | }); 46 | 47 | it('should add an `app.pkg.union` method', function() { 48 | assert.equal(typeof app.pkg.union, 'function'); 49 | }); 50 | }); 51 | 52 | describe('get', function() { 53 | it('should get the name from package.json', function() { 54 | assert.equal(app.pkg.get('name'), 'base-pkg'); 55 | }); 56 | }); 57 | }); 58 | --------------------------------------------------------------------------------