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

spotlight-frontend

v4.3.5

Published

Exhibits plugin for blacklight

Downloads

304

Readme

spotlight

CI | Gem Version | Release Notes | Design Documents

Spotlight is open source software that enables librarians, curators, and other content experts to easily build feature-rich websites that showcase collections and objects from a digital repository, uploaded items, or a combination of the two. Spotlight is a plug-in for Blacklight, an open source, Ruby on Rails Engine that provides a basic discovery interface for searching an Apache Solr index.

Read more about what Spotlight is, our motivations for creating it, and how to install and configure it in the wiki pages. You might also want to take a look at our demo videos, especially the tour of a completed Spotlight exhibit and the walkthrough of building an exhibit with Spotlight.

Requirements

  1. Ruby (2.7 or greater)
  2. Rails (5.2 or greater)
  3. Java (7 or greater) for Solr
  4. ImageMagick (http://www.imagemagick.org/script/index.php) due to carrierwave

Installation

To bootstrap a new Rails application:

$ SKIP_TRANSLATION=1 rails new app-name -m https://raw.githubusercontent.com/projectblacklight/spotlight/main/template.rb

or from an existing Rails application:

$ SKIP_TRANSLATION=1 rails app:template LOCATION=https://raw.githubusercontent.com/projectblacklight/spotlight/main/template.rb

During this process you will be prompted to enter an initial administrator email and password (this is a super-admin that can administer any exhibit in the installation). If you choose not to create one, the first user will be given administrative privileges.

Change directories to your new application:

$ cd app-name

Run the database migrations:

$ SKIP_TRANSLATION=1 rake db:migrate

Start Solr (possibly using solr_wrapper in development or testing):

$ solr_wrapper

and the Rails development server:

$ rails server

Go to http://localhost:3000 in your browser.

Configuration

Default ActionMailer configuration

Spotlight introduces functionality that depends on being able to send emails to exhibit curators and contacts. Be sure to configure your application's environments appropriately (see the Rails Guide for Action Mailer Configuration).

See the Spotlight wiki for more detailed information on configuring Spotlight.

Developing Spotlight

Spotlight:

  • is a Rails engine and needs to be used in the context of a Rails application. We use engine_cart to create an internal test application at .internal_test_app/
  • uses Solr as part of its integration tests. We use solr_wrapper to manage the Solr instance used for development and test.

Our $ rake ci and $ rake spotlight:server tasks utilize Solr and the testing rails app automatically.

See more detailed instructions for development environment setup at "Contributing to Spotlight"

With Docker

# because of how docker compose handles named images, running `docker compose up --build` will error when the Rails images have not been built locally
docker compose build
docker compose up

Tests

Run all the tests:

$ rake

This utilizes Solr and the testing rails app automatically.

Translations

Spotlight ships with i18n-tasks to help manage translations. To run a translation health check:

$ bundle exec i18n-tasks health

See developer-facing instructions for enabling translation on the wiki.

Community

  • Join us on the code4lib Slack
    • #spotlight-development - a developer-focused channel for Spotlight
    • #blacklight - a developer-focused channel for discussing implementation, customization, and other software concerns in the larger Blacklight community
    • #spotlight-service - a service-focused channel for people who support exhibit-builders at institutions already using Spotlight
  • Google Groups

Updating the JavaScript bundle

The JavaScript is built by npm from sources in app/javascript into a bundle in app/assets/javascripts/spotlight/spotlight.js. This file should not be edited by hand as any changes would be overwritten. When any of the JavaScript components in the gem are changed, this bundle should be rebuilt with the following steps:

  1. Install npm
  2. Run npm install to download dependencies
  3. Run npm run prepare to build the bundle
  4. If you are releasing a new version of the gem, follow the release instructions below.

Releasing a new version and publishing the JavaScript

You only need to update package.json and prepare/publish the JavaScript package for npm if there are changes to the JavaScript.

  1. Edit version.rb and package.json to set the new version
  2. Run npm run prepare to build the JavaScript bundle
  3. Run npm i --package-lock-only to update the version in package-lock.json
  4. Commit the changes e.g. git commit -am "Bump version to X.X.X"
  5. Push the release to rubygems and GitHub: bundle exec rake release
  6. Run npm publish to push the JavaScript package to https://npmjs.org/package/spotlight-frontend

See "Updating the JavaScript bundle" above for more details.