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

hsu-scripts

v1.0.7

Published

CLI toolbox for common scripts for npm libraries.

Downloads

279

Readme

Hsu-scripts

CLI toolbox for common scripts for npm libraries.

Travis Codecov Status npm package npm downloads

prettier license

Install

$ yarn install hsu-scripts --dev
$ yarn install flow-bin eslint prettier --dev

Setup configs

Babel & Eslint

// package.json
{
  "babel": {
    "presets": ["./node_modules/hsu-scripts/babel.js"]
  },
  "eslintConfig": {
    "extends": ["./node_modules/hsu-scripts/eslint.js"]
  }
}

Prettier

// .prettierrc.js
const config = require('hsu-scripts/prettier.config');
module.exports = config;

Usage

// package.json
{
  "scripts": {
    "build": "hsu-scripts build src",
    "test": "NODE_ENV='test' jest",
    "eslint": "eslint ./",
    "flow": "flow",
    "flow-coverage": "hsu-scripts flow --threshold 85",
    "format": "prettier --write '**/*.{js,json,md,css,yaml,yml}' '*.{js,json,md,css,yaml,yml}'"
  }
}

Build

$ hsu-scripts build src
$ npm run build

> hsu-scripts build src

> rimraf es lib
> Done

> NODE_ENV='cjs' babel src --no-babelrc --config-file /hsu-scripts/.babelrc --out-dir lib --ignore **tests**,**/\*.test.js,**/\*.example.js
> Successfully compiled 13 files with Babel.

> NODE_ENV='es' babel src --no-babelrc --config-file /hsu-scripts/.babelrc --out-dir es --ignore **tests**,**/\*.test.js,**/\*.example.js
> Successfully compiled 13 files with Babel.

> flow-copy-source -i **tests** -i **/\*.test.js -i **/\*.example.js src lib
> Done

> flow-copy-source -i **tests** -i **/\*.test.js -i **/\*.example.js src es
> Done

Flow

$ npm run flow-coverage

API

hsu-scripts -h

hsu-scripts <command>

Commands:
  hsu-scripts build  The babel build command.
  hsu-scripts flow   The flow-coverage-report command.

Options:
  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]

For more information go to https://github.com/evenchange4/hsu-scripts

hsu-scripts build -h

Usage: hsu-scripts build <pattern> [options]
<pattern> Glob pattern to specify files.

Options:
  --es-dir    Output es module directory.               [string] [default: "es"]
  --cjs-dir   Output commonjs module directory.        [string] [default: "lib"]
  --ignore    The list of glob paths to **not** compile
               [array] [default: ["__tests__","**/*.test.js","**/*.example.js"]]
  -h, --help  Show help                                                [boolean]

Examples:
  hsu-scripts build src                          Simple example
  hsu-scripts build src --es-dir esm             Custom es module directory
  hsu-scripts build src --cjs-dir 'cjs'          Custom commonjs module directory
  hsu-scripts build src --ignore '__specs__' '**/*.spec.js'

hsu-scripts flow -h

Usage: hsu-scripts flow [options]

Options:
  --concurrent-files                                       [number] [default: 5]
  --include-glob                                  [array] [default: ["**/*.js"]]
  --exclude-glob                                               [array] [default:
  ["node_modules/**","public/**",".next/**","coverage/**","storybook-static/**",
                                              "flow-typed/**","lib/**","es/**"]]
  --type                                             [array] [default: ["text"]]
  --threshold                                             [number] [default: 90]
  -h, --help          Show help                                        [boolean]

Examples:
  hsu-scripts flow                 Simple example
  hsu-scripts flow --threshold 75  Custom threshold value

For more information go to https://github.com/rpl/flow-coverage-report

Development

  • node 11.10.0
  • yarn 1.13.0
$ yarn install --pure-lockfile

Test

Use tools to build/flow itself.

$ yarn run build
$ yarn run flow-coverage
$ yarn run test:watch
$ yarn run format
$ yarn run eslint

Example library

  • https://github.com/evenchange4/hsu-scripts
  • https://github.com/evenchange4/react-overlay-pack
  • https://github.com/evenchange4/remark-utils
  • https://github.com/evenchange4/imagemin-simple
  • https://github.com/evenchange4/react-input-files
  • https://github.com/evenchange4/react-dnd-dropzone
  • https://github.com/evenchange4/apollo-link-log
  • https://github.com/Mediatek-Cloud/mcs-ui
  • https://github.com/evenchange4/michaelhsu
  • https://github.com/evenchange4/graphql.macro
  • https://github.com/evenchange4/react-intl.macro

Publish

$ npm version patch
$ npm run changelog
git commit & push

CONTRIBUTING

  • ⇄ Pull requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.
  • Pull requests must be accompanied by passing automated tests.

CHANGELOG

LICENSE