Skip to content

Commit

Permalink
feat: add tailwind
Browse files Browse the repository at this point in the history
  • Loading branch information
callqh committed Apr 26, 2024
1 parent f6120d9 commit c797809
Show file tree
Hide file tree
Showing 38 changed files with 2,244 additions and 500 deletions.
51 changes: 51 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "\U0001F41E Bug report"
description: Create a report to help us improve
body:
- type: markdown
attributes:
value: |
**Before You Start...**
This form is only for submitting bug reports. If you have a usage question
or are unsure if this is really a bug, make sure to:
- Node version greater than or equal to 16.8
Also try to search for your issue - it may have already been answered or even fixed in the development branch.
However, if you find that an old, closed issue still persists in the latest version,
you should open a new issue using the form below instead of commenting on the old issue.
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to reproduce
description: |
What do we need to do after opening your repro in order to make the bug happen? Clear and concise reproduction instructions are important for us to be able to triage your issue in a timely manner. Note that you can use [Markdown](https://guides.github.com/features/mastering-markdown/) to format lists and code.
placeholder: Steps to reproduce
validations:
required: true
- type: textarea
id: expected
attributes:
label: What is expected?
validations:
required: true
- type: textarea
id: actually-happening
attributes:
label: What is actually happening?
validations:
required: true
- type: textarea
id: system-info
attributes:
label: System Info
description: Output of `npx envinfo --system --npmPackages @farmfe/core --binaries --browsers`
render: Shell
placeholder: System, Binaries, Browsers
validations:
required: true
- type: textarea
id: additional-comments
attributes:
label: Any additional comments?
description: e.g. some background/context of how you ran into this bug.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discord server
url: https://discord.gg/ruUjarvEP9
about: You can ask questions here if you prefer Discord.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "\U0001F680 New feature"
description: Suggest an idea for Farm
labels: [":sparkles: feature request"]
body:
- type: markdown
attributes:
value: |
**Before You Start...**
This form is only for submitting feature requests. If you have a usage question
or are unsure if this is really a bug, make sure to:
Also try to search for your issue - another user may have already requested something similar!
- type: textarea
id: problem-description
attributes:
label: What problem does this feature solve?
description: |
Explain your use case, context, and rationale behind this feature request. More importantly, what is the **end user experience** you are trying to build that led to the need for this feature?
placeholder: Problem description
validations:
required: true
- type: textarea
id: proposed-API
attributes:
label: What does the proposed API look like?
description: |
Describe how you propose to solve the problem and provide code samples of how the API would work once implemented. Note that you can use [Markdown](https://guides.github.com/features/mastering-markdown/) to format your code blocks.
placeholder: Steps to reproduce
validations:
required: true
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. -->

**Description:**

<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

**BREAKING CHANGE:**

<!--
If this PR introduces a breaking change, it must contain a notice for it to be included in the CHANGELOG. Add description or remove entirely if not breaking.
-->

**Related issue (if exists):**
16 changes: 0 additions & 16 deletions .github/dependabot.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base"],
"labels": ["dependencies"],
"schedule": ["after 6pm every day",],
"rangeStrategy": "bump",
"packageRules": [
{
"matchPackagePatterns": ["*"],
"enabled": false,
},
{
"matchPackagePatterns": ["^@farmfe/*"],
"groupName": "farmfe-packages",
"schedule": ["after 6pm every day"],
"enabled": true,
},
{
"depTypeList": ["peerDependencies"],
"enabled": false,
},
],
}
34 changes: 34 additions & 0 deletions .github/workflows/lint-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint Pr Title

on: [pull_request]

jobs:
lint-pr-title:
name: Validating PR title
runs-on: ubuntu-latest
steps:
# https://github.com/amannn/action-semantic-pull-request
- uses: amannn/action-semantic-pull-request@e9fabac35e210fea40ca5b14c0da95a099eff26f # v5.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Configure which types are allowed (newline-delimited).
# Derived from https://github.com/commitizen/conventional-commit-types
types: |
fix
feat
docs
style
refactor
perf
test
build
ci
chore
revert
release
# Configure that a scope must always be provided.
requireScope: false
# Configure additional validation for the subject based on a regex.
ignoreLabels: |
bot
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pnpm check
npx lint-staged
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
"editor.formatOnSave": true,
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
}
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"cSpell.words": ["Sider"]
}
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<a href="https://github.com/farm-fe/farm">
<img src="./src/assets/logo.png" width="300" />
<img src="./src/assets/logo.png" width="100" />
</a>
<h3>开箱即用的Farm-react开发模版</h3>
<p>
Expand All @@ -21,19 +21,25 @@

---

## 使用
1. 将改仓库`Fork`到你的仓库中
2. `npx degit <git-username/farm-react-template> <porject-name>`
> 为了更好的开发体验,请在本地开发工具上[**安装Biome插件**](https://biomejs.dev/zh-cn/reference/vscode/)
>
## RoadMap

> 如果`npx degit`下载的过慢,可以考虑全局安装`degit`工具,然后直接使用`degit`命令进行下载
[RoadMap](https://github.com/jstors/farm-react-template/issues/21)

## 使用

> 为了更好的开发体验,请在本地开发工具上[**安装Biome插件**](https://biomejs.dev/zh-cn/reference/vscode/)
### 用户配置

所有的配置文件都在`config`目录下,可以根据自己的需求进行修改
- `config/const.ts`: 项目中使用到的常量配置
- `config/menu.ts`: 菜单配置
-


## 集成内容
- [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`规范和代码提交的检查
- [arco-design](https://arco.design/react/docs/start): 一套开箱即用的React组件库
- [vite-plugin-pages](https://github.com/hannoeru/vite-plugin-pages?tab=readme-ov-file#react-1): 提供约定式路由功能

3 changes: 3 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"a11y": {
"useButtonType": "off",
"useKeyWithClickEvents": "off"
},
"correctness": {
"useExhaustiveDependencies": "warn"
}
}
},
Expand Down
32 changes: 25 additions & 7 deletions farm.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
import path from 'node:path';
import { vitePluginForArco } from '@arco-plugins/vite-react';
import { defineConfig } from '@farmfe/core';
import less from '@farmfe/js-plugin-less';
import postcss from '@farmfe/js-plugin-postcss';
import Pages from 'vite-plugin-pages';

export default defineConfig({
compilation: {
resolve: {
alias: {
'@/': path.join(process.cwd(), 'src'),
},
},
persistentCache: {
buildDependencies: ['tailwind.config.js'],
},
runtime: {
isolate: true,
},
},
plugins: [
'@farmfe/plugin-react',
[
'farm-plugin-remove-console',
'@farmfe/plugin-react',
{
// plugin options
// include: ["./src/**/*"],
runtime: 'automatic',
},
],
'farm-plugin-remove-console',
less(),
postcss(),
],
vitePlugins: [
Pages({
resolver: 'react',
moduleId: '~react-pages',
}),
vitePluginForArco({
theme: '@arco-themes/react-juzi001',
}),
],
compilation: {
persistentCache: false,
},
});
5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>

<body>
<div id="root"></div>
<script src="./src/index.tsx"></script>
</body>
</html>

</html>
55 changes: 37 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,53 @@
{
"name": "farm-react-template",
"version": "1.0.0",
"description": "A farm template for react project",
"author": {
"name": "callqh",
"email": "[email protected]"
},
"scripts": {
"dev": "farm start",
"start": "farm start",
"build": "farm build",
"preview": "farm preview",
"clean": "farm clean",
"check": "pnpm biome check --apply ./src",
"commitlint": "commitlint --edit"
},
"dependencies": {
"react": "18",
"react-dom": "18",
"@arco-design/web-react": "^2.61.3",
"@arco-themes/react-juzi001": "^0.0.1",
"classnames": "^2.5.1",
"dayjs": "^1.11.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router": "^6.22.3",
"react-router-dom": "^6.22.3"
},
"devDependencies": {
"@biomejs/biome": "1.6.4",
"@commitlint/cli": "^19.2.0",
"@arco-plugins/vite-react": "^1.3.3",
"@biomejs/biome": "1.7.0",
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
"@farmfe/cli": "^1.0.0",
"@farmfe/core": "^1.0.18",
"@farmfe/cli": "^1.0.1",
"@farmfe/core": "^1.1.2",
"@farmfe/js-plugin-less": "^1.7.0",
"@farmfe/js-plugin-postcss": "^1.6.0",
"@farmfe/plugin-react": "^1.0.1",
"@types/react": "18",
"@types/react-dom": "18",
"core-js": "^3.30.1",
"@types/react": "^18.2.78",
"@types/react-dom": "^18.2.25",
"autoprefixer": "^10.4.19",
"core-js": "^3.36.1",
"farm-plugin-remove-console": "^0.1.2",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"postcss": "^8.4.38",
"react-refresh": "^0.14.0",
"vite-plugin-pages": "^0.32.0"
"tailwindcss": "^3.4.3",
"vite-plugin-pages": "^0.32.1"
},
"scripts": {
"dev": "farm start",
"start": "farm start",
"build": "farm build",
"preview": "farm preview",
"clean": "farm clean",
"check": "pnpm biome check --apply ./src",
"commitlint": "commitlint --edit"
"lint-staged": {
"*": ["pnpm check"]
}
}
Loading

0 comments on commit c797809

Please sign in to comment.