Files
upage-git/upage/assets/js/13d3c590.eb8971d6.js
2025-09-29 03:02:50 +00:00

1 line
12 KiB
JavaScript

"use strict";(self.webpackChunkupage_docs=self.webpackChunkupage_docs||[]).push([[151],{3717:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>t,contentTitle:()=>c,default:()=>p,frontMatter:()=>r,metadata:()=>l,toc:()=>a});const l=JSON.parse('{"id":"contributing/development-setup","title":"\u5f00\u53d1\u73af\u5883\u8bbe\u7f6e","description":"\u672c\u6307\u5357\u5c06\u5e2e\u52a9\u60a8\u8bbe\u7f6e UPage \u7684\u672c\u5730\u5f00\u53d1\u73af\u5883\uff0c\u4ee5\u4fbf\u60a8\u53ef\u4ee5\u5f00\u59cb\u8d21\u732e\u4ee3\u7801\u3002","source":"@site/content/contributing/development-setup.md","sourceDirName":"contributing","slug":"/contributing/development-setup","permalink":"/upage/contributing/development-setup","draft":false,"unlisted":false,"editUrl":"https://github.com/halo-dev/upage/edit/main/docs/content/content/contributing/development-setup.md","tags":[],"version":"current","frontMatter":{"id":"development-setup","title":"\u5f00\u53d1\u73af\u5883\u8bbe\u7f6e"},"sidebar":"tutorialSidebar","previous":{"title":"\u8d21\u732e\u65b9\u5f0f","permalink":"/upage/contributing/ways-to-contribute"},"next":{"title":"\u4ee3\u7801\u89c4\u8303","permalink":"/upage/contributing/code-standards"}}');var i=s(6106),d=s(8784);const r={id:"development-setup",title:"\u5f00\u53d1\u73af\u5883\u8bbe\u7f6e"},c="\u5f00\u53d1\u73af\u5883\u8bbe\u7f6e",t={},a=[{value:"\u524d\u7f6e\u6761\u4ef6",id:"\u524d\u7f6e\u6761\u4ef6",level:2},{value:"\u5b89\u88c5 Node.js",id:"\u5b89\u88c5-nodejs",level:3},{value:"\u5b89\u88c5 pnpm",id:"\u5b89\u88c5-pnpm",level:3},{value:"\u514b\u9686\u4ed3\u5e93",id:"\u514b\u9686\u4ed3\u5e93",level:2},{value:"\u5b89\u88c5\u4f9d\u8d56",id:"\u5b89\u88c5\u4f9d\u8d56",level:2},{value:"\u751f\u6210 Prisma \u5ba2\u6237\u7aef",id:"\u751f\u6210-prisma-\u5ba2\u6237\u7aef",level:2},{value:"\u914d\u7f6e\u73af\u5883\u53d8\u91cf",id:"\u914d\u7f6e\u73af\u5883\u53d8\u91cf",level:2},{value:"\u542f\u7528 Logto \u8ba4\u8bc1\uff08\u53ef\u9009\uff09",id:"\u542f\u7528-logto-\u8ba4\u8bc1\u53ef\u9009",level:2},{value:"\u542f\u52a8\u5f00\u53d1\u670d\u52a1\u5668",id:"\u542f\u52a8\u5f00\u53d1\u670d\u52a1\u5668",level:2},{value:"\u6784\u5efa\u9879\u76ee",id:"\u6784\u5efa\u9879\u76ee",level:2},{value:"\u8fd0\u884c\u6d4b\u8bd5",id:"\u8fd0\u884c\u6d4b\u8bd5",level:2},{value:"\u6587\u6863\u5f00\u53d1",id:"\u6587\u6863\u5f00\u53d1",level:2},{value:"\u5e38\u89c1\u95ee\u9898\u89e3\u51b3",id:"\u5e38\u89c1\u95ee\u9898\u89e3\u51b3",level:2},{value:"\u4f9d\u8d56\u5b89\u88c5\u5931\u8d25",id:"\u4f9d\u8d56\u5b89\u88c5\u5931\u8d25",level:3},{value:"\u5f00\u53d1\u670d\u52a1\u5668\u542f\u52a8\u5931\u8d25",id:"\u5f00\u53d1\u670d\u52a1\u5668\u542f\u52a8\u5931\u8d25",level:3},{value:"\u5176\u4ed6\u95ee\u9898",id:"\u5176\u4ed6\u95ee\u9898",level:3}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,d.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.header,{children:(0,i.jsx)(n.h1,{id:"\u5f00\u53d1\u73af\u5883\u8bbe\u7f6e",children:"\u5f00\u53d1\u73af\u5883\u8bbe\u7f6e"})}),"\n",(0,i.jsx)(n.p,{children:"\u672c\u6307\u5357\u5c06\u5e2e\u52a9\u60a8\u8bbe\u7f6e UPage \u7684\u672c\u5730\u5f00\u53d1\u73af\u5883\uff0c\u4ee5\u4fbf\u60a8\u53ef\u4ee5\u5f00\u59cb\u8d21\u732e\u4ee3\u7801\u3002"}),"\n",(0,i.jsx)(n.h2,{id:"\u524d\u7f6e\u6761\u4ef6",children:"\u524d\u7f6e\u6761\u4ef6"}),"\n",(0,i.jsx)(n.p,{children:"\u5f00\u59cb\u5f00\u53d1 UPage \u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u7684\u7cfb\u7edf\u6ee1\u8db3\u4ee5\u4e0b\u8981\u6c42\uff1a"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Node.js"}),": 18.18.0 \u6216\u66f4\u9ad8\u7248\u672c"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"pnpm"}),": 9.4.0 \u6216\u66f4\u9ad8\u7248\u672c"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Git"}),": \u6700\u65b0\u7248\u672c"]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"\u5b89\u88c5-nodejs",children:"\u5b89\u88c5 Node.js"}),"\n",(0,i.jsxs)(n.p,{children:["\u60a8\u53ef\u4ee5\u4ece ",(0,i.jsx)(n.a,{href:"https://nodejs.org/",children:"Node.js \u5b98\u7f51"})," \u4e0b\u8f7d\u5e76\u5b89\u88c5 Node.js\uff0c\u6216\u4f7f\u7528\u7248\u672c\u7ba1\u7406\u5de5\u5177\u5982 ",(0,i.jsx)(n.a,{href:"https://github.com/nvm-sh/nvm",children:"nvm"}),"\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"# \u4f7f\u7528 nvm \u5b89\u88c5 Node.js\nnvm install 18.18.0\nnvm use 18.18.0\n"})}),"\n",(0,i.jsx)(n.h3,{id:"\u5b89\u88c5-pnpm",children:"\u5b89\u88c5 pnpm"}),"\n",(0,i.jsx)(n.p,{children:"\u5b89\u88c5 pnpm \u7684\u6700\u7b80\u5355\u65b9\u6cd5\u662f\u901a\u8fc7 npm\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"npm install -g pnpm@9.4.0\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6216\u8005\u6309\u7167 ",(0,i.jsx)(n.a,{href:"https://pnpm.io/installation",children:"pnpm \u5b98\u65b9\u6587\u6863"})," \u7684\u8bf4\u660e\u8fdb\u884c\u5b89\u88c5\u3002"]}),"\n",(0,i.jsx)(n.h2,{id:"\u514b\u9686\u4ed3\u5e93",children:"\u514b\u9686\u4ed3\u5e93"}),"\n",(0,i.jsxs)(n.p,{children:["\u9996\u5148\uff0c",(0,i.jsx)(n.a,{href:"https://github.com/halo-dev/upage/fork",children:"fork UPage \u4ed3\u5e93"}),"\u5230\u60a8\u7684 GitHub \u8d26\u6237\uff0c\u7136\u540e\u5c06\u5176\u514b\u9686\u5230\u672c\u5730\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"# \u514b\u9686\u60a8 fork \u7684\u4ed3\u5e93\ngit clone https://github.com/YOUR-USERNAME/upage.git\n\n# \u8fdb\u5165\u9879\u76ee\u76ee\u5f55\ncd upage\n\n# \u6dfb\u52a0\u4e0a\u6e38\u4ed3\u5e93\ngit remote add upstream https://github.com/halo-dev/upage.git\n"})}),"\n",(0,i.jsx)(n.h2,{id:"\u5b89\u88c5\u4f9d\u8d56",children:"\u5b89\u88c5\u4f9d\u8d56"}),"\n",(0,i.jsx)(n.p,{children:"\u4f7f\u7528 pnpm \u5b89\u88c5\u9879\u76ee\u4f9d\u8d56\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm install\n"})}),"\n",(0,i.jsx)(n.h2,{id:"\u751f\u6210-prisma-\u5ba2\u6237\u7aef",children:"\u751f\u6210 Prisma \u5ba2\u6237\u7aef"}),"\n",(0,i.jsx)(n.p,{children:"UPage \u4f7f\u7528 Prisma \u4f5c\u4e3a\u6570\u636e\u5e93 ORM\uff0c\u56e0\u6b64\u9700\u8981\u751f\u6210 Prisma \u5ba2\u6237\u7aef\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm setup\n"})}),"\n",(0,i.jsx)(n.h2,{id:"\u914d\u7f6e\u73af\u5883\u53d8\u91cf",children:"\u914d\u7f6e\u73af\u5883\u53d8\u91cf"}),"\n",(0,i.jsxs)(n.p,{children:["\u62f7\u8d1d ",(0,i.jsx)(n.code,{children:".env.example"})," \u6587\u4ef6\uff0c\u521b\u5efa ",(0,i.jsx)(n.code,{children:".env"})," \u6587\u4ef6\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"cp .env.example .env\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6309\u7167",(0,i.jsx)(n.a,{href:"../configuration",children:"\u914d\u7f6e\u53c2\u8003"}),"\u7684\u8bf4\u660e\u4fee\u6539 ",(0,i.jsx)(n.code,{children:".env"})," \u6587\u4ef6\u8fdb\u884c\u914d\u7f6e\u3002"]}),"\n",(0,i.jsx)(n.h2,{id:"\u542f\u7528-logto-\u8ba4\u8bc1\u53ef\u9009",children:"\u542f\u7528 Logto \u8ba4\u8bc1\uff08\u53ef\u9009\uff09"}),"\n",(0,i.jsxs)(n.p,{children:["UPage \u9ed8\u8ba4\u4ec5\u652f\u6301\u5355\u4e00\u7528\u6237\u533f\u540d\u8bbf\u95ee\uff0c\u5982\u679c\u60a8\u60f3\u8981\u5f00\u53d1\u7528\u6237\u8ba4\u8bc1\u529f\u80fd\uff0c\u53ef\u4ee5\u6309\u7167",(0,i.jsx)(n.a,{href:"../deployment/logto",children:"Logto \u8ba4\u8bc1\u96c6\u6210"}),"\u7684\u8bf4\u660e\u914d\u7f6e Logto \u8ba4\u8bc1\u3002"]}),"\n",(0,i.jsx)(n.h2,{id:"\u542f\u52a8\u5f00\u53d1\u670d\u52a1\u5668",children:"\u542f\u52a8\u5f00\u53d1\u670d\u52a1\u5668"}),"\n",(0,i.jsx)(n.p,{children:"\u542f\u52a8\u5f00\u53d1\u670d\u52a1\u5668\uff0c\u8fd9\u5c06\u5141\u8bb8\u60a8\u5728\u672c\u5730\u9884\u89c8\u548c\u6d4b\u8bd5\u60a8\u7684\u66f4\u6539\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm dev\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6b64\u547d\u4ee4\u4f1a\u542f\u52a8\u5f00\u53d1\u670d\u52a1\u5668\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7 ",(0,i.jsx)(n.code,{children:"http://localhost:5173"})," \u8bbf\u95ee\u3002"]}),"\n",(0,i.jsx)(n.h2,{id:"\u6784\u5efa\u9879\u76ee",children:"\u6784\u5efa\u9879\u76ee"}),"\n",(0,i.jsx)(n.p,{children:"\u8981\u6784\u5efa\u751f\u4ea7\u7248\u672c\u7684\u9879\u76ee\uff0c\u8fd0\u884c\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm build\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u6784\u5efa\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9884\u89c8\u751f\u4ea7\u7248\u672c\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm preview\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u9884\u751f\u4ea7\u7248\u672c\u9879\u76ee\u8fd0\u884c\u5728 ",(0,i.jsx)(n.code,{children:"http://localhost:3000"}),"\u3002"]}),"\n",(0,i.jsx)(n.h2,{id:"\u8fd0\u884c\u6d4b\u8bd5",children:"\u8fd0\u884c\u6d4b\u8bd5"}),"\n",(0,i.jsx)(n.p,{children:"\u8fd0\u884c\u9879\u76ee\u7684\u6d4b\u8bd5\u5957\u4ef6\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm test\n"})}),"\n",(0,i.jsx)(n.h2,{id:"\u6587\u6863\u5f00\u53d1",children:"\u6587\u6863\u5f00\u53d1"}),"\n",(0,i.jsx)(n.p,{children:"\u5982\u679c\u60a8\u60f3\u8981\u4fee\u6539\u6216\u9884\u89c8\u6587\u6863\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"# \u542f\u52a8\u6587\u6863\u5f00\u53d1\u670d\u52a1\u5668\npnpm docs:start\n\n# \u6784\u5efa\u6587\u6863\npnpm docs:build\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6587\u6863\u5f00\u53d1\u670d\u52a1\u5668\u9ed8\u8ba4\u5728 ",(0,i.jsx)(n.code,{children:"http://localhost:3000"})," \u8fd0\u884c\u3002"]}),"\n",(0,i.jsx)(n.h2,{id:"\u5e38\u89c1\u95ee\u9898\u89e3\u51b3",children:"\u5e38\u89c1\u95ee\u9898\u89e3\u51b3"}),"\n",(0,i.jsx)(n.h3,{id:"\u4f9d\u8d56\u5b89\u88c5\u5931\u8d25",children:"\u4f9d\u8d56\u5b89\u88c5\u5931\u8d25"}),"\n",(0,i.jsx)(n.p,{children:"\u5982\u679c\u60a8\u5728\u5b89\u88c5\u4f9d\u8d56\u65f6\u9047\u5230\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u89e3\u51b3\u65b9\u6848\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"# \u6e05\u9664 pnpm \u7f13\u5b58\npnpm store prune\n\n# \u91cd\u65b0\u5b89\u88c5\u4f9d\u8d56\npnpm install --force\n"})}),"\n",(0,i.jsx)(n.h3,{id:"\u5f00\u53d1\u670d\u52a1\u5668\u542f\u52a8\u5931\u8d25",children:"\u5f00\u53d1\u670d\u52a1\u5668\u542f\u52a8\u5931\u8d25"}),"\n",(0,i.jsx)(n.p,{children:"\u5982\u679c\u5f00\u53d1\u670d\u52a1\u5668\u65e0\u6cd5\u542f\u52a8\uff0c\u8bf7\u68c0\u67e5\uff1a"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsx)(n.li,{children:"\u7aef\u53e3 5173 \u662f\u5426\u88ab\u5176\u4ed6\u5e94\u7528\u5360\u7528"}),"\n",(0,i.jsx)(n.li,{children:"Node.js \u7248\u672c\u662f\u5426\u7b26\u5408\u8981\u6c42"}),"\n",(0,i.jsx)(n.li,{children:"\u662f\u5426\u6240\u6709\u4f9d\u8d56\u90fd\u5df2\u6b63\u786e\u5b89\u88c5"}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u60a8\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u4e0d\u540c\u7684\u7aef\u53e3\u542f\u52a8\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm dev --port 5174\n"})}),"\n",(0,i.jsx)(n.h3,{id:"\u5176\u4ed6\u95ee\u9898",children:"\u5176\u4ed6\u95ee\u9898"}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679c\u60a8\u9047\u5230\u5176\u4ed6\u95ee\u9898\uff0c\u8bf7\u67e5\u770b\u9879\u76ee\u7684 ",(0,i.jsx)(n.a,{href:"/upage/faq",children:"\u5e38\u89c1\u95ee\u9898"})," \u6216\u5728 ",(0,i.jsx)(n.a,{href:"https://github.com/halo-dev/upage/issues",children:"GitHub Issues"})," \u4e2d\u641c\u7d22\u76f8\u5173\u95ee\u9898\u3002\u5982\u679c\u6ca1\u6709\u627e\u5230\u89e3\u51b3\u65b9\u6848\uff0c\u8bf7\u521b\u5efa\u65b0\u7684 issue\u3002"]})]})}function p(e={}){const{wrapper:n}={...(0,d.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}},8784:(e,n,s)=>{s.d(n,{R:()=>r,x:()=>c});var l=s(7378);const i={},d=l.createContext(i);function r(e){const n=l.useContext(d);return l.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),l.createElement(d.Provider,{value:n},e.children)}}}]);