Skip to content

Commit 1ab5f13

Browse files
committed
feat: 初始化项目
1 parent fd681a3 commit 1ab5f13

19 files changed

+10017
-1865
lines changed

components.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "new-york",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "tailwind.config.js",
8+
"css": "src/assets/css/global.css",
9+
"baseColor": "neutral",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"aliases": {
14+
"components": "@/components",
15+
"utils": "@/lib/utils",
16+
"ui": "@/components/ui",
17+
"lib": "@/lib",
18+
"hooks": "@/hooks"
19+
},
20+
"iconLibrary": "lucide"
21+
}

env.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
declare module '*.svg?svgr' {
2+
import type { FC, SVGProps } from 'react'
3+
const ReactComponent: FC<SVGProps<SVGElement>>
4+
5+
export default ReactComponent
6+
}

eslint.config.mjs

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import next from '@next/eslint-plugin-next';
2+
import { defineConfig } from '@soybeanjs/eslint-config';
3+
import sort from 'eslint-plugin-sort';
4+
5+
const config = defineConfig(
6+
{
7+
prettierRules: {
8+
singleAttributePerLine: true,
9+
trailingCommas: 'none'
10+
},
11+
react: true
12+
},
13+
sort.configs['flat/recommended'],
14+
{
15+
plugins: {
16+
next
17+
},
18+
rules: {
19+
'import/newline-after-import': 'error',
20+
'import/no-absolute-path': 'warn',
21+
'import/no-empty-named-blocks': ['error'],
22+
'import/no-useless-path-segments': [
23+
'error',
24+
{
25+
noUselessIndex: true
26+
}
27+
],
28+
29+
'import/order': [
30+
'error',
31+
{
32+
alphabetize: {
33+
order: 'asc'
34+
},
35+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object'],
36+
'newlines-between': 'always',
37+
pathGroups: [{ group: 'internal', pattern: '{{@,~}/,#}**' }],
38+
pathGroupsExcludedImportTypes: ['builtin']
39+
}
40+
],
41+
42+
'no-underscore-dangle': 'off',
43+
44+
'react/hook-use-state': [
45+
'error', // or "warn" to only warn instead of error
46+
{
47+
allowDestructuredState: true
48+
}
49+
],
50+
51+
'react/jsx-closing-bracket-location': ['warn', 'tag-aligned'],
52+
'react/jsx-closing-tag-location': 'warn',
53+
'react/jsx-curly-brace-presence': [
54+
'warn',
55+
{
56+
children: 'never',
57+
propElementValues: 'always',
58+
props: 'never'
59+
}
60+
],
61+
'react/jsx-curly-newline': ['warn', { multiline: 'consistent', singleline: 'consistent' }],
62+
'react/jsx-equals-spacing': ['warn', 'never'],
63+
'react/jsx-fragments': ['warn', 'syntax'],
64+
'react/jsx-newline': 'warn',
65+
'react/jsx-no-undef': ['off'],
66+
'react/jsx-no-useless-fragment': 'warn',
67+
'react/jsx-one-expression-per-line': [
68+
'warn',
69+
{
70+
allow: 'single-child'
71+
}
72+
],
73+
'react/jsx-props-no-multi-spaces': 'warn',
74+
'react/jsx-sort-props': [
75+
'warn',
76+
{ callbacksLast: true, ignoreCase: true, multiline: 'last', shorthandFirst: true }
77+
],
78+
'react/self-closing-comp': [
79+
'error',
80+
{
81+
component: true,
82+
html: true
83+
}
84+
],
85+
'react-refresh/only-export-components': 'off',
86+
'sort/import-members': ['error', { caseSensitive: true, natural: true }],
87+
'sort/imports': ['off'],
88+
'sort/string-enums': ['error', { caseSensitive: false, natural: true }],
89+
'sort/string-unions': ['error', { caseSensitive: false, natural: true }],
90+
'sort/type-properties': ['warn', { caseSensitive: false, natural: true }],
91+
'sort/type-properties': ['error', { caseSensitive: false, natural: true }]
92+
}
93+
}
94+
);
95+
96+
const eslintConfig = config;
97+
98+
export default eslintConfig;

mdx-components.tsx

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
2+
// @ts-nocheck
3+
4+
import { useMDXComponents as getDocsMDXComponents } from 'nextra-theme-docs'
5+
6+
const {
7+
tr: Tr,
8+
th: Th,
9+
table: Table,
10+
img: Image,
11+
...docsComponents
12+
} = getDocsMDXComponents()
13+
14+
export const useMDXComponents: typeof getDocsMDXComponents = components => ({
15+
...docsComponents,
16+
tr: Tr,
17+
th: Th,
18+
thead({ children, ...props }) {
19+
return (
20+
<thead {...props}>
21+
{children.props.children[0].props.children ? (
22+
children
23+
) : (
24+
<Tr>
25+
<Th align="left">Option</Th>
26+
<Th align="left">Type</Th>
27+
{children.props.children.length === 4 && (
28+
<Th align="left">Default Value</Th>
29+
)}
30+
<Th align="left">Description</Th>
31+
</Tr>
32+
)}
33+
</thead>
34+
)
35+
},
36+
tbody: props => (
37+
<tbody
38+
className="break-words first:[&_td]:font-semibold first:[&_td]:text-violet-600 first:[&_td]:dark:text-violet-500 [&_tr]:!bg-transparent"
39+
{...props}
40+
/>
41+
),
42+
table: props => <Table className="w-full text-sm" {...props} />,
43+
img: props => (
44+
<Image
45+
{...props}
46+
className="nextra-border rounded-xl border drop-shadow-sm"
47+
/>
48+
),
49+
figure: props => <figure className="mt-6" {...props} />,
50+
figcaption: props => (
51+
<figcaption className="mt-2 text-center text-sm" {...props} />
52+
),
53+
...components
54+
})

next-env.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/basic-features/typescript for more information.
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

next.config.mjs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import nextra from 'nextra'
2+
3+
4+
5+
const withNextra = nextra({
6+
// ... Other Nextra config options
7+
})
8+
9+
// You can include other Next.js configuration options here, in addition to Nextra settings:
10+
export default withNextra({
11+
webpack(config) {
12+
// rule.exclude doesn't work starting from Next.js 15
13+
const { test: _test, ...imageLoaderOptions } = config.module.rules.find(
14+
rule => rule.test?.test?.('.svg')
15+
)
16+
config.module.rules.push({
17+
test: /\.svg$/,
18+
oneOf: [
19+
{
20+
resourceQuery: /svgr/,
21+
use: ['@svgr/webpack']
22+
},
23+
imageLoaderOptions
24+
]
25+
})
26+
return config
27+
},
28+
})

package.json

+32-21
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,42 @@
11
{
2-
"name": "nextra-docs-template",
3-
"version": "0.0.1",
4-
"description": "Nextra docs template",
2+
"name": "soybean-admin-react-docs",
3+
"version": "1.0.0",
4+
"description": "Soybean-React-Docs",
5+
"author": "",
6+
"license": "ISC",
7+
"keywords": [],
58
"scripts": {
6-
"dev": "next dev",
79
"build": "next build",
10+
"dev": "next dev",
11+
"lint": "next lint . --fix",
812
"start": "next start"
913
},
10-
"repository": {
11-
"type": "git",
12-
"url": "git+https://github.com/shuding/nextra-docs-template.git"
13-
},
14-
"author": "Shu Ding <[email protected]>",
15-
"license": "MIT",
16-
"bugs": {
17-
"url": "https://github.com/shuding/nextra-docs-template/issues"
18-
},
19-
"homepage": "https://github.com/shuding/nextra-docs-template#readme",
2014
"dependencies": {
21-
"next": "^13.0.6",
22-
"nextra": "latest",
23-
"nextra-theme-docs": "latest",
24-
"react": "^18.2.0",
25-
"react-dom": "^18.2.0"
15+
"@radix-ui/react-slot": "1.1.2",
16+
"class-variance-authority": "0.7.1",
17+
"clsx": "2.1.1",
18+
"lucide-react": "0.479.0",
19+
"next": "15.2.1",
20+
"nextra": "4.2.16",
21+
"nextra-theme-docs": "4.2.16",
22+
"react": "19.0.0",
23+
"react-dom": "19.0.0",
24+
"tailwind-merge": "3.0.2",
25+
"tailwindcss-animate": "1.0.7"
2626
},
2727
"devDependencies": {
28-
"@types/node": "18.11.10",
29-
"typescript": "^4.9.3"
28+
"@eslint/eslintrc": "3.3.0",
29+
"@soybeanjs/eslint-config": "1.5.3",
30+
"@svgr/webpack": "8.1.0",
31+
"@tailwindcss/postcss": "4.0.12",
32+
"@types/node": "22.13.10",
33+
"@types/react": "19.0.10",
34+
"@unocss/eslint-config": "66.1.0-beta.3",
35+
"eslint": "9.22.0",
36+
"eslint-config-next": "15.2.1",
37+
"eslint-plugin-react-refresh": "0.4.19",
38+
"eslint-plugin-sort": "4.0.0",
39+
"tailwindcss": "4.0.12",
40+
"typescript": "5.7.3"
3041
}
3142
}

0 commit comments

Comments
 (0)