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

@purtuga/project-showcase

v2.0.0

Published

Quickly add showcases to your library and provide the ability to generate a static site for them.

Downloads

7

Readme

Project Showcase

Quickly add showcases to your library and provide the ability to generate a static site for them.

Each showcase is added by calling the showcase() function with a callback that is called when that showcase is selected in the UI.

This library provides a set of Custom Elements that can be used to build the User Interfaces that then displays the showcases that were registered.

Install

$ npm i purtuga/project-showcase

To setup showcase on the project where it was just installed, run:

$ node ./node_modules/.bin/project-showcase-setup

This will create a folder named shocase at the root of the project. It will also do some dev setup if a folder named my.dev exists (project-base normally sets this up).

Dev setups

Once the project is setup for a showcase, adding the following script to your package.json may be desired:

{
    script: {
        "setup:dev:showcase": "node node_modules/project-showcase/scripts/create-dev"
    }
}

This will setup the my.dev folder to pickup showcases in dev mode.

Provided Methods/Elements

showcase() method

Registers a showcase.

import {showcase} from "showcase"

showcase("cool-button", function ($content){
    // build showcase
    
    $content.appendChild(showcaseNode);
    
    $content.onDestroy(() => {
        // clean up if needed when showcase is destroyed
    });
})

TODO: document method's signature/usage.

Element: showcase-menu

UI element will display the menu with all registered showcases.

<showcase-menu></showcase-menu>

This element emits the following events:

  • show : the showcase to display

Element: showcase-router

UI element that will initialize a page hash router. The router in turn updates the internal state by first clearing out the current state.selected showcase and then populating it with the new one that was selected.

Element: showcase-body

The UI element where the showcase should be displayed in. Will be given to the callback function provided to showcase() method.

<showcase-body></showcase-body>

This element has one required prop named showcase and it must be an object with the showcase information. (note: this is a "prop" not an html attribute).

Element: showcase-test-runner

The UI element where Unit Test Cases can be run from the browser.

<showcase-test-runner
    tests=[]
    auto-run?
    ></showcase-test-runner>

The Element accepts a tests prop (Array<String>) with a list of test files that should be loaded adn ran. These will be run in an iframe setup with Mocha, Chai and Sinon (different test harnesses possible in the future).

TODO

  • [x] Create script that allows this to be added to any existing project
  • [ ] Enhance showcase() function api
  • [ ] Create prettier app template
  • [ ] Create better menu system