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

@digitalcredentials/dibiho-context

v1.0.0

Published

NPM package for the DiBiHo JSON-LD context.

Downloads

2

Readme

DiBiHo Context (@digitalcredentials/dibiho-context)

Node.js CI NPM Version

NPM package for the DiBiHo JSON-LD context.

Table of Contents

Background

For use with JSON-LD document loaders (such as jsonld-document-loader).

Install

Requires Node.js 14+

npm install @digitalcredentials/dibiho-context

Usage

import dibihoCtx from '@digitalcredentials/dibiho-context';
// or
const dibihoCtx = require('@digitalcredentials/dibiho-context');
const {contexts, constants} = dibihoCtx;

dibihoCtx.CONTEXT_URL_V1_1
// 'https://dibiho.org/contexts/openHPI/'

// get context data for a specific version of the context
dibihoCtx.CONTEXT_V1_1
// full context object

This package can be used with bundlers, such as webpack, in browser applications.

API

The library exports an object with the following properties:

  • CONTEXT_URL_V1_1: the url for the dibiho context
  • CONTEXT_V1_1: the full context object
  • constants: A Object that maps constants to well-known context URLs.
  • contexts: A Map that maps URLs to full context data.

Developing

You may want to edit the existing context, add a new version of the context, or add another URL-to-context mapping.

Edit existing context

Make your changes to:

js/context_v1_1.js

Be careful, though, because if someone has used your old context to sign an LD-proof, updating the context will break verification if the verifier uses the updated context.

You may want to instead add a new version of the context.

Add a new version of the context

Add a new context file. Follow the naming convention used with the existing context file(s). So, for example, to add v1.2, add a context file called context_v1_2.js. You'll also want to another url-to-context mapping for your new version

Add another URL-to-context mapping

Anytime you add a new version of your context file you'll want to add a new url for your context. You may also want to add an additional URL or URLs for an existing context version.

Either way, add another property (for each new url-to-context mapping) to the exported object of the 'js/constants.js' file. Follow the example of the existing properties.

Also add the property to the exported object of index.js (yes, we duplicate them - by convention?)

Update the tests:

Adjust the tests in context.spec.js to use the constants that you're exporting.

Update the rollup (commonjs) export in rollup.config.js

Make sure the 'namedExports' section in rollup.config.js lists everything (and nothing more) that you are exporting from js/index.js, like this example:

plugins: [
    commonjs({
      // explicitly list exports otherwise only have 'default'
      namedExports: {
        'dist/context.js': [
          'contexts', 'constants', 'CONTEXT_V1_1', 'CONTEXT_URL_V1_1'
        ]
      }
    })
  ]

Publish to NPM

Once your made your changes and your tests are passing (npm test), you'll want to publish to NPM.

You should first take the advice given here: creating-and-publishing-scoped-public-packages.

and try to install your package locally with:

npm install full-path-to-your-dibiho-package-directory

If all goes well, then bump the version number and publish as explained here:

updating-your-published-package-version-number

All together, though, you'll want to:

cd /path/to/package
npm version <update_type>  
npm publish --access public

NOTE: replace <update_type> with one of the semantic versioning release types - patch, major, or minor.

This of course assumes that your npm user is registered to publish to @digitalcredentials or to @digitalcredentials/dibiho-context

And if you haven't already, you may need to create your npm user account and/or login, as explained here

License