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

ro-crate-html

v0.1.4

Published

Research Object Crate (RO-Crate) utilities for rendering a html representation

Downloads

105

Readme

Research Object Crate (RO-Crate) HTML preview generation

This nodejs repository has code for generating HTML previews for Research Object Crates (RO-Crate)

RO-Crates are data packages consisting of a folder/directory of content with a JSON-LD manifest known as an RO-Crate Metadata File, which has the filename ro-crate-metadata.json in the root folder. RO-Crates also should have an RO-Crate Website which is a local set of web resources, with an index page ro-crate-preview.html.

This library consists of tools to create an RO-Crate Website for a crate, from the RO-Crate Metadata File.

There are two approaches to this:

  • rochtml is a script that creates an HTML page that summarizes the RO-Crate root dataset (which is always a Schema.org Dataset object expressed in JSONLD) and then dynamically renders details about other entities, both Data Entities (files, datasets and other local and remote streams of data) and Contextual Entities (addition information about data provenance such how files were created, by whom and where) described in the crate. This script creates a single, small HTML file.

  • rocsite is a script that creates a multi page RO-Crate Website using some confguration.

In most cases rochtml is the most appropriate tool unless the crate you are dealing with is very large (more than 5000 entities) or is largely made up of contextual entities such as historical events, people etc.

Install

To install this from npm type:

npm install ro-crate-html

Develop

To make changes to this code:

  • Download this repository:
git clone https://github.com/Arkisto-Platform/ro-crate-html-js
cd ro-crate-htmljs
  • Install it and link the commandline commands:
npm install .
npm link --local

Use Docker

Make a container:

docker buildx build -t rochtml .

Run the container:

docker run --rm -v ~/path/to/crate/:/data rochtml /data/ro-crate-metadata.json

Commandline HTML rendering

Dynamic, generic HTML for ANY crate

To render HTML for an RO-Crate, use rochtml:

rochtml test_data/sample-ro-crate-metadata.json

The script will create an HTML page:

test_data/sample-ro-crate-preview.html

The HTML page has a complete copy of the RO-Crate metadata file's JSON-LD content in a <script> element in the <head>, and references the compiled rendering script that can then dynamically generate web-views of the RO-Crate metadata: ro-crate-dynamic.js. This is available via the Content Distribution Network (CDN) UNPKG which uses the NPM repository: https://unpkg.com/ro-crate-html-js/dist/ro-crate-dynamic.js.

To compile the rendering script for an RO-Crate HTML file (ro-crate-preview.html):

browserify lib/entry.js -o dist/ro-crate-dynamic.js

Once this is published in NPM -- set scriptVersion in the defaults to match.

DEPRECATED: Create a multi-page site

To create a RO-Crate multi-page HTML website for a crate, use rocsite - this requires some fairly complicated configuration which is not yet documented, but you can look at an example in the Heurist2ro-crate project: https://github.com/UTS-eResearch/heurist2ro-crate

To compile the rendering script for the entry point to a multi-page HTML site RO-Crate HTML file (ro-crate-preview.html):

watchify lib/standAloneEntry.js -o dist/ro-crate-dynamic-multipage.js

See the MAKEFILE for a commands that reference an configuration file.

This will probably be removed in a future release.