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

@tripphamm/trippkit

v1.6.0

Published

Common configurations for js/ts projects

Downloads

4

Readme

TrippKit

Common configurations and scripts for my js/ts projects

Disclaimer: This is really only built for personal use. I suggest forking and using it as inspiration if you like what's going on. I make no guarantees about breaking changes etc.

Install

yarn add -D @tripphamm/trippkit

Auto-generate all config files:

yarn run tk-bootstrap

In the future there will be a cute little CLI for selecting options. For now, you'll need to make a couple manual changes after bootstrapping.

  • if any configs or package.json scripts already existed, we didn't overwrite them. For the configs, we produced a config with .tk at the end and for the package.json scripts we prefixed the script name with tk-. Take a look at your own versions and compare them to the tk versions and then delete one of them.
  • we added both node and react eslint configs; open up .eslintrc.js and remove whichever one isn't appropriate.
  • we assumed that you wanted to publish to NPM so we added a release script, a .releaserc.js, and a .circleci/config.yml; remove all 3 if you're not shipping to NPM
  • if you are shipping to NPM, head over to CircleCI and enable the project

What's in the box

Commit Message Convention

We enforce a commit-message convention so that we can automatically create releases with nice release notes and deterministic version-bumps.

For simplicity, there are only 4 types of commits and they correspond directly to the type of version-bump that would be required.

  • Chore - some internal change that has no bearing on the exported artifacts / app (no version bump, no release)
  • Fix - a non-breaking bug fix (patch version bump, release)
  • New - a non-breaking new feature (minor version bump, release)
  • Breaking - a breaking change (major version bump, release)

e.g.

Chore: Update readme

Fix: Check for null before executing logic

New: Add Carousel component

Breaking: Remove bad API, add new API

Eslint

Enforce code quality best-practices

Depending on the project, extend react or node.

// .eslintrc.js

module.exports = {
  extends: [
    'plugin:@tripphamm/react',
    // or
    'plugin:@tripphamm/node',
  ],
};
// package.json

{
  ...
  "scripts": {
    ...
    "lint": "tk-lint"
  }
}

Prettier

Enable automatic code formatting

// .prettierrc.js

module.exports = require('@tripphamm/trippkit/configs/prettier');
// package.json

{
  ...
  "scripts": {
    ...
    "format": "tk-format"
  }
}

EditorConfig

Configure the editor to use the proper formatting by default

There's no way to "extend" an EditorConfig, so just copy/paste this content into a file called .editorconfig Issue

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

Semantic Release

Configure automated releases based on commit message

Setup

Env

The release process:

  1. Analyze commits to determine the next version number
  2. Write new version number to package.json
  3. Commit the version bump and tag that commit with the version
  4. Push that commit to GitHub
  5. Generate release notes based on the commit messages
  6. Publish the release notes on GitHub
  7. Publish the library on NPM

In order for this to work, we need write-access to GitHub and NPM. Therefore, GITHUB_TOKEN and NPM_TOKEN env variables must be defined in order for the release to work. You can add a .env file at the root of your project (remember to .gitignore!) if you want to publish locally. The env vars must be defined in the CI environment if you want CI to release.

// .env

// don't forget to .gitignore this file!

GITHUB_TOKEN = abcdefghijklmnopqrstuvwxyz
NPM_TOKEN = abcdefghijklmnopqrstuvwxyz
Config
// .releaserc.js

module.exports = require('@tripphamm/trippkit/configs/semantic-release');
Script

In the package.json, you can call tk-release in order to kick off the release process

// package.json

{
  ...
  "scripts": {
    ...
    "build": "your build script",
    "test": "your test script",
    "release": "yarn build && yarn test && tk-release"
  }
}

Lint-Staged

Enables us to run our auto-formatter and linter on staged files

// lint-staged.config.js

module.exports = require('@tripphamm/trippkit/configs/lint-staged');

Husky

Runs the auto-formatter and linter on staged files before commits. Also validates that the commit follows our commit message convention

//.huskyrc.js

module.exports = require('@tripphamm/trippkit/configs/husky');