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

@zajno/common

v2.3.7

Published

Zajno's re-usable utilities for JS/TS projects

Downloads

1,748

Readme

Zajno's Toolbox

Coverage Status

This is a library with a useful utils/helpers to share across our projects.

Doesn't pretend to be useful in outer world because probably everything is invented, tested and released to NPM already.

The motivation to have this – just to control and organize some shared code that we ever wanted to write by ourselves.

...and other more or less noteworthy stuff.

The source code is written in TypeScript, and intended to be used in TS project, so no built JS sources included.

Usage

It can be used a git submodule if you're brave enough, but it's possible to use it as npm package (kinda) as well. In your project:

  1. Install from NPM:
npm i @zajno/common

tslib is the only peer dependency.

  1. In your code, use each module separately:
import logger, { ILogger } from '@zajno/common/logger';

Note on imports in v1

Previously one had to import from like @zajno/common/lib/logger since compiling had been doing at postinstall time so Typescript with its config was a peer dependency. Currently it's not the case and this packages is provided with build artifacts (js + d.ts + source maps); so no need to include /lib part in imports anymore.

Although install time has been decreased, the main downside is that sources are built being targeted on CommonJS & ES2019+ (for now!). This might be not always suitable and/or optimal for all build setups.

Local development

If you plan to update the sources while using it in your project, we'd recommend using yalc. It does some magic to allow both using it in your project and updating it.

The flow will look like the following. [1] – operations made on this project, [2] – operations made on dependant project.

  1. install yalc globally
  2. [1] fork (if you're outside Zajno) and clone this project, do npm i
  3. [1] run yalc publish --private
  4. [2] run yalc add @zajno/common && npm i
  5. [1] make changes in local copy, run tests etc.
  6. [1] run some magic: npm run push:local – this should deliver your updated copy to local project(s) [2]
  7. [2] notice the changes in your project, repeat 5-7 until you're done
  8. [2] to cleanup, run yalc remove @zajno/common or just yalc remove --all
  9. [1] push your changes after making sure it's OK, we'd say thank you for a PR!
  10. [2] re-add the package into your project or specify tag/commit (e.g. npm upgrade @zajno/common)