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

@acm-widgets/testthree

v1.0.0

Published

This is a template to build a widget for the [ACM Widgets](https://github.com/me-julian/acm-widgets) challenge conducted at [Austin Code Mentorship](https://www.meetup.com/austin-code-mentorship/).

Downloads

3

Readme

Widget Template for acm-widgets

This is a template to build a widget for the ACM Widgets challenge conducted at Austin Code Mentorship.

It's intended as a simple coding exercise for two or more people to work on together and finish in a short period of time.

Widget Ideas

Here are some ideas for what you could build:

  • Automatically pair attendees for mentorship or generally following up after ACM that month
  • Mini-profiles for attendees
  • Carousel/slider of other meetups/events
  • Form to add attendees to the database
  • Countdown to next ACM meet
  • Generate a QR Code that leads somewhere useful like the Meetup or Slack pages.
  • Build an animated/interactive logo for ACM, maybe even using Three.js
  • Use Speech-To-Text to automatically catalog attendees and their interests from their introduction

Prerequisites

Getting Started

Overview

You are given a ~500x400px box on the page in which you can build your widget.

This project is built so all widgets can be built independently, published to NPM, and imported into the main repo/site with minimal changes.

This is all handled by the project setup for you, but pay attention to the instructions for where and what changes you should make when building your widget.

Also be mindful of what you check into source control and publish to NPM. Don't share or hardcode personal information, tokens, or any other sensitive data.

A basic Prettier auto-formatting config is provided (/.prettierrc). Enabling format on save is recommended. It may be best not to use it unless everyone working on your widget does.

Instructions

  1. Clone this template repository.

Click the green "Use this template" button in the top-right of the repo's Github page and create your own repo.

If you have any collaborators, decide who will clone the repo, then make sure you go to your repo's Settings > Collaborators > Add people and invite them so they can make changes.

  1. If you want your widget to be imported into the main site for demonstration, follow the instructions in Publishing to NPM.

  2. Run npm install

  3. Run npm run dev:backend and npm run dev:frontend in separate terminals to start the dev servers.

  4. Open localhost:5173 to view the site.

  5. Edit files in /frontend/src/widget to work on the frontend and add API route handlers in /backend/router.js on the backend.

More details below.

Important Project Structure

Files/directories wrapped in ** ** are safe to edit.

├── backend
│ ├── api.js
│ ├── db.js
│ ├── **router.js** # All of your API endpoints go here
├── frontend
│ ├── src
│ ├───── **widget** # All of your frontend code goes here
│ │ │ ├── Widget.jsx
│ │ │ ├── widget.css
│ │ ├── App.jsx
│ │ ├── App.css
│ │ ├── main.jsx
│ ├── index.html
├── .prettierrc # Auto-formatting, recommended if everyone uses it.
├── config.js # Shared frontend & backend config
├── index.js # Exports your code when publishing on NPM
├── package.json
└── vite.config.js

Tech Stack Details

Frontend

The frontend is written using vanilla ReactJS using Vite. There is a copy of the site for testing, but you will build your widget in the /frontend/src/widget folder. A basic example component is provided.

Don't rename the Widget component and make sure everything you make or change is within that component.

When making calls to the backend, use the apiUrl prop passed to your Widget as the base of your url. Example:

const response = await fetch(`${apiUrl}/users/1`, options);

The init.js script will ensure your routes don't conflict with anyone else's.

Styling

The project uses standard CSS. The provided styling is written using the Block Element Modifier method, but this method is specifically made to be modular so you should be able to add styles however you like without much worry.

Please keep your widget contained within its grid container.

Backend

The backend is comprised of an Express.js REST API server and an in-memory SQLite database.

api.js and db.js are mostly mirrors of those in the main repository. You shouldn't make any changes here.

REST API

Add all of your API endpoint handlers in router.js. Feel free to use any endpoint urls, your router will be separate from everyone else's. A couple example POST endpoints are already provided.

Database

I didn't have time to build a robust system for the database, so you can access the shared in-memory sqlite3 database inside widgetDb.js.

You will likely break things if you change the schema of the attendees table or attempt to create a table with the same name as another group.

As such, I recommend adding a unique suffix to all tables based on your package name in order to avoid conflicts. If you want a more substantial attendees schema, you should create your own.

Publishing to NPM

Publishing to NPM will allow us to show all of the widgets together on the same page, even during development! It should only take a few simple steps.

  1. Create/log in to your NPM account

Only do this on a trusted machine. This will authenticate your local NPM installation to act as this user.

Run npm adduser, which should prompt you to log in/sign up via your browser.

  1. Have Julian invite your account to the @acm-widgets organization

  2. Initialize your package

In the root of the project, run node init.js and pick a unique, all lowercase, alphabetic widget name. This will automatically replace the name throughout the project and prepare the package for publishing.

  1. Publish the package

Run npm publish --access public, and your local code will be published to NPM! Now the package can be imported into the main repo.

  1. Update your package

If you want to re-publish/update your package, run npm version major to increment your version number and then re-run npm publish --access public.

Using 'major' suggests breaking backwards compatability, which is the safest option.

Note that you need to sync your git repository with origin in order to update and publish.