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

cdk-stackutil

v1.0.0

Published

CDK utility package meant to simplify the process of creating resources.

Downloads

4

Readme

PackageStarter

Boilerplate repo that serves as a starting point when writing new NPM packages. This repo is setup for development and testing to be done in Typescript.

Setup

  1. Fork this repo into a new repository.
  2. Clone down the repo and update the following fields in "package.json":
    • name
    • description
  3. Run npm install in your terminal to pull down all dependencies.
  4. Done! Get to work ;)

Development

Development is done in Typescript, that is then compiled into plain NodeJS targetting the latest Ecmascript specification.

/src & index.ts

The entry file in this repo is /src/index.ts. Add any aditional folders or files necessary inside the src folder, and expose the necessary code by exporting it from index.ts.

/src/__tests__

Unit tests should be placed inside this folder, with files named the same as the source file they are testing, but changing the extension from .ts to .test.ts. Thus, a file containing unit tests for index.ts should be named index.test.ts.

We'll be writing our unit tests with Jest, which is included in the repo. Here is an example of how a test might look:

/** 
 * index.test.ts
 *
 * Testfile that runs unit tests for src/index.ts
 */
import { sum } from '../index'

describe('index.ts', () => {
	test('Sum', () => {
		expect(sum(2, 2)).toBe(4)
	})
})

Publishing

The publish script defaults to publishing as private. If you want to publish something as public, make sure to use the following script:

npm publish --access=public.

Before publishing, make sure you have added the proper version to package version by using the version script.


Scripts

These are some scripts to make development, testing and publishing of libraries easier:

Test

npm run test Will run all unit tests in the repo and display results in the terminal.

Build

npm run build will compile all of your typescript into the lib folder.

Watch

npm run watch will rebuild your code into the lib folder as changes in the code take place.

Lint

npm run lint will go through your code and alert you of any syntax that doesn't follow the established styleguide.

Version

npm version <patch | minor | major> will add a new patch, minor or major version to package.json

Publish

npm run publish publishes your package to NPM.