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

@devdiary/visual-review-tools

v1.2.0

Published

DevDiary Visual Review Tools

Downloads

3

Readme

Visual Review Tools

This is the repo for visual review tools. Someday this README will have more info. For information on the feature itself, check out the docs.

Development

This project is developed in vanilla Javascript only. Because we are asking our users to inject this toolbar into their application for review, it is important to keep things small and avoid dependencies on large scripts or other loads. As we continue to develop, we will revisit these decisions, but for now, plain JS it is!

However, in order to have some structure, we have designed a component-like system with a tiny event reducer and state object.

Components

Similar to the Vue components in our main repo, Visual Review components are developed in a single file with a template and related events functions. Templates consist of template strings that can be pasted into the DOM using insertAdjacentHTML. For instance:

const note = `
  <div id="${NOTE_CONTAINER}" style="visibility: hidden;">
    <p id="${NOTE}" class="gl-mb-0"></p>
  </div>
`;

Because insertAdjacentHTML inserts strings as HTML, this is a possible XSS vector. Do not paste unescaped user-provided content into this without escaping.

Event functions are grouped with the template that calls them. That's why, for instance, you will find logoutUser in comment.js.

Templates and actions that are referenced outside the components directory should be added to components/index.js so that users do not have to know the subfile from which to import things. This is important especially in a young app so that restructuring can happed behind the scenes, without consumers needing to know.

The same principle applies with sub-components (e.g. comment_mr_note) passing their functions through the main section module. When the file list starts looking complex, this can be reorganized into their own directory.

Constants

Because these is plain Javascript, we change components by referencing them via ID. This is a spot that's rife with errors, so please use shared/constants.js to render the string as a constant and create an access function. (You may wonder why it is a list of functions and not an object with getters/setters. It's because we cannot destructure imports and this way just the necessary accessor can be imported. Also Sarah really likes FP and hates OO.)

Events

Speaking of FP, we dispatch events using a poor-woman's reducer, found in store/events.js. Essentially, we have a single event listener on the form and this delegates to the necessary event using the event target. Be sure to make use of our friendly constants!

Testing Locally

Run yarn start in the root directory to start a webpack dev server. This uses a basic index.html file to test the javascript library.

By default, the dev server port is set to 8080. If you would like to change the port of the dev server, run DEV_SERVER_PORT=<port> yarn start instead.

Currently, the review app is tied to a test merge request: https://github.com/sarahghp/review-app-tester/merge_requests/1. This can be changed in the dev/index.html file.