GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - FE-CodeGenius/codegenius-git-user-plugin: 设置或校验 git user 信息是否规范

BranchesTags
Open more actions menu

Latest commit

 

History

9 Commits
9 Commits

Folders and files

NameName
Last commit message
Last commit date
scripts
scripts
 
 
src
src
 
 
.eslintrc.json
.eslintrc.json
 
 
.gitignore
.gitignore
 
 
.npmrc
.npmrc
 
 
.release-it.js
.release-it.js
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
codeg.config.mjs
codeg.config.mjs
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
rollup.config.mjs
rollup.config.mjs
 
 
scripts.config.json
scripts.config.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

@codegenius/git-user-plugin

设置或校验 git user 信息是否规范, 支持命令模式和 API 模式;

使用场景: 用于校验那些不应该出现的邮箱地址会名称出现在 git 提交记录中, 常见的使用公司内部邮箱提交 github 的开源项目, 这通常是不允许的.

安装

npm i @codegenius/git-user-plugin -D
import { defineConfig } from "code-genius";
import { gitUserInstaller } from "@codegenius/git-user-plugin";

export default defineConfig({
  plugins: [
    gitUserInstaller({
      ruleEmail: "^[a-zA-Z0-9._%+-]+@(gmail)\\.(com)$",
    }),
  ],
});

使用

命令模式

# 在默认规则下设置 email 信息
codeg gituser -e [email protected]

# 在指定规则下设置 email 信息
codeg gituser -e [email protected] --rule-email '^[a-zA-Z0-9._%+-]+@(qq)\.(com)$'
# 在默认规则下校验 user 和 email 信息
codeg gituser

# 在指定规则下校验 user 和 email 信息
codeg gituser --rule-email '^[a-zA-Z0-9._%+-]+@(qq)\.(com)$'
选项 描述
-n, --name <name> 设置 user.name
-e, --email <email> 设置 user.email
--rule-name <regexp> 设置 user.name 匹配规则(转义字符串)
--rule-email <regexp> 设置 user.email 匹配规则(转义字符串)
  • --rule-name 默认 : [\s\S]*
  • --rule-email 默认 : ^[a-zA-Z0-9._%+-]+@(163|qq|126|139|sina|sohu|yeah|gmail)\.(com|net)$

API 模式

import { setGitUserName, setGitUserEmail, checkGitUserInfo } from "@codegenius/git-user-plugin";

(async () => {
  await setGitUserName("OSpoon", "[\\s\\S]*");
  await setGitUserEmail(
    "[email protected]",
    "^[a-zA-Z0-9._%+-]+@(gmail)\\.(com)$"
  );
  await checkGitUserInfo("[\\s\\S]*", "^[a-zA-Z0-9._%+-]+@(gmail)\\.(com)$");
})();

About

设置或校验 git user 信息是否规范

Resources

Readme
MIT license
Activity
Custom properties

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.