Simple way to get the package.json for any installed package.
This finds the
package.json for any package installed in
so that if can be accessed by the running server.
It can also find the
main key and a
style key as well as
package.json as an object or the css as a
This package uses native Promises throughout.
npm install package-resolve
The example is based on having installed bootstrap. It does
not need to have been
Pack = ;pack = 'bootstrap';pack// file contains the path of the package.json file// err contains a descriptive error such as "File not found"
Pack = ;pack = <package to find>;
This should be passed the name of the package to find as listed under
dependencies in our
pack// file contains the path of the package.json file// err contains a descriptive error such as "File not found"
This returns a Promise that resolves to the full path of the
file for this dependency.
pack// file contains the path of the `main` file in the package.jsonconsole;
packstyle// file contains the path of the file referred to in the style keyconsole;
pack// obj contains the contents of package.json as an objectconsole;
pack// css contains the css as a stringconsole;
Any issues or comments would be appreciated at Github
Pull requests are welcome.