create-lik-app 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. package/dist/index.mjs +73 -73
  2. package/package.json +7 -9
  3. package/templates/.gitignore +1 -0
  4. package/templates/template-react/_gitignore +3 -0
  5. package/templates/template-react/env/.env +0 -0
  6. package/templates/template-react/env/.env.development +1 -0
  7. package/templates/template-react/env/.env.production +1 -0
  8. package/templates/template-react/eslint.config.mjs +1 -1
  9. package/templates/template-react/package.json +1 -0
  10. package/templates/template-react/plugins/index.ts +24 -0
  11. package/templates/template-react/src/main.tsx +1 -1
  12. package/templates/template-react/src/store/index.ts +1 -2
  13. package/templates/template-react/src/styles/main.css +10 -0
  14. package/templates/template-react/src/views/Home/components/React/index.tsx +3 -3
  15. package/templates/template-react/src/views/Home/index.tsx +7 -1
  16. package/templates/template-react/tsconfig.app.json +1 -1
  17. package/templates/template-react/tsconfig.node.json +6 -1
  18. package/templates/template-react/types/auto-imports.d.ts +47 -0
  19. package/templates/template-react/types/vite-env.d.ts +9 -0
  20. package/templates/template-react/vite.config.ts +6 -16
  21. package/templates/template-react-tanstack-jotai/.husky/commit-msg +6 -0
  22. package/templates/template-react-tanstack-jotai/.husky/lintstagedrc.cjs +8 -0
  23. package/templates/template-react-tanstack-jotai/.husky/pre-commit +10 -0
  24. package/templates/template-react-tanstack-jotai/.prettierignore +13 -0
  25. package/templates/template-react-tanstack-jotai/.vscode/extensions.json +5 -0
  26. package/templates/template-react-tanstack-jotai/README.md +40 -0
  27. package/templates/template-react-tanstack-jotai/_gitignore +27 -0
  28. package/templates/template-react-tanstack-jotai/commitlint.config.mjs +28 -0
  29. package/templates/template-react-tanstack-jotai/config/uno/rules.ts +127 -0
  30. package/templates/template-react-tanstack-jotai/env/.env +0 -0
  31. package/templates/template-react-tanstack-jotai/env/.env.development +1 -0
  32. package/templates/template-react-tanstack-jotai/env/.env.production +1 -0
  33. package/templates/template-react-tanstack-jotai/eslint.config.mjs +44 -0
  34. package/templates/template-react-tanstack-jotai/index.html +13 -0
  35. package/templates/template-react-tanstack-jotai/package.json +51 -0
  36. package/templates/template-react-tanstack-jotai/plugins/index.ts +26 -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/color.d.ts +1 -0
  55. package/templates/template-react-tanstack-jotai/src/utils/rainbow-print.ts +10 -0
  56. package/templates/template-react-tanstack-jotai/src/views/404/index.tsx +18 -0
  57. package/templates/template-react-tanstack-jotai/src/views/About/index.tsx +7 -0
  58. package/templates/template-react-tanstack-jotai/src/views/Index/Button/index.tsx +24 -0
  59. package/templates/template-react-tanstack-jotai/src/views/Index/React/index.tsx +18 -0
  60. package/templates/template-react-tanstack-jotai/src/views/Index/Vite/index.tsx +20 -0
  61. package/templates/template-react-tanstack-jotai/src/views/Index/index.tsx +50 -0
  62. package/templates/template-react-tanstack-jotai/tsconfig.app.json +36 -0
  63. package/templates/template-react-tanstack-jotai/tsconfig.json +7 -0
  64. package/templates/template-react-tanstack-jotai/tsconfig.node.json +29 -0
  65. package/templates/template-react-tanstack-jotai/types/auto-imports.d.ts +47 -0
  66. package/templates/template-react-tanstack-jotai/types/vite-env.d.ts +9 -0
  67. package/templates/template-react-tanstack-jotai/uno.config.ts +40 -0
  68. package/templates/template-react-tanstack-jotai/vite.config.ts +18 -0
  69. package/templates/template-vue/.husky/commit-msg +1 -0
  70. package/templates/template-vue/.husky/lintstagedrc.cjs +15 -0
  71. package/templates/template-vue/.husky/pre-commit +10 -0
  72. package/templates/template-vue/.prettierrc.json +6 -0
  73. package/templates/template-vue/.vscode/extensions.json +8 -0
  74. package/templates/template-vue/README.md +39 -0
  75. package/templates/template-vue/_gitignore +33 -0
  76. package/templates/template-vue/commitlint.config.mjs +33 -0
  77. package/templates/template-vue/env/.env +0 -0
  78. package/templates/template-vue/env/.env.development +0 -0
  79. package/templates/template-vue/env/.env.production +0 -0
  80. package/templates/template-vue/env/.env.test +1 -0
  81. package/templates/template-vue/eslint.config.js +24 -0
  82. package/templates/template-vue/index.html +13 -0
  83. package/templates/template-vue/package.json +45 -0
  84. package/templates/template-vue/plugins/index.ts +28 -0
  85. package/templates/template-vue/public/lic.svg +1263 -0
  86. package/templates/template-vue/src/App.vue +87 -0
  87. package/templates/template-vue/src/assets/base.css +86 -0
  88. package/templates/template-vue/src/assets/logo.svg +1 -0
  89. package/templates/template-vue/src/assets/main.css +35 -0
  90. package/templates/template-vue/src/components/HelloWorld.vue +43 -0
  91. package/templates/template-vue/src/components/TheWelcome.vue +121 -0
  92. package/templates/template-vue/src/components/WelcomeItem.vue +87 -0
  93. package/templates/template-vue/src/components/icons/IconCommunity.vue +12 -0
  94. package/templates/template-vue/src/components/icons/IconDocumentation.vue +12 -0
  95. package/templates/template-vue/src/components/icons/IconEcosystem.vue +12 -0
  96. package/templates/template-vue/src/components/icons/IconSupport.vue +12 -0
  97. package/templates/template-vue/src/components/icons/IconTooling.vue +19 -0
  98. package/templates/template-vue/src/main.ts +14 -0
  99. package/templates/template-vue/src/router/index.ts +23 -0
  100. package/templates/template-vue/src/stores/index.ts +8 -0
  101. package/templates/template-vue/src/stores/module/counter.ts +12 -0
  102. package/templates/template-vue/src/views/AboutView.vue +15 -0
  103. package/templates/template-vue/src/views/HomeView.vue +7 -0
  104. package/templates/template-vue/tsconfig.app.json +13 -0
  105. package/templates/template-vue/tsconfig.json +11 -0
  106. package/templates/template-vue/tsconfig.node.json +19 -0
  107. package/templates/template-vue/types/auto-imports.d.ts +309 -0
  108. package/templates/template-vue/types/components.d.ts +21 -0
  109. package/templates/template-vue/types/env.d.ts +9 -0
  110. package/templates/template-vue/vite.config.ts +16 -0
  111. package/templates/template-react/src/store/module/counter.ts +0 -20
  112. package/templates/template-react/src/vite-env.d.ts +0 -1
  113. /package/templates/{template-react/src/styles/mian.css → template-react-tanstack-jotai/src/styles/main.css} +0 -0
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "create-lik-app",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
- "license": "ISC",
5
+ "license": "MIT",
6
6
  "author": "licheung228 <licheung228@163.com>",
7
7
  "bin": {
8
8
  "create-lik-app": "index.js"
@@ -15,11 +15,6 @@
15
15
  "templates/**"
16
16
  ],
17
17
  "description": "create command for licheung",
18
- "scripts": {
19
- "build": "unbuild",
20
- "update-templates": "node scripts/update.mjs",
21
- "prepublishOnly": "pnpm build && pnpm update-templates"
22
- },
23
18
  "keywords": [
24
19
  "create",
25
20
  "vite vue project",
@@ -33,7 +28,10 @@
33
28
  "cross-spawn": "^7.0.6",
34
29
  "minimist": "^1.2.8",
35
30
  "picocolors": "^1.1.1",
36
- "prompts": "^2.4.2",
37
- "unbuild": "^2.0.0"
31
+ "prompts": "^2.4.2"
32
+ },
33
+ "scripts": {
34
+ "build": "unbuild",
35
+ "update:templates": "node scripts/update.mjs"
38
36
  }
39
37
  }
@@ -0,0 +1 @@
1
+ */node_modules
@@ -22,3 +22,6 @@ dist-ssr
22
22
  *.njsproj
23
23
  *.sln
24
24
  *.sw?
25
+
26
+ # types
27
+ types/auto-imports.d.ts
File without changes
@@ -0,0 +1 @@
1
+ VITE_APP_DOMAIN="https://api.example.com"
@@ -0,0 +1 @@
1
+ VITE_APP_DOMAIN="https://api.example.com"
@@ -23,7 +23,7 @@ export default tseslint.config(
23
23
  rules: {
24
24
  'prettier/prettier': ['error', prettierConfig],
25
25
  'no-useless-escape': 'error',
26
- 'no-undef': 'error',
26
+ // 'no-undef': 'error', // for unplugin-auto-import
27
27
  'no-unused-vars': 'error',
28
28
  '@typescript-eslint/consistent-type-imports': 'error', // 要求 import type
29
29
  '@typescript-eslint/no-use-before-define': 'error',
@@ -44,6 +44,7 @@
44
44
  "typescript": "~5.6.2",
45
45
  "typescript-eslint": "^8.13.0",
46
46
  "unocss": "^0.64.0",
47
+ "unplugin-auto-import": "^0.18.6",
47
48
  "vite": "^5.4.10"
48
49
  }
49
50
  }
@@ -0,0 +1,24 @@
1
+ import react from '@vitejs/plugin-react'
2
+ import unocss from 'unocss/vite'
3
+ import type { PluginOption } from 'vite'
4
+ import AutoImport from 'unplugin-auto-import/vite'
5
+
6
+ export const createPlugins = (): PluginOption[] => [
7
+ react({
8
+ babel: {
9
+ plugins: [
10
+ ['@babel/plugin-proposal-decorators', { legacy: true }]
11
+ // ['@babel/plugin-proposal-class-properties', { loose: true }]
12
+ ]
13
+ }
14
+ }),
15
+ unocss(),
16
+ AutoImport({
17
+ include: [
18
+ /\.[tj]sx?$/ // .ts, .tsx, .js, .jsx
19
+ ],
20
+ imports: ['react', 'react-router-dom'],
21
+ // 为true时在项目根目录自动创建
22
+ dts: 'types/auto-imports.d.ts'
23
+ })
24
+ ]
@@ -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
+ }
@@ -1,12 +1,12 @@
1
- import { favoriteStore } from '@/store'
2
1
  import { observer } from 'mobx-react-lite'
2
+ import { favoriteStore } from '@/store'
3
3
  import type { FC } from 'react'
4
4
 
5
5
  const React: FC = observer(() => {
6
6
  return (
7
- <div className={`scale-${favoriteStore.favorite === 'react'}`}>
7
+ <div>
8
8
  <img
9
- className="w-30 animate-spin animate-duration-2000"
9
+ className={`w-30 ${favoriteStore.favorite === 'react' ? 'animate-spin' : ''} animate-duration-2000`}
10
10
  src="/react.svg"
11
11
  alt="reactlogo"
12
12
  />
@@ -23,6 +23,8 @@ const Button: FC<{ target: 'vite' | 'react'; disabled: boolean }> = ({
23
23
  }
24
24
 
25
25
  const Home: FC = observer(() => {
26
+ const [state, setState] = useState(0)
27
+
26
28
  return (
27
29
  <div
28
30
  className={
@@ -49,8 +51,12 @@ const Home: FC = observer(() => {
49
51
  <React />
50
52
  <Button target="react" disabled={favoriteStore.favorite === 'react'} />
51
53
  </div>
52
- <div className="absolute translate-x-[50%] right-[50%] top-[10%]">
54
+ <div
55
+ className="absolute translate-x-[50%] right-[50%] top-[10%] cursor-pointer hover:filter-drop-shadow-2xl"
56
+ onClick={() => setState((v) => ++v)}
57
+ >
53
58
  <Lic favorite={favoriteStore.favorite} />
59
+ {state}
54
60
  </div>
55
61
  </div>
56
62
  )
@@ -32,5 +32,5 @@
32
32
  "@/*": ["src/*"]
33
33
  }
34
34
  },
35
- "include": ["src"]
35
+ "include": ["src", "types/*.d.ts"]
36
36
  }
@@ -20,5 +20,10 @@
20
20
  "noUnusedParameters": true,
21
21
  "noFallthroughCasesInSwitch": true
22
22
  },
23
- "include": ["vite.config.ts"]
23
+ "include": [
24
+ "vite.config.ts",
25
+ "./config/**/*.ts",
26
+ "./plugins/*.ts",
27
+ "./types/*.d.ts"
28
+ ]
24
29
  }
@@ -0,0 +1,47 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ // @ts-nocheck
4
+ // noinspection JSUnusedGlobalSymbols
5
+ // Generated by unplugin-auto-import
6
+ // biome-ignore lint: disable
7
+ export {}
8
+ declare global {
9
+ const Link: typeof import('react-router-dom')['Link']
10
+ const NavLink: typeof import('react-router-dom')['NavLink']
11
+ const Navigate: typeof import('react-router-dom')['Navigate']
12
+ const Outlet: typeof import('react-router-dom')['Outlet']
13
+ const Route: typeof import('react-router-dom')['Route']
14
+ const Routes: typeof import('react-router-dom')['Routes']
15
+ const createRef: typeof import('react')['createRef']
16
+ const forwardRef: typeof import('react')['forwardRef']
17
+ const lazy: typeof import('react')['lazy']
18
+ const memo: typeof import('react')['memo']
19
+ const startTransition: typeof import('react')['startTransition']
20
+ const useCallback: typeof import('react')['useCallback']
21
+ const useContext: typeof import('react')['useContext']
22
+ const useDebugValue: typeof import('react')['useDebugValue']
23
+ const useDeferredValue: typeof import('react')['useDeferredValue']
24
+ const useEffect: typeof import('react')['useEffect']
25
+ const useHref: typeof import('react-router-dom')['useHref']
26
+ const useId: typeof import('react')['useId']
27
+ const useImperativeHandle: typeof import('react')['useImperativeHandle']
28
+ const useInRouterContext: typeof import('react-router-dom')['useInRouterContext']
29
+ const useInsertionEffect: typeof import('react')['useInsertionEffect']
30
+ const useLayoutEffect: typeof import('react')['useLayoutEffect']
31
+ const useLinkClickHandler: typeof import('react-router-dom')['useLinkClickHandler']
32
+ const useLocation: typeof import('react-router-dom')['useLocation']
33
+ const useMemo: typeof import('react')['useMemo']
34
+ const useNavigate: typeof import('react-router-dom')['useNavigate']
35
+ const useNavigationType: typeof import('react-router-dom')['useNavigationType']
36
+ const useOutlet: typeof import('react-router-dom')['useOutlet']
37
+ const useOutletContext: typeof import('react-router-dom')['useOutletContext']
38
+ const useParams: typeof import('react-router-dom')['useParams']
39
+ const useReducer: typeof import('react')['useReducer']
40
+ const useRef: typeof import('react')['useRef']
41
+ const useResolvedPath: typeof import('react-router-dom')['useResolvedPath']
42
+ const useRoutes: typeof import('react-router-dom')['useRoutes']
43
+ const useSearchParams: typeof import('react-router-dom')['useSearchParams']
44
+ const useState: typeof import('react')['useState']
45
+ const useSyncExternalStore: typeof import('react')['useSyncExternalStore']
46
+ const useTransition: typeof import('react')['useTransition']
47
+ }
@@ -0,0 +1,9 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ VITE_APP_DOMAIN: string
5
+ }
6
+
7
+ interface ImportMeta {
8
+ readonly env: ImportMetaEnv
9
+ }
@@ -1,28 +1,18 @@
1
1
  import { defineConfig } from 'vite'
2
- import react from '@vitejs/plugin-react'
3
- import unocss from 'unocss/vite'
2
+
4
3
  import path from 'node:path'
5
4
  import process from 'node:process'
5
+ import { createPlugins } from './plugins'
6
6
 
7
7
  // https://vite.dev/config/
8
- export default defineConfig({
9
- plugins: [
10
- react({
11
- babel: {
12
- plugins: [
13
- ['@babel/plugin-proposal-decorators', { legacy: true }]
14
- // ['@babel/plugin-proposal-class-properties', { loose: true }]
15
- ]
16
- }
17
- }),
18
- unocss()
19
- ],
8
+ export default defineConfig(() => ({
9
+ plugins: createPlugins(),
20
10
  resolve: {
21
11
  alias: {
22
- '@': path.resolve(process.cwd(), '/src')
12
+ '@': path.resolve(process.cwd(), 'src')
23
13
  }
24
14
  },
25
15
  server: {
26
16
  port: 8220
27
17
  }
28
- })
18
+ }))
@@ -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,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 @@
1
+ VITE_APP_DOMAIN="https://api.example.com"
@@ -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>