create-lik-app 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) 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/src/main.tsx +1 -1
  5. package/templates/template-react/src/store/index.ts +1 -2
  6. package/templates/template-react/src/styles/main.css +10 -0
  7. package/templates/template-react/src/views/Home/components/React/index.tsx +3 -3
  8. package/templates/template-react/vite.config.ts +1 -1
  9. package/templates/template-react-tanstack-jotai/.husky/commit-msg +6 -0
  10. package/templates/template-react-tanstack-jotai/.husky/lintstagedrc.cjs +8 -0
  11. package/templates/template-react-tanstack-jotai/.husky/pre-commit +10 -0
  12. package/templates/template-react-tanstack-jotai/.prettierignore +13 -0
  13. package/templates/template-react-tanstack-jotai/.vscode/extensions.json +5 -0
  14. package/templates/template-react-tanstack-jotai/README.md +40 -0
  15. package/templates/template-react-tanstack-jotai/_gitignore +27 -0
  16. package/templates/template-react-tanstack-jotai/commitlint.config.mjs +28 -0
  17. package/templates/template-react-tanstack-jotai/config/uno/rules.ts +127 -0
  18. package/templates/template-react-tanstack-jotai/env/.env +0 -0
  19. package/templates/template-react-tanstack-jotai/env/.env.development +1 -0
  20. package/templates/template-react-tanstack-jotai/env/.env.production +1 -0
  21. package/templates/template-react-tanstack-jotai/eslint.config.mjs +44 -0
  22. package/templates/template-react-tanstack-jotai/index.html +13 -0
  23. package/templates/template-react-tanstack-jotai/package.json +51 -0
  24. package/templates/template-react-tanstack-jotai/plugins/index.ts +26 -0
  25. package/templates/template-react-tanstack-jotai/prettier.config.mjs +11 -0
  26. package/templates/template-react-tanstack-jotai/public/lic.svg +1263 -0
  27. package/templates/template-react-tanstack-jotai/public/react.svg +1 -0
  28. package/templates/template-react-tanstack-jotai/public/vite.svg +1 -0
  29. package/templates/template-react-tanstack-jotai/src/assets/react.svg +1 -0
  30. package/templates/template-react-tanstack-jotai/src/components/Lic/index.tsx +12 -0
  31. package/templates/template-react-tanstack-jotai/src/libs/gsap/index.ts +6 -0
  32. package/templates/template-react-tanstack-jotai/src/main.tsx +23 -0
  33. package/templates/template-react-tanstack-jotai/src/routeTree.gen.ts +145 -0
  34. package/templates/template-react-tanstack-jotai/src/routes/__root.tsx +11 -0
  35. package/templates/template-react-tanstack-jotai/src/routes/_layout/about.tsx +6 -0
  36. package/templates/template-react-tanstack-jotai/src/routes/_layout/index.tsx +6 -0
  37. package/templates/template-react-tanstack-jotai/src/routes/_layout.tsx +23 -0
  38. package/templates/template-react-tanstack-jotai/src/store/index.ts +1 -0
  39. package/templates/template-react-tanstack-jotai/src/store/module/favorite.ts +5 -0
  40. package/templates/template-react-tanstack-jotai/src/styles/animation.css +8 -0
  41. package/templates/template-react-tanstack-jotai/src/styles/variable.css +21 -0
  42. package/templates/template-react-tanstack-jotai/src/types/color.d.ts +1 -0
  43. package/templates/template-react-tanstack-jotai/src/utils/rainbow-print.ts +10 -0
  44. package/templates/template-react-tanstack-jotai/src/views/404/index.tsx +18 -0
  45. package/templates/template-react-tanstack-jotai/src/views/About/index.tsx +7 -0
  46. package/templates/template-react-tanstack-jotai/src/views/Index/Button/index.tsx +24 -0
  47. package/templates/template-react-tanstack-jotai/src/views/Index/React/index.tsx +18 -0
  48. package/templates/template-react-tanstack-jotai/src/views/Index/Vite/index.tsx +20 -0
  49. package/templates/template-react-tanstack-jotai/src/views/Index/index.tsx +50 -0
  50. package/templates/template-react-tanstack-jotai/tsconfig.app.json +36 -0
  51. package/templates/template-react-tanstack-jotai/tsconfig.json +7 -0
  52. package/templates/template-react-tanstack-jotai/tsconfig.node.json +29 -0
  53. package/templates/template-react-tanstack-jotai/types/auto-imports.d.ts +47 -0
  54. package/templates/template-react-tanstack-jotai/types/vite-env.d.ts +9 -0
  55. package/templates/template-react-tanstack-jotai/uno.config.ts +40 -0
  56. package/templates/template-react-tanstack-jotai/vite.config.ts +18 -0
  57. package/templates/template-vue/_gitignore +3 -0
  58. package/templates/template-react/src/store/module/counter.ts +0 -20
  59. /package/templates/{template-react/src/styles/mian.css → template-react-tanstack-jotai/src/styles/main.css} +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.0.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,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
  />
@@ -9,7 +9,7 @@ export default defineConfig(() => ({
9
9
  plugins: createPlugins(),
10
10
  resolve: {
11
11
  alias: {
12
- '@': path.resolve(process.cwd(), '/src')
12
+ '@': path.resolve(process.cwd(), 'src')
13
13
  }
14
14
  },
15
15
  server: {
@@ -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>
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "new-lic-blog",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc -b && vite build",
9
+ "lint": "eslint .",
10
+ "preview": "vite preview",
11
+ "preinstall": "npx only-allow pnpm",
12
+ "prepare": "husky"
13
+ },
14
+ "dependencies": {
15
+ "@gsap/react": "^2.1.1",
16
+ "@tanstack/react-router": "^1.92.3",
17
+ "@unocss/reset": "^0.64.1",
18
+ "gsap": "^3.12.5",
19
+ "jotai": "^2.11.0",
20
+ "rainbow-print": "0.0.1-alpha.2",
21
+ "react": "^18.3.1",
22
+ "react-dom": "^18.3.1"
23
+ },
24
+ "devDependencies": {
25
+ "@babel/plugin-proposal-decorators": "^7.25.9",
26
+ "@commitlint/cli": "^19.6.0",
27
+ "@commitlint/config-conventional": "^19.6.0",
28
+ "@eslint/js": "^9.13.0",
29
+ "@tanstack/router-devtools": "^1.92.3",
30
+ "@tanstack/router-plugin": "^1.91.1",
31
+ "@types/node": "^22.9.1",
32
+ "@types/react": "^18.3.12",
33
+ "@types/react-dom": "^18.3.1",
34
+ "@typescript-eslint/eslint-plugin": "^8.15.0",
35
+ "@vitejs/plugin-react": "^4.3.3",
36
+ "eslint": "^9.14.0",
37
+ "eslint-config-prettier": "^9.1.0",
38
+ "eslint-plugin-prettier": "^5.2.1",
39
+ "eslint-plugin-react-hooks": "^5.0.0",
40
+ "eslint-plugin-react-refresh": "^0.4.14",
41
+ "globals": "^15.11.0",
42
+ "husky": "^9.1.7",
43
+ "lint-staged": "^15.2.10",
44
+ "only-allow": "^1.2.1",
45
+ "typescript": "~5.6.2",
46
+ "typescript-eslint": "^8.13.0",
47
+ "unocss": "^0.64.0",
48
+ "unplugin-auto-import": "^0.18.6",
49
+ "vite": "^5.4.10"
50
+ }
51
+ }
@@ -0,0 +1,26 @@
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
+ import { TanStackRouterVite } from '@tanstack/router-plugin/vite';
6
+
7
+ export const createPlugins = (): PluginOption[] => [
8
+ react({
9
+ babel: {
10
+ plugins: [
11
+ ['@babel/plugin-proposal-decorators', { legacy: true }]
12
+ // ['@babel/plugin-proposal-class-properties', { loose: true }]
13
+ ]
14
+ }
15
+ }),
16
+ unocss(),
17
+ AutoImport({
18
+ include: [
19
+ /\.[tj]sx?$/ // .ts, .tsx, .js, .jsx
20
+ ],
21
+ imports: ['react', 'react-router-dom'],
22
+ // 为true时在项目根目录自动创建
23
+ dts: 'types/auto-imports.d.ts'
24
+ }),
25
+ TanStackRouterVite()
26
+ ];
@@ -0,0 +1,11 @@
1
+ export default {
2
+ singleQuote: true,
3
+ semi: true,
4
+ bracketSpacing: true,
5
+ htmlWhitespaceSensitivity: 'ignore',
6
+ endOfLine: 'auto',
7
+ trailingComma: 'none',
8
+ tabWidth: 2,
9
+ printWidth: 80,
10
+ proseWrap: 'preserve'
11
+ }