create-lik-app 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/README.md +8 -7
  2. package/dist/index.mjs +31 -31
  3. package/package.json +6 -7
  4. package/templates/.gitignore +1 -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/views/Home/index.tsx +7 -1
  12. package/templates/template-react/tsconfig.app.json +1 -1
  13. package/templates/template-react/tsconfig.node.json +6 -1
  14. package/templates/template-react/types/auto-imports.d.ts +47 -0
  15. package/templates/template-react/types/vite-env.d.ts +9 -0
  16. package/templates/template-react/vite.config.ts +5 -15
  17. package/templates/template-vue/.husky/commit-msg +1 -0
  18. package/templates/template-vue/.husky/lintstagedrc.cjs +15 -0
  19. package/templates/template-vue/.husky/pre-commit +10 -0
  20. package/templates/template-vue/.prettierrc.json +6 -0
  21. package/templates/template-vue/.vscode/extensions.json +8 -0
  22. package/templates/template-vue/README.md +39 -0
  23. package/templates/template-vue/_gitignore +30 -0
  24. package/templates/template-vue/commitlint.config.mjs +33 -0
  25. package/templates/template-vue/env/.env +0 -0
  26. package/templates/template-vue/env/.env.development +0 -0
  27. package/templates/template-vue/env/.env.production +0 -0
  28. package/templates/template-vue/env/.env.test +1 -0
  29. package/templates/template-vue/eslint.config.js +24 -0
  30. package/templates/template-vue/index.html +13 -0
  31. package/templates/template-vue/package.json +45 -0
  32. package/templates/template-vue/plugins/index.ts +28 -0
  33. package/templates/template-vue/public/lic.svg +1263 -0
  34. package/templates/template-vue/src/App.vue +87 -0
  35. package/templates/template-vue/src/assets/base.css +86 -0
  36. package/templates/template-vue/src/assets/logo.svg +1 -0
  37. package/templates/template-vue/src/assets/main.css +35 -0
  38. package/templates/template-vue/src/components/HelloWorld.vue +43 -0
  39. package/templates/template-vue/src/components/TheWelcome.vue +121 -0
  40. package/templates/template-vue/src/components/WelcomeItem.vue +87 -0
  41. package/templates/template-vue/src/components/icons/IconCommunity.vue +12 -0
  42. package/templates/template-vue/src/components/icons/IconDocumentation.vue +12 -0
  43. package/templates/template-vue/src/components/icons/IconEcosystem.vue +12 -0
  44. package/templates/template-vue/src/components/icons/IconSupport.vue +12 -0
  45. package/templates/template-vue/src/components/icons/IconTooling.vue +19 -0
  46. package/templates/template-vue/src/main.ts +14 -0
  47. package/templates/template-vue/src/router/index.ts +23 -0
  48. package/templates/template-vue/src/stores/index.ts +8 -0
  49. package/templates/template-vue/src/stores/module/counter.ts +12 -0
  50. package/templates/template-vue/src/views/AboutView.vue +15 -0
  51. package/templates/template-vue/src/views/HomeView.vue +7 -0
  52. package/templates/template-vue/tsconfig.app.json +13 -0
  53. package/templates/template-vue/tsconfig.json +11 -0
  54. package/templates/template-vue/tsconfig.node.json +19 -0
  55. package/templates/template-vue/types/auto-imports.d.ts +309 -0
  56. package/templates/template-vue/types/components.d.ts +21 -0
  57. package/templates/template-vue/types/env.d.ts +9 -0
  58. package/templates/template-vue/vite.config.ts +16 -0
  59. package/templates/template-react/src/vite-env.d.ts +0 -1
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "create-lik-app",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
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",
@@ -35,5 +30,9 @@
35
30
  "picocolors": "^1.1.1",
36
31
  "prompts": "^2.4.2",
37
32
  "unbuild": "^2.0.0"
33
+ },
34
+ "scripts": {
35
+ "build": "unbuild",
36
+ "update:templates": "node scripts/update.mjs"
38
37
  }
39
38
  }
@@ -0,0 +1 @@
1
+ */node_modules
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
+ ]
@@ -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,22 +1,12 @@
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
12
  '@': path.resolve(process.cwd(), '/src')
@@ -25,4 +15,4 @@ export default defineConfig({
25
15
  server: {
26
16
  port: 8220
27
17
  }
28
- })
18
+ }))
@@ -0,0 +1 @@
1
+ npx --no -- commitlint --edit $1
@@ -0,0 +1,15 @@
1
+ module.exports = {
2
+ '*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
3
+ '{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': [
4
+ 'prettier --parser json --write',
5
+ ],
6
+ '*.vue': [
7
+ 'eslint --fix',
8
+ 'prettier --write',
9
+ // 'stylelint --fix'
10
+ ],
11
+ 'package.json': ['prettier --write'],
12
+ // '*.{scss,less,styl,css,html}': ['stylelint --fix', 'prettier --write'],
13
+ '*.md': ['prettier --write'],
14
+ '*.hbs': ['prettier --write'],
15
+ }
@@ -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,6 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/prettierrc",
3
+ "semi": false,
4
+ "singleQuote": true,
5
+ "printWidth": 80
6
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "recommendations": [
3
+ "Vue.volar",
4
+ "dbaeumer.vscode-eslint",
5
+ "EditorConfig.EditorConfig",
6
+ "esbenp.prettier-vscode"
7
+ ]
8
+ }
@@ -0,0 +1,39 @@
1
+ # template-vue
2
+
3
+ This template should help get you started developing with Vue 3 in Vite.
4
+
5
+ ## Recommended IDE Setup
6
+
7
+ [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8
+
9
+ ## Type Support for `.vue` Imports in TS
10
+
11
+ TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
12
+
13
+ ## Customize configuration
14
+
15
+ See [Vite Configuration Reference](https://vite.dev/config/).
16
+
17
+ ## Project Setup
18
+
19
+ ```sh
20
+ pnpm install
21
+ ```
22
+
23
+ ### Compile and Hot-Reload for Development
24
+
25
+ ```sh
26
+ pnpm dev
27
+ ```
28
+
29
+ ### Type-Check, Compile and Minify for Production
30
+
31
+ ```sh
32
+ pnpm build
33
+ ```
34
+
35
+ ### Lint with [ESLint](https://eslint.org/)
36
+
37
+ ```sh
38
+ pnpm lint
39
+ ```
@@ -0,0 +1,30 @@
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
+ .DS_Store
12
+ dist
13
+ dist-ssr
14
+ coverage
15
+ *.local
16
+
17
+ /cypress/videos/
18
+ /cypress/screenshots/
19
+
20
+ # Editor directories and files
21
+ .vscode/*
22
+ !.vscode/extensions.json
23
+ .idea
24
+ *.suo
25
+ *.ntvs*
26
+ *.njsproj
27
+ *.sln
28
+ *.sw?
29
+
30
+ *.tsbuildinfo
@@ -0,0 +1,33 @@
1
+ export default {
2
+ extends: ['@commitlint/config-conventional'],
3
+ rules: {
4
+ 'type-enum': [
5
+ // 确保提交信息的类型必须是预定义的类型之一。
6
+ 2, // 错误级别,2 表示严重错误,提交将被拒绝。
7
+ 'always', // 始终应用此规则。
8
+ [
9
+ 'feat', // 新功能(feature)
10
+ 'fix', // 修补bug
11
+ 'docs', // 文档(documentation)
12
+ 'style', // 格式、样式(不影响代码运行的变动)
13
+ 'refactor', // 重构(即不是新增功能,也不是修改BUG的代码)
14
+ 'perf', // 优化相关,比如提升性能、体验
15
+ 'test', // 添加测试
16
+ 'ci', // 持续集成修改
17
+ 'chore', // 构建过程或辅助工具的变动
18
+ 'revert', // 回滚到上一个版本
19
+ 'workflow', // 工作流改进
20
+ 'mod', // 不确定分类的修改
21
+ 'wip', // 开发中
22
+ 'types', // 类型修改
23
+ 'release', // 版本发布
24
+ ],
25
+ ],
26
+ 'subject-full-stop': [
27
+ // 确保提交信息的 subject 部分不以句点(.)结尾。
28
+ 0, // 错误级别,0 表示忽略此规则,不进行检查。
29
+ 'never', // 从不应用此规则。
30
+ ],
31
+ 'subject-case': [0, 'never'], // 确保提交信息的 subject 部分不强制特定的大小写格式。
32
+ },
33
+ }
File without changes
File without changes
File without changes
@@ -0,0 +1,24 @@
1
+ import pluginVue from 'eslint-plugin-vue'
2
+ import vueTsEslintConfig from '@vue/eslint-config-typescript'
3
+ import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
4
+
5
+ export default [
6
+ {
7
+ name: 'lint',
8
+ files: ['**/*.{ts,mts,tsx,vue}'],
9
+ },
10
+
11
+ {
12
+ name: 'lint-ignore',
13
+ ignores: ['**/dist/**', 'node_modules', '**/dist-ssr/**', '**/coverage/**'],
14
+ },
15
+ {
16
+ name: 'lint-rules',
17
+ rules: {
18
+ '@typescript-eslint/consistent-type-imports': 'error', // 要求 import type
19
+ },
20
+ },
21
+ ...pluginVue.configs['flat/essential'],
22
+ ...vueTsEslintConfig(),
23
+ skipFormatting,
24
+ ]
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" href="/lic.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Lik-Vue-App</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.ts"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "template-vue",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "run-p type-check \"build-only {@}\" --",
9
+ "preview": "vite preview",
10
+ "build-only": "vite build",
11
+ "type-check": "vue-tsc --build",
12
+ "lint": "lint-staged -c ./.husky/lintstagedrc.cjs",
13
+ "prepare": "husky install"
14
+ },
15
+ "dependencies": {
16
+ "@vueuse/core": "^12.0.0",
17
+ "pinia": "^2.2.6",
18
+ "vue": "^3.5.13",
19
+ "vue-router": "^4.4.5"
20
+ },
21
+ "devDependencies": {
22
+ "@commitlint/cli": "^19.6.0",
23
+ "@commitlint/config-conventional": "^19.6.0",
24
+ "@tsconfig/node22": "^22.0.0",
25
+ "@types/node": "^22.9.3",
26
+ "@vitejs/plugin-vue": "^5.2.1",
27
+ "@vitejs/plugin-vue-jsx": "^4.1.1",
28
+ "@vue/eslint-config-prettier": "^10.1.0",
29
+ "@vue/eslint-config-typescript": "^14.1.3",
30
+ "@vue/tsconfig": "^0.7.0",
31
+ "eslint": "^9.14.0",
32
+ "eslint-plugin-vue": "^9.30.0",
33
+ "husky": "^9.1.7",
34
+ "lint-staged": "^15.2.10",
35
+ "npm-run-all2": "^7.0.1",
36
+ "pinia-plugin-persistedstate": "^4.1.3",
37
+ "prettier": "^3.3.3",
38
+ "typescript": "~5.6.3",
39
+ "unplugin-auto-import": "^0.18.6",
40
+ "unplugin-vue-components": "^0.27.5",
41
+ "vite": "^6.0.1",
42
+ "vite-plugin-vue-devtools": "^7.6.5",
43
+ "vue-tsc": "^2.1.10"
44
+ }
45
+ }
@@ -0,0 +1,28 @@
1
+ import vue from '@vitejs/plugin-vue'
2
+ import vueJsx from '@vitejs/plugin-vue-jsx'
3
+ import vueDevTools from 'vite-plugin-vue-devtools'
4
+ import AutoImport from 'unplugin-auto-import/vite'
5
+ import Components from 'unplugin-vue-components/vite'
6
+ export const createPlugins = () => [
7
+ vue(),
8
+ vueJsx(),
9
+ vueDevTools(),
10
+ AutoImport({
11
+ include: [
12
+ /\.vue$/,
13
+ /\.vue\?vue/, // .vue
14
+ ],
15
+ imports: ['vue', 'vue-router', 'pinia', '@vueuse/core'],
16
+ // 为true时在项目根目录自动创建
17
+ dts: 'types/auto-imports.d.ts',
18
+ }),
19
+ // 按需加载组件
20
+ Components({
21
+ // 自动加载的组件目录,默认值为 ['src/components']
22
+ dirs: ['src/components'],
23
+ // 组件名称包含目录,防止同名组件冲突
24
+ directoryAsNamespace: true,
25
+ // 指定类型声明文件,为true时在项目根目录创建
26
+ dts: 'types/components.d.ts',
27
+ }),
28
+ ]