create-lik-app 1.0.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. package/dist/index.mjs +73 -73
  2. package/package.json +2 -3
  3. package/templates/template-react/_gitignore +3 -0
  4. package/templates/template-react/{plugins/index.ts → config/build/_base.ts} +16 -4
  5. package/templates/template-react/config/build/development.ts +7 -0
  6. package/templates/template-react/config/build/production.ts +1 -0
  7. package/templates/template-react/config/build/test.ts +1 -0
  8. package/templates/template-react/src/components/Lic/index.tsx +1 -1
  9. package/templates/template-react/src/main.tsx +1 -1
  10. package/templates/template-react/src/store/index.ts +1 -2
  11. package/templates/template-react/src/styles/main.css +10 -0
  12. package/templates/template-react/{types → src/types}/auto-imports.d.ts +21 -0
  13. package/templates/template-react/src/views/Home/components/React/index.tsx +2 -3
  14. package/templates/template-react/src/views/Home/index.tsx +0 -1
  15. package/templates/template-react/src/views/Layout/index.tsx +0 -1
  16. package/templates/template-react/tsconfig.node.json +1 -6
  17. package/templates/template-react/vite.config.ts +13 -16
  18. package/templates/template-react-tanstack-jotai/.husky/commit-msg +6 -0
  19. package/templates/template-react-tanstack-jotai/.husky/lintstagedrc.cjs +8 -0
  20. package/templates/template-react-tanstack-jotai/.husky/pre-commit +10 -0
  21. package/templates/template-react-tanstack-jotai/.prettierignore +13 -0
  22. package/templates/template-react-tanstack-jotai/.vscode/extensions.json +5 -0
  23. package/templates/template-react-tanstack-jotai/README.md +40 -0
  24. package/templates/template-react-tanstack-jotai/_gitignore +27 -0
  25. package/templates/template-react-tanstack-jotai/commitlint.config.mjs +28 -0
  26. package/templates/template-react-tanstack-jotai/config/build/_base.ts +38 -0
  27. package/templates/template-react-tanstack-jotai/config/build/development.ts +7 -0
  28. package/templates/template-react-tanstack-jotai/config/build/production.ts +1 -0
  29. package/templates/template-react-tanstack-jotai/config/build/test.ts +1 -0
  30. package/templates/template-react-tanstack-jotai/config/uno/rules.ts +127 -0
  31. package/templates/template-react-tanstack-jotai/env/.env +0 -0
  32. package/templates/template-react-tanstack-jotai/env/.env.development +2 -0
  33. package/templates/template-react-tanstack-jotai/env/.env.production +1 -0
  34. package/templates/template-react-tanstack-jotai/eslint.config.mjs +44 -0
  35. package/templates/template-react-tanstack-jotai/index.html +13 -0
  36. package/templates/template-react-tanstack-jotai/package.json +52 -0
  37. package/templates/template-react-tanstack-jotai/prettier.config.mjs +11 -0
  38. package/templates/template-react-tanstack-jotai/public/lic.svg +1263 -0
  39. package/templates/template-react-tanstack-jotai/public/react.svg +1 -0
  40. package/templates/template-react-tanstack-jotai/public/vite.svg +1 -0
  41. package/templates/template-react-tanstack-jotai/src/assets/react.svg +1 -0
  42. package/templates/template-react-tanstack-jotai/src/components/Lic/index.tsx +12 -0
  43. package/templates/template-react-tanstack-jotai/src/libs/gsap/index.ts +6 -0
  44. package/templates/template-react-tanstack-jotai/src/main.tsx +23 -0
  45. package/templates/template-react-tanstack-jotai/src/routeTree.gen.ts +145 -0
  46. package/templates/template-react-tanstack-jotai/src/routes/__root.tsx +11 -0
  47. package/templates/template-react-tanstack-jotai/src/routes/_layout/about.tsx +6 -0
  48. package/templates/template-react-tanstack-jotai/src/routes/_layout/index.tsx +6 -0
  49. package/templates/template-react-tanstack-jotai/src/routes/_layout.tsx +23 -0
  50. package/templates/template-react-tanstack-jotai/src/store/index.ts +1 -0
  51. package/templates/template-react-tanstack-jotai/src/store/module/favorite.ts +5 -0
  52. package/templates/template-react-tanstack-jotai/src/styles/animation.css +8 -0
  53. package/templates/template-react-tanstack-jotai/src/styles/variable.css +21 -0
  54. package/templates/template-react-tanstack-jotai/src/types/auto-imports.d.ts +33 -0
  55. package/templates/template-react-tanstack-jotai/src/types/color.d.ts +1 -0
  56. package/templates/template-react-tanstack-jotai/src/utils/rainbow-print.ts +10 -0
  57. package/templates/template-react-tanstack-jotai/src/views/404/index.tsx +18 -0
  58. package/templates/template-react-tanstack-jotai/src/views/About/index.tsx +7 -0
  59. package/templates/template-react-tanstack-jotai/src/views/Index/Button/index.tsx +24 -0
  60. package/templates/template-react-tanstack-jotai/src/views/Index/React/index.tsx +18 -0
  61. package/templates/template-react-tanstack-jotai/src/views/Index/Vite/index.tsx +20 -0
  62. package/templates/template-react-tanstack-jotai/src/views/Index/index.tsx +50 -0
  63. package/templates/template-react-tanstack-jotai/tsconfig.app.json +36 -0
  64. package/templates/template-react-tanstack-jotai/tsconfig.json +7 -0
  65. package/templates/template-react-tanstack-jotai/tsconfig.node.json +24 -0
  66. package/templates/template-react-tanstack-jotai/types/vite-env.d.ts +10 -0
  67. package/templates/template-react-tanstack-jotai/uno.config.ts +40 -0
  68. package/templates/template-react-tanstack-jotai/vite.config.ts +15 -0
  69. package/templates/template-vue/_gitignore +3 -0
  70. package/templates/template-vue/config/build/_base.ts +42 -0
  71. package/templates/template-vue/config/build/development.ts +7 -0
  72. package/templates/template-vue/config/build/production.ts +1 -0
  73. package/templates/template-vue/config/build/test.ts +1 -0
  74. package/templates/template-vue/plugins/index.ts +0 -28
  75. package/templates/template-vue/src/types/components.d.ts +21 -0
  76. package/templates/template-vue/tsconfig.node.json +1 -1
  77. package/templates/template-vue/vite.config.ts +13 -14
  78. package/templates/template-react/src/store/module/counter.ts +0 -20
  79. package/templates/template-vue/types/components.d.ts +0 -21
  80. /package/templates/{template-react/src/styles/mian.css → template-react-tanstack-jotai/src/styles/main.css} +0 -0
  81. /package/templates/template-vue/{types → src/types}/auto-imports.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-lik-app",
3
- "version": "1.0.2",
3
+ "version": "1.1.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "licheung228 <licheung228@163.com>",
@@ -28,8 +28,7 @@
28
28
  "cross-spawn": "^7.0.6",
29
29
  "minimist": "^1.2.8",
30
30
  "picocolors": "^1.1.1",
31
- "prompts": "^2.4.2",
32
- "unbuild": "^2.0.0"
31
+ "prompts": "^2.4.2"
33
32
  },
34
33
  "scripts": {
35
34
  "build": "unbuild",
@@ -22,3 +22,6 @@ dist-ssr
22
22
  *.njsproj
23
23
  *.sln
24
24
  *.sw?
25
+
26
+ # types
27
+ types/auto-imports.d.ts
@@ -1,9 +1,12 @@
1
+ import { defineConfig } from 'vite'
2
+ import type { Plugin } from 'vite'
1
3
  import react from '@vitejs/plugin-react'
2
4
  import unocss from 'unocss/vite'
3
- import type { PluginOption } from 'vite'
4
5
  import AutoImport from 'unplugin-auto-import/vite'
6
+ import path from 'node:path'
7
+ import process from 'node:process'
5
8
 
6
- export const createPlugins = (): PluginOption[] => [
9
+ const basePlugins: Plugin[] = [
7
10
  react({
8
11
  babel: {
9
12
  plugins: [
@@ -17,8 +20,17 @@ export const createPlugins = (): PluginOption[] => [
17
20
  include: [
18
21
  /\.[tj]sx?$/ // .ts, .tsx, .js, .jsx
19
22
  ],
20
- imports: ['react', 'react-router-dom'],
23
+ imports: ['react', 'react-router-dom', 'mobx', 'mobx-react-lite'],
21
24
  // 为true时在项目根目录自动创建
22
- dts: 'types/auto-imports.d.ts'
25
+ dts: 'src/types/auto-imports.d.ts'
23
26
  })
24
27
  ]
28
+
29
+ export default defineConfig({
30
+ plugins: basePlugins,
31
+ resolve: {
32
+ alias: {
33
+ '@': path.resolve(process.cwd(), 'src')
34
+ }
35
+ }
36
+ })
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'vite';
2
+
3
+ export default defineConfig({
4
+ server: {
5
+ port: 8220
6
+ }
7
+ });
@@ -0,0 +1 @@
1
+ export default {};
@@ -0,0 +1 @@
1
+ export default {}
@@ -4,7 +4,7 @@ const Lic: FC<{ favorite: string }> = ({ favorite }) => {
4
4
  return (
5
5
  <div className="animate-keyframes-bounce-in animate-duration-1000 animate-count-1 flex-center flex-col">
6
6
  <img className="w-30" src="/lic.svg" alt="liclogo" />
7
- <p className="text-8xl mt6">{favorite.toUpperCase()}</p>
7
+ <p className="sm:text-8xl text-xl mt6">{favorite.toUpperCase()}</p>
8
8
  </div>
9
9
  )
10
10
  }
@@ -1,6 +1,6 @@
1
1
  import 'virtual:uno.css'
2
2
  import '@unocss/reset/tailwind.css'
3
- import '@/styles/mian.css'
3
+ import '@/styles/main.css'
4
4
  import { StrictMode } from 'react'
5
5
  import { createRoot } from 'react-dom/client'
6
6
  import App from './App.tsx'
@@ -1,2 +1 @@
1
- export * from './module/counter'
2
- export * from './module/favorite'
1
+ export * from './module/favorite';
@@ -0,0 +1,10 @@
1
+ @import './variable.css';
2
+ @import './animation.css';
3
+
4
+ html,
5
+ body,
6
+ #root {
7
+ height: 100vh;
8
+ width: 100vw;
9
+ color: var(--lic-color-text-muted);
10
+ }
@@ -9,14 +9,33 @@ declare global {
9
9
  const Link: typeof import('react-router-dom')['Link']
10
10
  const NavLink: typeof import('react-router-dom')['NavLink']
11
11
  const Navigate: typeof import('react-router-dom')['Navigate']
12
+ const Observer: typeof import('mobx-react-lite')['Observer']
12
13
  const Outlet: typeof import('react-router-dom')['Outlet']
13
14
  const Route: typeof import('react-router-dom')['Route']
14
15
  const Routes: typeof import('react-router-dom')['Routes']
16
+ const action: typeof import('mobx')['action']
17
+ const autorun: typeof import('mobx')['autorun']
18
+ const computed: typeof import('mobx')['computed']
15
19
  const createRef: typeof import('react')['createRef']
20
+ const extendObservable: typeof import('mobx')['extendObservable']
21
+ const flow: typeof import('mobx')['flow']
22
+ const flowResult: typeof import('mobx')['flowResult']
16
23
  const forwardRef: typeof import('react')['forwardRef']
24
+ const intercept: typeof import('mobx')['intercept']
17
25
  const lazy: typeof import('react')['lazy']
26
+ const makeAutoObservable: typeof import('mobx')['makeAutoObservable']
27
+ const makeObservable: typeof import('mobx')['makeObservable']
18
28
  const memo: typeof import('react')['memo']
29
+ const observable: typeof import('mobx')['observable']
30
+ const observe: typeof import('mobx')['observe']
31
+ const observer: typeof import('mobx-react-lite')['observer']
32
+ const onBecomeObserved: typeof import('mobx')['onBecomeObserved']
33
+ const onBecomeUnobserved: typeof import('mobx')['onBecomeUnobserved']
34
+ const onReactionError: typeof import('mobx')['onReactionError']
35
+ const reaction: typeof import('mobx')['reaction']
36
+ const runInAction: typeof import('mobx')['runInAction']
19
37
  const startTransition: typeof import('react')['startTransition']
38
+ const toJS: typeof import('mobx')['toJS']
20
39
  const useCallback: typeof import('react')['useCallback']
21
40
  const useContext: typeof import('react')['useContext']
22
41
  const useDebugValue: typeof import('react')['useDebugValue']
@@ -29,6 +48,7 @@ declare global {
29
48
  const useInsertionEffect: typeof import('react')['useInsertionEffect']
30
49
  const useLayoutEffect: typeof import('react')['useLayoutEffect']
31
50
  const useLinkClickHandler: typeof import('react-router-dom')['useLinkClickHandler']
51
+ const useLocalObservable: typeof import('mobx-react-lite')['useLocalObservable']
32
52
  const useLocation: typeof import('react-router-dom')['useLocation']
33
53
  const useMemo: typeof import('react')['useMemo']
34
54
  const useNavigate: typeof import('react-router-dom')['useNavigate']
@@ -44,4 +64,5 @@ declare global {
44
64
  const useState: typeof import('react')['useState']
45
65
  const useSyncExternalStore: typeof import('react')['useSyncExternalStore']
46
66
  const useTransition: typeof import('react')['useTransition']
67
+ const when: typeof import('mobx')['when']
47
68
  }
@@ -1,12 +1,11 @@
1
1
  import { favoriteStore } from '@/store'
2
- import { observer } from 'mobx-react-lite'
3
2
  import type { FC } from 'react'
4
3
 
5
4
  const React: FC = observer(() => {
6
5
  return (
7
- <div className={`scale-${favoriteStore.favorite === 'react'}`}>
6
+ <div>
8
7
  <img
9
- className="w-30 animate-spin animate-duration-2000"
8
+ className={`w-30 ${favoriteStore.favorite === 'react' ? 'animate-spin' : ''} animate-duration-2000`}
10
9
  src="/react.svg"
11
10
  alt="reactlogo"
12
11
  />
@@ -1,4 +1,3 @@
1
- import { observer } from 'mobx-react-lite'
2
1
  import { type FC } from 'react'
3
2
  import Lic from '@/components/Lic'
4
3
  import { favoriteStore } from '@/store'
@@ -1,5 +1,4 @@
1
1
  import { type FC } from 'react'
2
- import { Outlet, Link } from 'react-router-dom'
3
2
 
4
3
  const Layout: FC = () => {
5
4
  return (
@@ -20,10 +20,5 @@
20
20
  "noUnusedParameters": true,
21
21
  "noFallthroughCasesInSwitch": true
22
22
  },
23
- "include": [
24
- "vite.config.ts",
25
- "./config/**/*.ts",
26
- "./plugins/*.ts",
27
- "./types/*.d.ts"
28
- ]
23
+ "include": ["vite.config.ts", "./config/**/*.ts", "./types/*.d.ts"]
29
24
  }
@@ -1,18 +1,15 @@
1
- import { defineConfig } from 'vite'
2
-
3
- import path from 'node:path'
4
- import process from 'node:process'
5
- import { createPlugins } from './plugins'
1
+ import { defineConfig, loadConfigFromFile, mergeConfig } from 'vite'
2
+ import _base from './config/build/_base'
6
3
 
7
4
  // https://vite.dev/config/
8
- export default defineConfig(() => ({
9
- plugins: createPlugins(),
10
- resolve: {
11
- alias: {
12
- '@': path.resolve(process.cwd(), '/src')
13
- }
14
- },
15
- server: {
16
- port: 8220
17
- }
18
- }))
5
+ export default defineConfig(async (configEnv) => {
6
+ if (configEnv.mode === '_base')
7
+ throw new Error('base config is not allowed to be used directly')
8
+
9
+ const re = await loadConfigFromFile(
10
+ configEnv,
11
+ `config/build/${configEnv.mode}.ts`
12
+ )
13
+
14
+ return mergeConfig(_base, re?.config ?? {})
15
+ })
@@ -0,0 +1,6 @@
1
+ BG_COLOR='\e[42m'
2
+ RESET='\e[0m'
3
+
4
+ npx --no -- commitlint --edit $1
5
+
6
+ printf "\n${BG_COLOR}${FG_COLOR} >>>>>> Commit Lint Success <<<<<< ${RESET}\n"
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ '*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
3
+ '{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': ['prettier --parser json --write'],
4
+ 'package.json': ['prettier --write'],
5
+ // '*.{scss,less,styl,css,html}': ['stylelint --fix', 'prettier --write'],
6
+ '*.md': ['prettier --write'],
7
+ '*.hbs': ['prettier --write']
8
+ }
@@ -0,0 +1,10 @@
1
+ BG_COLOR='\e[42m' # 背景色
2
+ RESET='\e[0m' # 重置所有格式
3
+
4
+ npx tsc
5
+
6
+ printf "\n${BG_COLOR}${FG_COLOR} >>>>>> TS Check Success <<<<<< ${RESET}\r\n\n"
7
+
8
+ pnpm run lint
9
+
10
+ printf "\n${BG_COLOR}${FG_COLOR} >>>>>> Code Lint Success <<<<<< ${RESET}\r\n\n"
@@ -0,0 +1,13 @@
1
+ node_modules
2
+ .idea
3
+ .vscode
4
+ .DS_Store
5
+
6
+ .git/node_modules/**
7
+ /dist/
8
+ /dist*
9
+ /public/*
10
+ /docs/*
11
+ /docs/**/*
12
+ /plop/**/*
13
+ CHANGELOG
@@ -0,0 +1,5 @@
1
+ {
2
+ "recommendations": [
3
+ "antfu.unocss"
4
+ ]
5
+ }
@@ -0,0 +1,40 @@
1
+ # Lic-Blog
2
+
3
+ ## @/components
4
+
5
+ the common components / pages components
6
+
7
+ ### Naming
8
+
9
+ **common components**
10
+
11
+ dirname start with lower case
12
+
13
+ **views components**
14
+
15
+ - in the views directory
16
+ - dirname start with upper case
17
+ - correspondence to the layout route name
18
+
19
+ ## commit standard
20
+
21
+ ### lint
22
+
23
+ - eslint
24
+ - prettier
25
+ - lint-staged
26
+
27
+ ### commit lint
28
+
29
+ - @commitlint/cli
30
+ - @commitlint/config-conventional
31
+
32
+ ## the commit message should be
33
+
34
+ - "feat: xxx" add xxx
35
+ - "fix: xxx" fix bug xxx
36
+ - "docs: xxx" add docs
37
+ - "style: xxx" style change
38
+ - "refactor: xxx" refactor code
39
+
40
+ ... and more in /commitlint.config.mjs
@@ -0,0 +1,27 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?
25
+
26
+ # types
27
+ types/auto-imports.d.ts
@@ -0,0 +1,28 @@
1
+ export default {
2
+ extends: ['@commitlint/config-conventional'],
3
+ rules: {
4
+ 'type-enum': [
5
+ 2,
6
+ 'always',
7
+ [
8
+ 'feat', // 新功能(feature)
9
+ 'fix', // 修补bug
10
+ 'docs', // 文档(documentation)
11
+ 'style', // 格式、样式(不影响代码运行的变动)
12
+ 'refactor', // 重构(即不是新增功能,也不是修改BUG的代码)
13
+ 'perf', // 优化相关,比如提升性能、体验
14
+ 'test', // 添加测试
15
+ 'ci', // 持续集成修改
16
+ 'chore', // 构建过程或辅助工具的变动
17
+ 'revert', // 回滚到上一个版本
18
+ 'workflow', // 工作流改进
19
+ 'mod', // 不确定分类的修改
20
+ 'wip', // 开发中
21
+ 'types', // 类型修改
22
+ 'release' // 版本发布
23
+ ]
24
+ ],
25
+ 'subject-full-stop': [0, 'never'],
26
+ 'subject-case': [0, 'never']
27
+ }
28
+ }
@@ -0,0 +1,38 @@
1
+ import { defineConfig } from 'vite';
2
+ import type { Plugin } from 'vite';
3
+ import react from '@vitejs/plugin-react';
4
+ import unocss from 'unocss/vite';
5
+ import { TanStackRouterVite } from '@tanstack/router-plugin/vite';
6
+ import AutoImport from 'unplugin-auto-import/vite';
7
+ import path from 'node:path';
8
+ import process from 'node:process';
9
+
10
+ const basePlugins: Plugin[] = [
11
+ react({
12
+ babel: {
13
+ plugins: [
14
+ ['@babel/plugin-proposal-decorators', { legacy: true }]
15
+ // ['@babel/plugin-proposal-class-properties', { loose: true }]
16
+ ]
17
+ }
18
+ }),
19
+ unocss(),
20
+ TanStackRouterVite(),
21
+ AutoImport({
22
+ include: [
23
+ /\.[tj]sx?$/ // .ts, .tsx, .js, .jsx
24
+ ],
25
+ imports: ['react', 'jotai'],
26
+ // 为true时在项目根目录自动创建
27
+ dts: 'src/types/auto-imports.d.ts'
28
+ })
29
+ ];
30
+
31
+ export default defineConfig({
32
+ plugins: basePlugins,
33
+ resolve: {
34
+ alias: {
35
+ '@': path.resolve(process.cwd(), 'src')
36
+ }
37
+ }
38
+ });
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'vite';
2
+
3
+ export default defineConfig({
4
+ server: {
5
+ port: 8220
6
+ }
7
+ });
@@ -0,0 +1 @@
1
+ export default {};
@@ -0,0 +1,127 @@
1
+ import type { Rule } from 'unocss';
2
+
3
+ const link: Rule[] = [
4
+ [
5
+ 'linkPrimary',
6
+ {
7
+ color: 'var(--lic-color-primary)',
8
+ 'text-decoration': 'none',
9
+ transition: 'color 0.3s ease'
10
+ }
11
+ ],
12
+ [
13
+ 'linkHover',
14
+ {
15
+ color: 'var(--lic-color-primary-hover)'
16
+ }
17
+ ],
18
+ [
19
+ 'linkActive',
20
+ {
21
+ color: 'var(--lic-color-primary-highlight)'
22
+ }
23
+ ],
24
+ [
25
+ 'linkVisited',
26
+ {
27
+ color: 'var(--lic-color-primary-deep)',
28
+ 'text-decoration': 'underline'
29
+ }
30
+ ],
31
+ [
32
+ 'linkDisabledHover',
33
+ {
34
+ color: 'var(--lic-color-text-muted)'
35
+ }
36
+ ],
37
+ [
38
+ 'linkIsActive',
39
+ {
40
+ 'text-decoration': 'underline',
41
+ 'text-decoration-style': 'double',
42
+ 'text-decoration-color': 'var(--lic-color-primary-highlight)'
43
+ }
44
+ ]
45
+ ];
46
+
47
+ const btn: Rule[] = [
48
+ [
49
+ 'btnPrimary',
50
+ {
51
+ /* 按钮的默认背景色为主题色 */
52
+ 'background-color': 'var(--lic-color-primary)',
53
+ /* 文字颜色为白色,以保证在主题色背景上的可读性 */
54
+ color: 'white',
55
+ /* 去除默认边框 */
56
+ border: 'none',
57
+ /* 设置内边距,使按钮内容有合适的空间 */
58
+ padding: '10px 20px',
59
+ /* 设置按钮的圆角半径,使其外观更圆润 */
60
+ 'border-radius': '5px',
61
+ /* 设置过渡效果,当按钮状态改变时(如悬停),背景色的变化会有平滑过渡 */
62
+ transition: 'background-color 0.3s ease',
63
+ /* 设置鼠标指针样式为手型,表示可点击 */
64
+ cursor: 'pointer'
65
+ }
66
+ ],
67
+ [
68
+ 'btnHover',
69
+ {
70
+ /* 当鼠标悬停在按钮上时,背景色变为主题色的悬停色调 */
71
+ 'background-color': 'var(--lic-color-primary-hover)'
72
+ }
73
+ ],
74
+ [
75
+ 'btnActive',
76
+ {
77
+ /* 当按钮被按下时,背景色变为主题色的高亮色调 */
78
+ 'background-color': 'var(--lic-color-primary-highlight)'
79
+ }
80
+ ],
81
+ [
82
+ 'btnDisabled',
83
+ {
84
+ /* 当按钮处于禁用状态时 */
85
+ /* 背景色变为较浅的、用于表示禁用的色调 */
86
+ 'background-color': 'var(--lic-color-background-muted)',
87
+ /* 文字颜色变为表示禁用的文本颜色 */
88
+ color: 'var(--lic-color-text-disabled)',
89
+ /* 鼠标指针变为不可用样式 */
90
+ cursor: 'not-allowed'
91
+ }
92
+ ]
93
+ ];
94
+
95
+ const success: Rule[] = [
96
+ [
97
+ 'success',
98
+ {
99
+ 'background-color': 'var(--lic-color-success)',
100
+ color: 'var(--lic-color-text-inverse) !important'
101
+ }
102
+ ],
103
+ [
104
+ 'successHover',
105
+ {
106
+ 'background-color': 'var(--lic-color-success-hover)'
107
+ }
108
+ ]
109
+ ];
110
+
111
+ const active: Rule[] = [
112
+ [
113
+ 'active',
114
+ {
115
+ 'background-color': 'var(--lic-color-primary-highlight)'
116
+ }
117
+ ]
118
+ ];
119
+
120
+ const rules: Record<string, Rule[]> = {
121
+ link,
122
+ btn,
123
+ success,
124
+ active
125
+ };
126
+
127
+ export default rules;
@@ -0,0 +1,2 @@
1
+ VITE_APP_DOMAIN="https://api.example.com"
2
+ VITE_APP_SSL=""
@@ -0,0 +1 @@
1
+ VITE_APP_DOMAIN="https://api.example.com"
@@ -0,0 +1,44 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+ import tseslint from 'typescript-eslint'
6
+ import prettier from 'eslint-plugin-prettier'
7
+ import prettierConfig from './prettier.config.mjs'
8
+
9
+ export default tseslint.config(
10
+ { ignores: ['dist', 'node_modules'] },
11
+ {
12
+ extends: [js.configs.recommended, ...tseslint.configs.recommended],
13
+ files: ['**/*.{ts,tsx}'],
14
+ languageOptions: {
15
+ ecmaVersion: 2020,
16
+ globals: globals.browser
17
+ },
18
+ plugins: {
19
+ prettier,
20
+ 'react-hooks': reactHooks,
21
+ 'react-refresh': reactRefresh
22
+ },
23
+ rules: {
24
+ 'prettier/prettier': ['error', prettierConfig],
25
+ 'no-useless-escape': 'error',
26
+ // 'no-undef': 'error', // for unplugin-auto-import
27
+ 'no-unused-vars': 'error',
28
+ '@typescript-eslint/consistent-type-imports': 'error', // 要求 import type
29
+ '@typescript-eslint/no-use-before-define': 'error',
30
+ '@typescript-eslint/ban-ts-comment': 'error',
31
+ '@typescript-eslint/no-non-null-assertion': 'error',
32
+ '@typescript-eslint/explicit-module-boundary-types': 'error',
33
+ '@typescript-eslint/no-unused-vars': 'error',
34
+ '@typescript-eslint/no-explicit-any': 'error',
35
+ '@typescript-eslint/no-var-requires': 'error',
36
+ '@typescript-eslint/no-empty-function': 'error',
37
+ ...reactHooks.configs.recommended.rules,
38
+ 'react-refresh/only-export-components': [
39
+ 'warn',
40
+ { allowConstantExport: true }
41
+ ]
42
+ }
43
+ }
44
+ )
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/lic.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Lic-Vite-React-Jotai-Tanstack</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>