Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
reviewers:
- "callqh"
allow:
- dependency-name: "@farmfe/*"
- dependency-name: "@biomejs/*"
35 changes: 30 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
# Farm-react-template
<div align="center">
<a href="https://github.com/farm-fe/farm">
<img src="./src/assets/logo.png" width="300" />
</a>
<h3>开箱即用的Farm-react开发模版</h3>
<p>
集成了开发常用的功能,如路由,代码格式化,commit约束等
</p>
<p align="center">
<a href="https://discord.gg/mDErq9aFnF">
<img src="https://img.shields.io/badge/chat-discord-blueviolet?style=flat&logo=discord&colorA=ffe3f5&colorB=711a5f" alt="discord chat" />
</a>
<a href="https://npmjs.com/package/@farmfe/core"><img src="https://img.shields.io/npm/v/@farmfe/core.svg?style=flat-square&colorA=ffe3f5&colorB=711a5f" alt="npm package"></a>
<a href="https://nodejs.org/en/about/releases/"><img src="https://img.shields.io/node/v/@farmfe/core.svg?style=flat-square&colorA=ffe3f5&colorB=711a5f" alt="node compatibility"></a>
<a href="https://github.com/farm-fe/farm/blob/main/LICENSE">
<img src="https://img.shields.io/npm/l/@farmfe/core?style=flat-square&colorA=ffe3f5&colorB=711a5f" alt="license" />
</a>
</p>
<br/>
</div>

开箱即用的Farm-react开发模版
---

## 使用
1. 将改仓库`Fork`到你的仓库中
2. `npx degit <Git用户名/farm-react-template> <你的项目名>`: 例如:`pnpx degit jstors/farm-react-template my-project`

## 注意事项
> 如果`npx degit`下载的过慢,可以考虑全局安装`degit`工具,然后直接使用`degit`命令进行下载

## 注意
- 请确保你的node版本在**18**以上
- 为了更好的开发体验,请在本地开发工具上[**安装Biome插件**](https://biomejs.dev/zh-cn/reference/vscode/)


## 集成内容
- [Farm](https://farm-fe.github.io/zh/docs/quick-start): Rust开发的基础框架,提供了一套完整的开发体验
- [vite-plugin-pages](https://github.com/hannoeru/vite-plugin-pages?tab=readme-ov-file#react-1): 提供约定式路由功能
- [Biome](https://biomejs.dev/zh-cn/reference/configuration/#javascriptformatterjsxquotestyle): Rust开发的lint和format工具,提升极致的开发体验
- husky&commitlint: 提供了commit规范和代码提交的检查
- react-router: 提供了路由的功能
- `husky`&`commitlint`: 提供了`commit`规范和代码提交的检查

9 changes: 8 additions & 1 deletion farm.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { defineConfig } from '@farmfe/core';
import Pages from 'vite-plugin-pages';

export default defineConfig({
plugins: ['@farmfe/plugin-react']
plugins: ['@farmfe/plugin-react'],
vitePlugins:[
Pages({
resolver:'react',
moduleId:"~react-pages",
})
]
Comment on lines +6 to +11
Comment on lines +5 to +11
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@commitlint/cli": "^19.2.0",
"@commitlint/config-conventional": "^19.1.0",
"@farmfe/cli": "^1.0.0",
"@farmfe/core": "^1.0.1",
"@farmfe/core": "^1.0.2",
"@farmfe/plugin-react": "^1.0.0",
"@types/react": "18",
"@types/react-dom": "18",
Expand Down
69 changes: 31 additions & 38 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import React from 'react';
import React, { Suspense } from 'react';
import { createRoot } from 'react-dom/client';
import { RouterProvider } from 'react-router-dom';
import { BrowserRouter as Router, useRoutes } from 'react-router-dom';
import routes from '~react-pages';
import './index.css';
import { router } from './router/routers';

const container = document.querySelector('#root');
const root = createRoot(container);

Comment on lines 7 to 9
root.render(<RouterProvider router={router} />);
function App() {
return <Suspense fallback={<p>Loading...</p>}>{useRoutes(routes)}</Suspense>;
}

root.render(
<Router>
<App />
</Router>,
);
42 changes: 0 additions & 42 deletions src/main.css

This file was deleted.

33 changes: 0 additions & 33 deletions src/main.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/router/routers.tsx

This file was deleted.

Loading
Loading