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

happy-fe-tool

v2.0.4

Published

一系列 fe 工具集合

Downloads

10

Readme

happy-fe-tool

build status Test coverage NPM version NPM Downloads

一个方便自己使用的 fe 工具箱, 主要针对于一些基础工具的安装和配置

作为一个合格的程序员, 才懒得每新起项目就去 npm i xxx -D && ctrl+c & ctrl+v 呢 🌝

Install

[sudo] npm install happy-fe-tool -g

Usage

使用某个模板进行初始化, 使用 空格 进行选择

# init rules with tpl
happy init [tpl]

# options
-c, --config <dir>  设置配置信息的路径(默认在根目录)
-p, --package 将配置信息放入 package.JSON
-h, --help  获取帮助信息

单独添加某条规则或者某几条规则, 使用 -t 来添加模板, -y 使用默认的模板

# add single rule
happy add <rules...> [options]

# options
-t, --tpl <tpl>  指定模板
-y, --yes  使用默认的模板
-d, --dir [dir] 设置配置信息的路径,并把相关命令写在 package.json 中(没有配置 dir 默认在 happy-config)
-h, --help  获取帮助信息

examples:

## would let user select config
happy add prettier

## use baidu config
happy add codelint -t baidu

tools

nvm: Node Version Manager

把当前系统的 node 版本写入 .nvmrc

happy add nvm

prettier: An opinionated code formatter

prettier 的配置文件模板写入项目中, 配合编辑器使用味道最佳喔( can be run in your edictor on-save) ~

# 将 .prettierrc.js 放在根目录
happy add prettier

# 配置文件写入 package.json 中
happy add commitizen -d

prettier 主要为编辑器所用,所以配置文件最好放在跟目录喔~

commitizen

使用 commitizen 和配置好的 Adapters 来规范代码提交

# 将配置文件(.czrc, .cz-config.js) 放在根目录
happy add commitizen

# 默认将配置文件放在 ./happy-config 中, 且相关命令写在 package.json 中
happy add commitizen -d

# 将配置文件放在 ./custom-config 中, 且相关命令写在 package.json 中
happy add commitizen -d ./custom-config

自动增加 commit script

"scripts": {
    "commit": "git-cz"
},

Tips: 如果不习惯使用 npm run commit 来提交代码,可以全局安装 commitizen 使用 git cz 来提交。

changelog

使用 conventional-changelog-cli 来生成 change log,主要根据 commit 记录中的 type 生成

  • 默认使用 angular 的模板
  • baidu 模板下为自定义的结构 (tips;使用 baidu 自定义模板目前只支持内网环境)
happy add changelog

自动增加 changelog & version script

"scripts": {
    "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
    "version": "npm run changelog",
},

codelint

使用 fecs 来进行代码格式化,配合 husky & lint-staged 来做提交前的检查

TODO:

  • 配置 eslint 模板
# 将配置文件(.lintstagedrc, .fecsrc) 放在根目录
happy add codelint

# 默认将配置文件放写进 package.json 中
happy add codelint -d

自动增加 lint script

"scripts": {
    "lint": "fecs format --replace true && fecs check --level 2"
},

添加 pre-hook

# hooks
"husky": {
    "hooks": {
        "pre-commit": "lint-staged"
    }
}

# .lintstagedrc
{
    "*.{js, scss, css, html}": ["fecs format --replace true", "fecs check --level 2", "git add"]
}

跳过 hook 检查

# use npm script
npm run commit -- -n
# or use git cz
git cz -n

commitlint

test