Check if a project has package.json
Checks if a package.json
file is present in the working directory.
$ yarn add has-package
.
├── foo
│ └── ...
└── bar
└── package.json
const hasPackage = require('has-package')
hasPackage('foo')
//=> false
hasPackage('bar')
//=> true
Returns a boolean
.
Type: string
Default: process.cwd()
Current working directory.
MIT © Bu Kinoshita