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

@crisptickets/common

v1.0.4

Published

To publish a package to NPM, follow the steps below in the folder of the package: 1) npm init -y 2) change the "name" to "@<organization_name>/<package_name>" 3) git init -> git add . -> git commit -m "..." 4) npm login 5) npm publish --access public

Downloads

4

Readme

To publish a package to NPM, follow the steps below in the folder of the package:

  1. npm init -y
  2. change the "name" to "@<organization_name>/<package_name>"
  3. git init -> git add . -> git commit -m "..."
  4. npm login
  5. npm publish --access public

Since the shared libraries will be written in Typescript (and converted in JS before publishing them), you have to setup typescript with: tsc --init Then install typescript (install this dependencies only in DEV mode): npm install typescript del-cli --save-dev

--> Then you can create the typescript files of this library. Before publishing it, you need convert typescript files into javascript. Modify the 'scripts' in package.json as: "scripts": { "build": tsc // this will compile typescript to js } And you need to tell where to place the compiled js file obtained by the typescript source code. In the 'tsconfig.json', uncomment this properties: 1) declaration: true --> this will ensure to generate a type definition file while c converting typescript to js 2) outDir: ... --> set the js generated file in the 'build' directory

--> Whenever a change is made to the typescript file, you have to clean the "build" directory. Instead of doing it manually, you can use the "del-cli" package installed before. Add the "clean" script in package.json and specify the directory to remove when this command is run. Add that command to the "build" one

--> You have to make sure to specify the right file that is imported by the users that install this package. Since the typescript file is converted to js in the "build" directory, you have to change the "main" property (in 'package.json') to point to the file obtained while converting typescript to js (this is in the build/index.js) Then you also need to specify the TYPE DEFINITION file obtained by typescript. Do this in the "types" property (always in package.json). Then, the "files" property tells NPM to make sure to include the specified files inside the final publish version of this package.

Then add the .gitignore.

BEFORE PUBLISHING

  1. Add the changes to git + commit
  2. Increment the version of the package (manually or wih 'npm version patch')
  3. npm run build
  4. npm publish (just for this course a new script command is made to automate (1)->(4)) => DON'T DO THIS

FILES IN THIS PACKAGE All the custom errors and middleware (to check for authentication) are published in this file. In order for the user to be able to import a specific file from this package as: import { BadRequestError } from "@crispticket/common"

and not with the command: import { BadRequestError } from "@crispticket/common/error/bad-request-errors" you have to export all the files inside the 'index.ts'.

Then, since each of this file needs some libraries (like express, json-web-token) and so on, you have to install in this package all the libraries used by each of these files.