npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@describo/data-packs

v0.13.1

Published

A set of data packs for describo to load content from.

Downloads

81

Readme

A repository to host data packs for use in Describo. A data pack is simply a pre-defined array of JSON-LD objects that can be used as the value of a property.

Github: https://github.com/describo/data-packs

For users

Install the package

npm install --save @describo/data-packs

Loading the data packs into elastic search

For development you can start a local elastic search service with:

docker compose up -d ; docker compose logs -f ; docker compose stop ; docker compose rm -f

Then in your application you can trigger a load of all of the data packs:

const { IndexDataPacks } = require('@describo/data-packs')
const index = new IndexDataPacks({ elasticUrl: "http://localhost:9200" });
await index.load();

Or to do it once somewhere outside of your app with something like the script ./bin/index-data-packs.js

Working with the package

const { DataPack } = require('@describo/data-packs')
let datapack = new DataPack({ dataPacks: ['Austlang', 'Glottolog'], indexFields: ['@id', 'name']})
await datapack.load()


let language = datapack.get({
  field: "name",
  value: "Nyaki Nyaki / Njaki Njaki",
});

Returns a JSON-LD snippet if a match is found.

If you only want a subset of the properties try:

const { DataPack } = require('@describo/data-packs')
let datapack = new DataPack({ dataPacks: ['Austlang', 'Glottolog'], indexFields: ['@id', 'name']})
await datapack.load()


let language = datapack.get({
  field: "name",
  value: "Nyaki Nyaki / Njaki Njaki",
  properties: ['name', 'languageCode']
});

And you will get only those (along with @id and @type which are always returned).

For Developers

Working on the package - writing tests

  • start elastic search docker container: docker compose up
  • Run the tests in watch mode: npm run test:watch

Updating the JSDoc documentation

  • npm run generate-docs
  • Then commit the docs and push to github

Adding a data pack to this repository

  • add a folder in the data-packs top level folder named as your data pack.
  • create an update script inside that folder named like: create-data-pack.js.
    • Your script should be self contained and retrieve the data it needs. That is, don't check a datasource into this repo if you can avoid it. Get it from the web so that the data pack is updated from the main version online. Whatever, and wherever, that is.
  • add a reference to that script in update-all-packages.sh so that your data pack is updated when the others are.
  • document the data structure by adding a file in your data pack folder called: datapack-entry-format.js. Follow the example in languages/datapack-entry-format.js.

Building and publishing an update

  • bash ./update_all_packages.sh
  • npm run generate-docs
  • Commit all of the changes
  • Bump the version: npm version minor
  • Push to github: git push origin master --tags
  • Publish npm publish