@shawnsandy/npm_info

0.5.29 • Public • Published

NPM Package Info

Eleventy filter that grabs and returns npm package details or a github repository info

Example

Name: Vue Description Reactive, component-oriented view layer for modern web interfaces. Version 2.6.10 Stars Count 138764 Open issues 281

Usage

Install

// npm
npm i @shawnsandy/npm_info --dev

// yarn
yarn add @shawnsandy/npm_info -D

NPM Package details

  • Add the following to your eleventy.js config file
const npmInfo = require("@shawnsandy/npm_info")
  • In the module.exports section of your eleventy.js file add a nunjucks filter eleventyConfig.addNunjucksAsyncFilter( "npm", npmInfo);
module.exports = function(eleventyConfig) {
/**
 * Get the npm package info
 */
eleventyConfig.addNunjucksAsyncFilter( "npm", npmInfo);

}
  • Use the filter in your template
     {{ "vue" | npnInfo | safe  }}

Github repository info

  • Lets skip the property declaration this time

  • In the module.exports section of your eleventy.js file add a nunjucks filter eleventyConfig.addNunjucksAsyncFilter( "gitInfo", require("@shawnsandy/npm_info/gitinfo");

module.exports = function(eleventyConfig) {
/**
 * Get the npm package info
 */
eleventyConfig.addNunjucksAsyncFilter( "gitInfo", require("@shawnsandy/npm_info/gitinfo");

}
  • Use the filter in your template
     {{ "vuejs/vue" | gitInfo | safe  }}

License: MIT

TODO

  • [ ] refactor remove safe requirement on filter
  • [ ] complete docs
  • [ ] Add configuration options
  • [ ] write test
  • [ ] more

Readme

Keywords

Package Sidebar

Install

npm i @shawnsandy/npm_info

Weekly Downloads

0

Version

0.5.29

License

MIT

Unpacked Size

5.66 kB

Total Files

7

Last publish

Collaborators

  • shawnsandy