@zhen20/elpis
v1.0.0
Published
1. node 版本 18.18.0
Readme
Elpis 一个全栈实现的企业级应用框架
项目初始化
node 版本 18.18.0
配置 gitignore
npm init
完善 package.json 确认 dependencies(上线运行依赖) 和 devDependencies(开发依赖)
安装 cnpm (下载依赖更快)
npm install cnpm -g --registry=https://registry.npmmirror.com- 编写简易的 index.js
const koa = require("koa");
const app = new koa();
try {
const port = process.env.PORT || 8080;
const host = process.env.IP || "0.0.0.0";
app.listen(port, host, () => {
console.log(`Server running at http://${host}:${port}`);
});
} catch (e) {
console.error(e);
}- 配置
.eslintrc和.eslintignore以及package.json中的lint脚本
{
"scripts": {
"lint": "eslint --quiet --ext js,vue ."
}
}- 配置代码提交钩子 ghooks
{
"config": {
"ghooks": {
"commit-msg": "validate-commit-msg",
"pre-commit": "npm run lint"
}
}
}