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

@pigjs/fabric

v1.0.3

Published

A collection of configuration files including prettier, eslint, stylelint, husky, git hooks can automatically generate configuration files

Downloads

5

Readme

fabric

一个配置文件的集合,包含了 prettier, eslint, stylelint, husky, git hooks, 可以自动生成配置文件

安装

    npm i @pigjs/fabric -D
    // or
    yarn add @pigjs/fabric -D
    // or
    pnpm add @pigjs/fabric -D

使用

    // package.json 中配置命令
    {
        scripts:{
            "pig-fabric:install":"pig-fabric install"
        }
    }
    // 初始化 fabric,会自动生成 prettier, eslint, stylelint, husky, git hooks 的配置
    npm run pig-fabric:install

命令

  • install Example Initialize eslint PretTier Stylelint husky
  • commit-log git commit message standard
  • --hooks=pre-commit git pre-commit hooks
  • --hooks=pre-merge-commit git pre-merge-commit hooks
  • --hooks=commit-msg git commit-msg hooks

如果你使用的是 pnpm 的话,需要在 .npmrc 文件中增加一些配置

shamefully-hoist=true

vscode 配置保存自动格式化

在 settings.json 文件,配置自动保存和格式化

{
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
    "editor.formatOnSave": true
}

推荐团队成员使用相同的编辑器(如 VSCode)并共享编辑器设置。创建一个 .vscode 文件夹(如果尚不存在),并在其中添加一个 settings.json 文件,配置自动保存和格式化

如何自定义 git commit、git merge branch 校验规则

在项目根目录创建 .pigrc.js 或者 .pigrc.json 文件

/** 用户自定义配置 */
interface UserConfigProps {
    /** git 相关配置 */
    gitConfig?: {
        /** 校验commit */
        verifyCommit?: {
            /** 是否开启 */
            open?: boolean;
            /** 过滤掉msg */
            filterMsg?: string[];
            /** 校验的规则 */
            commitRE?: RegExp;
            /** 自定义校验 通过返回空 不通过 返回一个错误字符串,在终端打印 */
            customVerifyCommit?: (msg: string) => string;
        };
        /** 校验合并的分支 */
        verifyMergeBranch?: {
            /** 是否开启 */
            open?: boolean;
            /** 禁止合并的分支 */
            forbidMergeBranch?: string[];
            /** 自定义校验 true-允许合并 false-禁止合并 */
            customVerifyMergeBranch?: (branch: string) => boolean;
        };
    };
}