mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-05 19:41:57 +08:00
1 line
18 KiB
JavaScript
1 line
18 KiB
JavaScript
"use strict";(self.webpackChunkfes_js=self.webpackChunkfes_js||[]).push([[256],{8145:(s,n,a)=>{a.r(n),a.d(n,{data:()=>e});const e={key:"v-040800dc",path:"/guide/directory-structure.html",title:"目录结构",lang:"zh-CN",frontmatter:{},excerpt:"",headers:[{level:3,title:"package.json",slug:"package-json",children:[]},{level:3,title:"tsconfig.json",slug:"tsconfig-json",children:[]},{level:3,title:".fes.js",slug:"fes-js",children:[]},{level:3,title:"mock.js",slug:"mock-js",children:[]},{level:3,title:".env",slug:"env",children:[]},{level:3,title:"dist 目录",slug:"dist-目录",children:[]},{level:2,title:"public 目录",slug:"public-目录",children:[{level:3,title:"index.html",slug:"index-html",children:[]}]},{level:2,title:"src 目录",slug:"src-目录",children:[{level:3,title:".fes 目录",slug:"fes-目录",children:[]},{level:3,title:"pages 目录",slug:"pages-目录",children:[]},{level:3,title:"app.js",slug:"app-js",children:[]}]}],filePathRelative:"guide/directory-structure.md",git:{updatedTime:1680249231e3,contributors:[{name:"wanchun",email:"445436867@qq.com",commits:1}]}}},1842:(s,n,a)=>{a.r(n),a.d(n,{default:()=>l});var e=a(6252);const p=(0,e._)("h1",{id:"目录结构",tabindex:"-1"},[(0,e._)("a",{class:"header-anchor",href:"#目录结构","aria-hidden":"true"},"#"),(0,e.Uk)(" 目录结构")],-1),t=(0,e._)("code",null,"约定优于配置",-1),o=(0,e.uE)('<div class="language-text ext-text line-numbers-mode"><pre class="language-text"><code>fes-template\n├── package.json\n├── tsconfig.json\n├── mock.js\n├── .fes.js\n├── .env\n├── dist\n├── public\n│ └── index.html\n└── src\n ├── .fes\n └── pages\n │ └── index.vue\n └── app.js\n</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><h3 id="package-json" tabindex="-1"><a class="header-anchor" href="#package-json" aria-hidden="true">#</a> package.json</h3><div class="language-json ext-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>\n <span class="token property">"name"</span><span class="token operator">:</span> <span class="token string">"@fesjs/template"</span><span class="token punctuation">,</span>\n <span class="token property">"version"</span><span class="token operator">:</span> <span class="token string">"2.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"description"</span><span class="token operator">:</span> <span class="token string">"fes项目模版"</span><span class="token punctuation">,</span>\n <span class="token property">"scripts"</span><span class="token operator">:</span> <span class="token punctuation">{</span>\n <span class="token property">"build"</span><span class="token operator">:</span> <span class="token string">"fes build"</span><span class="token punctuation">,</span>\n <span class="token property">"prod"</span><span class="token operator">:</span> <span class="token string">"FES_ENV=prod fes build"</span><span class="token punctuation">,</span>\n <span class="token property">"analyze"</span><span class="token operator">:</span> <span class="token string">"ANALYZE=1 fes build"</span><span class="token punctuation">,</span>\n <span class="token property">"dev"</span><span class="token operator">:</span> <span class="token string">"fes dev"</span><span class="token punctuation">,</span>\n <span class="token property">"test"</span><span class="token operator">:</span> <span class="token string">"fes test"</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token property">"keywords"</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">"管理端"</span><span class="token punctuation">,</span> <span class="token string">"fes"</span><span class="token punctuation">,</span> <span class="token string">"fast"</span><span class="token punctuation">,</span> <span class="token string">"easy"</span><span class="token punctuation">,</span> <span class="token string">"strong"</span><span class="token punctuation">]</span><span class="token punctuation">,</span>\n <span class="token property">"files"</span><span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token string">".eslintrc.js"</span><span class="token punctuation">,</span>\n <span class="token string">".gitignore"</span><span class="token punctuation">,</span>\n <span class="token string">".fes.js"</span><span class="token punctuation">,</span>\n <span class="token string">".fes.prod.js"</span><span class="token punctuation">,</span>\n <span class="token string">"mock.js"</span><span class="token punctuation">,</span>\n <span class="token string">"package.json"</span><span class="token punctuation">,</span>\n <span class="token string">"README.md"</span><span class="token punctuation">,</span>\n <span class="token string">"tsconfig.json"</span><span class="token punctuation">,</span>\n <span class="token string">"/src"</span><span class="token punctuation">,</span>\n <span class="token string">"/config"</span>\n <span class="token punctuation">]</span><span class="token punctuation">,</span>\n <span class="token property">"repository"</span><span class="token operator">:</span> <span class="token punctuation">{</span>\n <span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"git"</span><span class="token punctuation">,</span>\n <span class="token property">"url"</span><span class="token operator">:</span> <span class="token string">"git+https://github.com/WeBankFinTech/fes.js.git"</span><span class="token punctuation">,</span>\n <span class="token property">"directory"</span><span class="token operator">:</span> <span class="token string">"packages/fes-template"</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token property">"author"</span><span class="token operator">:</span> <span class="token string">"harrywan"</span><span class="token punctuation">,</span>\n <span class="token property">"license"</span><span class="token operator">:</span> <span class="token string">"MIT"</span><span class="token punctuation">,</span>\n <span class="token property">"bugs"</span><span class="token operator">:</span> <span class="token punctuation">{</span>\n <span class="token property">"url"</span><span class="token operator">:</span> <span class="token string">"https://github.com/WeBankFinTech/fes.js/issues"</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token property">"homepage"</span><span class="token operator">:</span> <span class="token string">"https://github.com/WeBankFinTech/fes.js#readme"</span><span class="token punctuation">,</span>\n <span class="token property">"publishConfig"</span><span class="token operator">:</span> <span class="token punctuation">{</span>\n <span class="token property">"access"</span><span class="token operator">:</span> <span class="token string">"public"</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token property">"devDependencies"</span><span class="token operator">:</span> <span class="token punctuation">{</span>\n <span class="token property">"@webank/eslint-config-webank"</span><span class="token operator">:</span> <span class="token string">"0.3.1"</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token property">"dependencies"</span><span class="token operator">:</span> <span class="token punctuation">{</span>\n <span class="token property">"@fesjs/fes"</span><span class="token operator">:</span> <span class="token string">"^2.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/plugin-access"</span><span class="token operator">:</span> <span class="token string">"^2.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/plugin-layout"</span><span class="token operator">:</span> <span class="token string">"^3.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/plugin-locale"</span><span class="token operator">:</span> <span class="token string">"^3.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/plugin-model"</span><span class="token operator">:</span> <span class="token string">"^2.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/plugin-enums"</span><span class="token operator">:</span> <span class="token string">"^2.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/plugin-jest"</span><span class="token operator">:</span> <span class="token string">"^2.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/plugin-vuex"</span><span class="token operator">:</span> <span class="token string">"^2.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/plugin-request"</span><span class="token operator">:</span> <span class="token string">"^2.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/plugin-qiankun"</span><span class="token operator">:</span> <span class="token string">"^2.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/plugin-sass"</span><span class="token operator">:</span> <span class="token string">"^2.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/plugin-monaco-editor"</span><span class="token operator">:</span> <span class="token string">"^2.0.0-beta.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/plugin-windicss"</span><span class="token operator">:</span> <span class="token string">"^2.0.0"</span><span class="token punctuation">,</span>\n <span class="token property">"@fesjs/fes-design"</span><span class="token operator">:</span> <span class="token string">"^0.5.0"</span><span class="token punctuation">,</span>\n <span class="token property">"vue"</span><span class="token operator">:</span> <span class="token string">"^3.0.5"</span><span class="token punctuation">,</span>\n <span class="token property">"vuex"</span><span class="token operator">:</span> <span class="token string">"^4.0.0"</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token property">"private"</span><span class="token operator">:</span> <span class="token boolean">true</span>\n<span class="token punctuation">}</span>\n</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br></div></div><p>其中<code>@fesjs/fes</code>是 Fes.js 核心依赖,另外以 <code>@fesjs/preset-</code>、<code>@fesjs/plugin-</code>、<code>@webank/fes-preset-</code>、<code>@webank/fes-plugin-</code>、<code>fes-preset-</code> 和 <code>fes-plugin-</code> 开头的依赖会被自动注册为插件或插件集。</p><h3 id="tsconfig-json" tabindex="-1"><a class="header-anchor" href="#tsconfig-json" aria-hidden="true">#</a> tsconfig.json</h3><p>解决 <code>@fesjs/fes</code> 和使用 <code>@</code> 的 API 提示</p><h3 id="fes-js" tabindex="-1"><a class="header-anchor" href="#fes-js" aria-hidden="true">#</a> .fes.js</h3><p>配置文件,包含 Fes.js 内置功能和安装的其他插件配置。</p><h3 id="mock-js" tabindex="-1"><a class="header-anchor" href="#mock-js" aria-hidden="true">#</a> mock.js</h3><p><code>mock</code> 数据的配置文件。</p><h3 id="env" tabindex="-1"><a class="header-anchor" href="#env" aria-hidden="true">#</a> .env</h3><p>定义环境变量。</p><p>比如 <code>.env</code> 文件内容如下:</p><div class="language-text ext-text line-numbers-mode"><pre class="language-text"><code>PORT=8888\nFES_ENV=prod\n</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>等同于 node 端运行时,设置如下:</p><div class="language-text ext-text line-numbers-mode"><pre class="language-text"><code>process.env.PORT = '8888';\nprocess.env.FES_ENV = 'prod';\n</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="dist-目录" tabindex="-1"><a class="header-anchor" href="#dist-目录" aria-hidden="true">#</a> dist 目录</h3><p>执行 <code>fes build</code> 后,产物默认会存放在这里。</p><h2 id="public-目录" tabindex="-1"><a class="header-anchor" href="#public-目录" aria-hidden="true">#</a> public 目录</h2><p>此目录下所有文件为静态资源,会被复制到输出路径。</p><h3 id="index-html" tabindex="-1"><a class="header-anchor" href="#index-html" aria-hidden="true">#</a> index.html</h3><p>默认的 <code>html</code> 模板文件,如果删除此 <code>html</code> 则会使用内置的 <code>html</code> 模板文件。</p><h2 id="src-目录" tabindex="-1"><a class="header-anchor" href="#src-目录" aria-hidden="true">#</a> src 目录</h2><h3 id="fes-目录" tabindex="-1"><a class="header-anchor" href="#fes-目录" aria-hidden="true">#</a> .fes 目录</h3><p>临时文件目录,比如入口文件、路由等,都会被临时生成到这里。</p><div class="custom-container warning"><p class="custom-container-title">注意</p><p>不要提交 <code>.fes</code> 目录到 <code>git</code> 仓库,他们会在 <code>fes dev</code> 和 <code>fes build</code> 时被删除并重新生成。</p></div><h3 id="pages-目录" tabindex="-1"><a class="header-anchor" href="#pages-目录" aria-hidden="true">#</a> pages 目录</h3><p>所有路由组件文件存放在这里。</p><h3 id="app-js" tabindex="-1"><a class="header-anchor" href="#app-js" aria-hidden="true">#</a> app.js</h3><p>运行时配置文件,可以在这里扩展运行时的能力,比如修改路由等。</p>',30),r={},l=(0,a(3744).Z)(r,[["render",function(s,n){const a=(0,e.up)("RouterLink");return(0,e.wg)(),(0,e.iD)(e.HY,null,[p,(0,e._)("p",null,[(0,e.Uk)("在"),(0,e.Wm)(a,{to:"/guide/getting-started.html"},{default:(0,e.w5)((()=>[(0,e.Uk)("快速上手")])),_:1}),(0,e.Uk)("中,大家对框架应该有初步的印象,接下来我们了解下目录结构。Fes.js 遵循 "),t,(0,e.Uk)(" 的原则,一个基础的 Fes.js 项目大致是这样的:")]),o],64)}]])},3744:(s,n)=>{n.Z=(s,n)=>{const a=s.__vccOpts||s;for(const[s,e]of n)a[s]=e;return a}}}]); |