小白写项目的一天
后端go,数据库mysql 前端react
这个项目就两个人,一个前端一个后端,
稍微分析了下需求,开始安排项目搭建
-
prettier 主要用于代码样式格式化
-
eslint ts语法检测 记得之前还有个tsLint,不过已经不维护了,直接eslint配置插件约束ts即可
-
husky commitlint 用于 commit message检测
- commitlint tyscript 注意编码问题
- npx husky init 命令行写入文件需要注意, 会生成一个配置文件,但注意默认不是utf8格式,需要更正为utf8. 参考链接如下
-
lint-staged 只lint commit 的文件
But running a lint process on a whole project is slow, and linting results can be irrelevant. Ultimately you only want to lint files that will be committed.
-
pnpm包管理 不用重复依赖
which pnpm where pnpm // (windows系统没有which ,用where代替) -
npmrc的设置
- 注意版本滑动 --save-exact
juejin.cn/post/729638…
一般写在跟项目路径下, 组员git clone就不要单独设置本地npm. - 仓库源的设置, 项目中也依赖了electron,
ELECTRON_CUSTOM_DIR={{ version }} ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ registry=https://registry.npmmirror.com/ save-exact=true user-agent=pnpm/8.15.6 npm/? node/v20.12.0 win32 x64 store-dir=D://pnpm/.pnpm-store
- 注意版本滑动 --save-exact
-
网络请求 axios . 用法参考官网即可
github.com/axios/axios
axios-http.com/zh/docs/exa… nodejs中的使用
axios request 方法 传参 params->get、data->post -
nodejs日志库,计划用log4js
- 注意 日志分割, 定时删除
- 日志的输出不要影响主代码的运行和性能
- 日志的脱敏 log4js-node.github.io/log4js-node… juejin.cn/post/695316… blog.csdn.net/crazy_jiali…
-
git 行结束符的处理LF will be replaced by CRLF the next time Git touches it
在跨平台的代码共享和版本控制中,行结束符(Line Feed - LF 和 Carriage Return + Line Feed - CRLF)的差异可能会导致不必要的麻烦。
-
暂时不用next了,直接用vite构建
-
项目部署 开发测试环境部署直接在虚拟机干,方便测试和bug修复, 生产环境docker
其他参考
eslint.org/docs/latest…
eslint.org/docs/latest…
prettier.io/docs/en/ins…
commitlint.js.org/guides/loca…
commitlint.js.org/reference/c…
segmentfault.com/a/119000004…
husky问题参考
stackoverflow.com/questions/7…
blog.csdn.net/kurodasense…
github.com/conventiona…