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

@scientist-softserv/webstore-component-library

v0.1.24

Published

A React component library intended for use with WebStore applications

Downloads

262

Readme

WebStore Component Library

A React component library intended for use with WebStore applications.

Table of Contents


How To Install This Library

yarn add @scientist-softserv/webstore-component-library
# OR
npm install @scientist-softserv/webstore-component-library

Getting started

NPM version

Use NPM version v8.19.2 and please do not mix it with Yarn.

Running the app

  • Start the app using:
    npm i # installs any new packages
    npm run storybook # starts the storybook app so that we can view/test the components in a UI
  • A new browser tab will automatically open to "http://localhost:6006/"

Troubleshooting

  • If you see the following when starting the app:
    • Error: error:0308010C:digital envelope routines::unsupported
    • set the following env variable in your local shell: export NODE_OPTIONS=--openssl-legacy-provider

Contributing

File Structure

  • Components (including those in the "compounds" folder) and stories should be PascalCase
  • CSS files should be kebab-case
  • A component that uses HTML elements, but not other named components, belongs in "src/components"
  • A component that uses one or more other named components belongs in "src/compounds"
  • Use the default imports when importing components into one another
    • e.g. "import Component from '../Component/Component'" and NOT "import { Component } from '..'"
  • All components are named .jsx files that live within a folder of the same name. The corresponding css file and story/stories should also be in this folder
    • e.g.
      • ComponentA
        • component-a.css
        • ComponentA.jsx
        • ComponentA.stories.jsx

Running tests

This code implements the StoryBook test runners. Use the appropriate command below to run tests.

# run tests locally
npm run test-storybook

# run tests against the deployed storybook
#TODO

Linting

This code is using ESLint to handle formatting. Use the appropriate command below to check formatting.

# run the entire application
npx eslint "./**"

# run a single file
npx eslint <path-to-file>
e.g.: npx eslint src/components/Button/index.jsx

# run a single folder
npx eslint "<path-to-folder>/**"
e.g.: npx eslint "src/components/**"

# run and fix errors
append `--fix` to any of the commands above
e.g.: npx eslint src/components/Button/index.jsx --fix

Using Icons

This project uses fontawesome's free solid icons. An icon library that explicitly states the react imports for all icons in use is defined at src/assets/fontawesome.js. If you need to add additional icons for use in a component or compound, you must import/export them in this library file.

  1. Using the link above, find the name of the icon you want to import (e.g.: "circle-user").
  2. Convert the name of the icon into a camelcase variable, appending "fa" to it.
    # fontawesome.js
    import { ..., faCircleUser } from '@fortawesome/free-solid-svg-icons'
    
    library.add(..., faCircleUser)
  3. Use the string name of the icon in your component, also with "fa" appended to the beginning
    # Component.js
    import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
    
    const Component = () => (
      // not appending "fa" will work, but we defer to using it since that's how the icon will show up in the inspect tool
      // which aids with consistency of variable names and future debugging
      <FontAwesomeIcon icon='fa-circle-user' />
    )

Troubleshooting Icons

  • If the expected icon doesn't show up, use the link provided above to search for it again. Click on the icon and confirm that the string in the example matches the camel cased variable that was imported and the string that was used with the "icon" prop.

Building the library

We are using Rollup JS to build and publish the library. The scripts will build based on the contents of "src/index.js" so make sure that any newly created components are referenced in the appropriate "components/index" or "compounds/index" files.

npm run build-lib # use when you want to build the library for publishing
npm run watch-lib # use when you want to build the library for local use; it will watch for changes. it may take up to 30 seconds to reflect a change though

Cutting a New Release

A git tag should exist for every semver release. We use release-it to automate the coordination of package.json and git tag.

  1. run npm run release. You'll be entered into an interactive session with the following prompts:

    ? Select increment # You will be prompted to select a release type, e.g. patch
    ? Publish @scientist-softserv/webstore-component-library to npm? # Yes
    ? Please enter OTP for npm: # This is stored in 1password under "npmjs"
    ? Commit (chore: release vX.X.X)? # Yes
    ? Tag (X.X.X)? # Yes
    ? Push? # Yes
  2. When the above completes, create the release notes.

    • Choose the tag that was just released
    • Set the title of the release to be the newly released version
      • e.g. "0.1.16"
    • Click the "Generate release notes" button above the text field
    • Click the "Publish release" button beneath the text field

Authors and acknowledgment

Alisha Evans

License

MIT

Project status

WIP