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

@spudnik/core

v0.0.9

Published

Utilities such as components, contexts, and more for cross project development

Downloads

518

Readme

Spudnik Library Monorepo

This repository houses a collection of reusable tools and utilities specifically designed for the needs of Spudnik. The goal is to provide a centralized, consistent, and efficient way to manage common functionalities across different projects within the company.

Workspaces

  1. @spudnik/components
  • A collection of reusable React components used across various Spudnik projects.
  1. @spudnik/contexts
  • Contains React context providers and hooks that manage shared state and behaviors within the application.
  1. @spudnik/hooks
  • A set of custom React hooks that encapsulate reusable logic.
  1. @spudnik/utils
  • A collection of utility functions and helpers that provide common functionalities across the other packages.

Tools and Configuration

Lerna

Lerna is used to manage the monorepo, handle package versions, and run scripts across the different workspaces. Below are some useful scripts:

  • Build All Packages:
npm run build:all # build all packages in monorepo
  • Build Specific Package
npm run build:components # replace 'components' with the desired package name to build
  • Deploy Specific Package
npm run deploy:components # replace 'components' with the desired package name to deploy

Rollup

Each package is bundled identically using Rollup with the following configuration:

  • Input: src/index.ts
  • Output:
    • CommonJS: dist/index.js
    • ES Module: dist/index.esm.js
  • Plugins:
    • rollup-plugin-terser: Minifies the output files.
    • rollup-plugin-peer-deps-external: Excludes peer dependencies from the bundle.
    • @rollup/plugin-node-resolve: Locates modules using the Node resolution algorithm.
    • @rollup/plugin-commonjs: Converts CommonJS modules to ES6, so they can be included in a Rollup bundle.
    • rollup-plugin-typescript2: Integrates TypeScript into the Rollup build.
    • rollup-plugin-postcss: Processes CSS with PostCSS.

Typescript

All packages are written in TypeScript. The root tsconfig.json provides a base configuration that is extended by each workspace. Type declarations are generated and stored in the dist directory during the build process.

Manual Deployment

To deploy a package, manually increment the version number in the package.json file of the workspace you want to deploy. Then run the appropriate deploy script:

npm run deploy:components # replace with applicable package name

Managing Dependencies

Dependencies

  • This should rarely (if ever) be used. More often peerDependencies or devDependencies should be used. The option should be often left up to the project manager as to what

Peer Dependencies

  • peerDependencies will not be included in the final bundle of the javascript. When the library is installed, it will check to see if a compatible version of peer dependencies are installed and install them if not.
  • For this reason, this works well for dependencies such as other libraries, React, Next, and other large ones that should not be included inside of the bundle

Dev Dependencies

  • Root package.json
    • Dependencies included here should be applicable to config, deployment, or are required for all packages.
    • Including a dependency here will bundle it into the output javascript which will cause the size of all packages to grow.
  • Project package.json
    • This should be used for a dependency that is intended to be built into the library. By putting it here, it will cause the dependency to be built into the bundled code so that it is not required to be installed in the library that it is used in
    • A large library such as React or another Component library should be in peerDependencies instead.