GithubHelp home page GithubHelp logo

six-ben / web-norm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lyh0371/web-norm

0.0 0.0 0.0 2.75 MB

简化前端项目规范构建(希望它不是个玩具)

Shell 0.34% JavaScript 35.93% TypeScript 57.80% HTML 1.15% Vue 4.77%

web-norm's Introduction


web-norm

GitHub stars GitHub forks

新坑推广🔥🔥

vv-react-table(虚拟列表解决方案) 欢迎使用😚

初衷

每当接手一个新项目(如果项目中没有配置 eslint husky commitlint)等这些规范的话,就需要自己手动配置一遍,配置多了后我只能来句窝草!😬

目标

一个命令自动化配置项目规范

你将得到

  • 保存代码自动格式化💯
  • 提交前 commit 校验💯
  • eslint + pretter 校验💯
  • husky 自动装载💯
  • 说吧,你还想要啥...

安装

1 局部安装(推荐使用)

npm install web-norm -D | yarn add web-norm -D | pnpm install web-norm -D

在 package.json 中

 "scripts": {
    "web-norm": "web-norm",
  },
  1. 全局安装
npm install web-norm -g | yarn add web-norm -g | pnpm install web-norm -g

使用

运行命令

请确保您的项目使用了git,否则会导致`husky`不生效
npm run web-norm

支持配置

web-norm 默认在提交记录上为带表情符号 📦👷📝🌟🐛🚀🌠🔂💎🚨 。如果不喜欢这些表情符号的话可以在用 web-norm 初始化项目的时候加上 --noEmoji 去掉

 "scripts": {
    "web-norm": "web-norm --noEmoji",
  },

验证

代码提交前校验

npm run commit

在老项目中使用

在老项目使用会牵扯到一个问题就是以前的代码规范和通过web-norm生成的代码规范不一致怎么办?

1、如果项目比较小,只有几个文件,你可以把所以的文件都保存一遍即可(保存的时候 vscode 会自动格式化代码,确保使用 vscode 编辑器并安装 eslint 和 pretter 插件)

2、如果项目比较大,建议使用 vscode 插件Format Files进行自动化保存

可能遇到问题,详细内容参考这篇文章可能遇到问题

  • husky 无法触发
  1. 项目首先需要被 git 管理

  2. mac 电脑执行 npm run postinstallmac 来设置 husky 的读写权限

说明

  1. web-norm 只支持 vue(包括 vue3)及 react 项目

  2. 在使用过程中遇到任何问题,请提交 issues 😚

web-norm's People

Contributors

lyh0371 avatar yamiqu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.