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

setup-pkg

v1.1.0

Published

Quickly set up an npm package in one command.

Downloads

2

Readme

setup-pkg

A command-line tool to initialize a node module project.

The project will create a new directory with git (including a gitignore), prettier, and yarn set up. Think yarn init but with some treats.

Usage

Usage
    $ setup-pkg <project_user> [name] [options]

  Options
    -t, --typescript          Initialize the package with typescript set up
    -b, --bitbucket           Initialize the repo with pointing at Bitbucket instead of GitHub
    --exclude-ava             Exclude Ava installation and configuration
    --exclude-prettier        Exclude Renddslow's opinionated prettier setup
    -v, --version             Displays current version
    -h, --help                Displays this message

API

project_user

  • Type: string
  • Required: ✅

project_user is either the owner of the repo, or the owner combined with the repo name, delimited by a slash.

Given:

https://github.com/Renddslow/setup-pkg

Both Renddslow and Renddslow/setup-pkg would be valid project_user values.

name

  • Type: string
  • Required: ❌

name is the repo and module name of the project. If a full owner and repo name is provided under project_user, this should be omitted.

Given:

https://github.com/Renddslow/setup-pkg

setup-pkg would be a valid name value.

Options

-t, --typescript

Initialize the package with typescript set up. This will include @types/node, ts-node, and typescript as dev dependencies. It will also set-up a tsconfig with the following configurations:

{
    "compilerOptions": {
        "declaration": true,
        "declarationDir": "./dist",
        "outDir": "dist",
        "target": "es2018",
        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,
        "moduleResolution": "node",
        "module": "commonjs",
        "baseUrl": ".",
        "resolveJsonModule": true
    },
    "paths": {
        "*": ["node_modules/*"]
    },
    "include": ["src/**/*"],
    "exclude": ["node_modules"]
}

-b, --bitbucket

Initialize the repo with pointing at Bitbucket instead of GitHub. By default, the setup script will setup a git origin pointing at GitHub.

--exclude-ava

Exclude Ava installation and configuration.

By default Ava is configured in the package.json with the following settings:

{
    "ava": {
        "files": [
          "src/**/*.test.ts"
        ],
        "concurrency": 4,
        "timeout": "1m",
        "babel": false,
        "compileEnhancements": false,
        "extensions": [
          "ts"
        ],
        "require": [
          "ts-node/register"
        ]
    }
}

--exclude-prettier

Exclude Renddslow's opinionated prettier setup.

By default the package.json has lint-staged and husky setup to run prettier pre-commit.

{
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{js,css,json,md,ts,tsx}": [
      "prettier --write"
    ]
  }
}

In addition, it uses @dmsi/prettier-config which contains the following settings:

{
    "singleQuote": true,
    "trailingComma": "all",
    "arrowParens": "always",
    "useTabs": false,
    "tabWidth": 2,
    "printWidth": 100
}