create-packer 1.39.4 → 1.41.0
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.
- package/package.json +1 -1
- package/template/web-app/react-rsbuild/index.html +0 -1
- package/template/web-app/react-rsbuild/rsbuild.config.ts +9 -8
- package/template/web-app/vue/router/index.ts +2 -2
- package/template/web-app/vue-rsbuild/.env +2 -0
- package/template/web-app/vue-rsbuild/.env.development +2 -0
- package/template/web-app/{react-webpack → vue-rsbuild}/.gitignore +1 -1
- package/template/web-app/{react-webpack → vue-rsbuild}/.stylelintrc +9 -4
- package/template/web-app/{react-webpack → vue-rsbuild}/.vscode/extensions.json +3 -2
- package/template/web-app/vue-rsbuild/README.md +14 -0
- package/template/web-app/{react-webpack/commitlint.config.js → vue-rsbuild/commitlint.config.cjs} +1 -1
- package/template/web-app/vue-rsbuild/domain/app/app.ts +4 -0
- package/template/web-app/vue-rsbuild/domain/app/components/app.vue +18 -0
- package/template/web-app/vue-rsbuild/domain/app/components/index.ts +1 -0
- package/template/web-app/vue-rsbuild/domain/app/createComponentInstance.ts +44 -0
- package/template/web-app/vue-rsbuild/domain/app/index.ts +3 -0
- package/template/web-app/vue-rsbuild/env.d.ts +17 -0
- package/template/web-app/{react-webpack → vue-rsbuild}/eslint.config.js +25 -20
- package/template/web-app/{react-webpack → vue-rsbuild}/index.html +3 -3
- package/template/web-app/vue-rsbuild/main.ts +7 -0
- package/template/web-app/vue-rsbuild/package.json +73 -0
- package/template/web-app/vue-rsbuild/pages/home/index.ts +1 -0
- package/template/web-app/vue-rsbuild/pages/home/view.vue +16 -0
- package/template/web-app/vue-rsbuild/pages/index.ts +1 -0
- package/template/web-app/vue-rsbuild/pages/index.vue +3 -0
- package/template/web-app/vue-rsbuild/pages/not-found.vue +3 -0
- package/template/web-app/{react-webpack/postcss.config.js → vue-rsbuild/postcss.config.cjs} +9 -7
- package/template/web-app/vue-rsbuild/public/vite.svg +1 -0
- package/template/web-app/{react-webpack/domain → vue-rsbuild}/router/home/index.ts +1 -1
- package/template/web-app/vue-rsbuild/router/home/routes.ts +8 -0
- package/template/web-app/vue-rsbuild/router/index.ts +26 -0
- package/template/web-app/vue-rsbuild/router/names.ts +5 -0
- package/template/web-app/vue-rsbuild/rsbuild.config.ts +74 -0
- package/template/web-app/vue-rsbuild/scripts/createChunks.ts +26 -0
- package/template/web-app/vue-rsbuild/scripts/index.ts +1 -0
- package/template/web-app/vue-rsbuild/shared/assets/vue.svg +1 -0
- package/template/web-app/vue-rsbuild/shared/hooks/index.ts +2 -0
- package/template/web-app/vue-rsbuild/shared/hooks/useList.ts +104 -0
- package/template/web-app/{react-webpack → vue-rsbuild}/shared/hooks/useVisible.ts +4 -4
- package/template/web-app/vue-rsbuild/shared/service/api.ts +1 -0
- package/template/web-app/vue-rsbuild/shared/service/home.ts +10 -0
- package/template/web-app/{react-webpack → vue-rsbuild}/shared/service/index.ts +1 -0
- package/template/web-app/vue-rsbuild/shared/service/request.ts +5 -0
- package/template/web-app/vue-rsbuild/shared/tools/index.ts +0 -0
- package/template/web-app/vue-rsbuild/tailwind.config.cjs +18 -0
- package/template/web-app/{react-webpack → vue-rsbuild}/tsconfig.json +10 -13
- package/template/web-app/vue-rsbuild/tsconfig.node.json +10 -0
- package/template/web-app/react-webpack/.env +0 -2
- package/template/web-app/react-webpack/.env.dev +0 -2
- package/template/web-app/react-webpack/.vscode/settings.json +0 -4
- package/template/web-app/react-webpack/README.md +0 -13
- package/template/web-app/react-webpack/domain/app/app.model.ts +0 -7
- package/template/web-app/react-webpack/domain/app/app.styled.ts +0 -3
- package/template/web-app/react-webpack/domain/app/components/app-context.tsx +0 -17
- package/template/web-app/react-webpack/domain/app/components/app.tsx +0 -24
- package/template/web-app/react-webpack/domain/app/components/index.ts +0 -1
- package/template/web-app/react-webpack/domain/app/index.ts +0 -2
- package/template/web-app/react-webpack/domain/router/components/index.ts +0 -2
- package/template/web-app/react-webpack/domain/router/components/route-layout.tsx +0 -19
- package/template/web-app/react-webpack/domain/router/components/sub-route-outlet.tsx +0 -22
- package/template/web-app/react-webpack/domain/router/home/routes.tsx +0 -13
- package/template/web-app/react-webpack/domain/router/ids.ts +0 -6
- package/template/web-app/react-webpack/domain/router/index.ts +0 -4
- package/template/web-app/react-webpack/domain/router/router.tsx +0 -28
- package/template/web-app/react-webpack/domain/router/router.types.ts +0 -3
- package/template/web-app/react-webpack/global.d.ts +0 -26
- package/template/web-app/react-webpack/main.tsx +0 -4
- package/template/web-app/react-webpack/package.json +0 -84
- package/template/web-app/react-webpack/pages/home/index.ts +0 -1
- package/template/web-app/react-webpack/pages/home/view.styled.ts +0 -7
- package/template/web-app/react-webpack/pages/home/view.tsx +0 -10
- package/template/web-app/react-webpack/pages/index.tsx +0 -18
- package/template/web-app/react-webpack/pages/not-found.tsx +0 -3
- package/template/web-app/react-webpack/public/react.svg +0 -1
- package/template/web-app/react-webpack/shared/assets/react.svg +0 -1
- package/template/web-app/react-webpack/shared/components/componentInstance.tsx +0 -78
- package/template/web-app/react-webpack/shared/components/index.ts +0 -1
- package/template/web-app/react-webpack/shared/hooks/defineRouter/defineRouter.types.ts +0 -33
- package/template/web-app/react-webpack/shared/hooks/defineRouter/deineRouter.tsx +0 -160
- package/template/web-app/react-webpack/shared/hooks/defineRouter/index.ts +0 -2
- package/template/web-app/react-webpack/shared/hooks/index.ts +0 -6
- package/template/web-app/react-webpack/shared/hooks/useInterval.ts +0 -26
- package/template/web-app/react-webpack/shared/hooks/useLoadingAction.ts +0 -27
- package/template/web-app/react-webpack/shared/hooks/useLowPriorityState.ts +0 -26
- package/template/web-app/react-webpack/shared/hooks/useSyncState.ts +0 -15
- package/template/web-app/react-webpack/shared/service/home.ts +0 -8
- package/template/web-app/react-webpack/shared/service/request.ts +0 -5
- package/template/web-app/react-webpack/shared/theme/index.ts +0 -1
- package/template/web-app/react-webpack/shared/theme/theme.styled.ts +0 -56
- package/template/web-app/react-webpack/shared/types/index.ts +0 -1
- package/template/web-app/react-webpack/shared/types/utils.ts +0 -2
- package/template/web-app/react-webpack/tsconfig.node.json +0 -9
- package/template/web-app/react-webpack/webpack.config.mjs +0 -161
- package/template/web-app/react-webpack/webpack_config/constant.mjs +0 -5
- package/template/web-app/react-webpack/webpack_config/index.mjs +0 -2
- package/template/web-app/react-webpack/webpack_config/styles.mjs +0 -22
- /package/template/web-app/{react-webpack → vue-rsbuild}/.editorconfig +0 -0
- /package/template/web-app/{react-webpack → vue-rsbuild}/.husky/commit-msg +0 -0
- /package/template/web-app/{react-webpack → vue-rsbuild}/.husky/pre-commit +0 -0
- /package/template/web-app/{react-webpack → vue-rsbuild}/.prettierignore +0 -0
- /package/template/web-app/{react-webpack → vue-rsbuild}/.prettierrc +0 -0
- /package/template/web-app/{react-webpack → vue-rsbuild}/.stylelintignore +0 -0
- /package/template/web-app/{react-webpack/domain/router/home/ids.ts → vue-rsbuild/router/home/names.ts} +0 -0
- /package/template/web-app/{react-webpack/shared/constant → vue-rsbuild/shared/components}/index.ts +0 -0
- /package/template/web-app/{react-webpack/shared/tools → vue-rsbuild/shared/constant}/index.ts +0 -0
- /package/template/web-app/{react-webpack/index.css → vue-rsbuild/style.css} +0 -0
package/package.json
CHANGED
|
@@ -10,10 +10,10 @@ import { createChunks } from './scripts'
|
|
|
10
10
|
|
|
11
11
|
export default defineConfig(({ envMode, command }) => {
|
|
12
12
|
const { parsed: env } = loadEnv()
|
|
13
|
-
const proxyBaseUrl = env.PUBLIC_API_HOST
|
|
14
13
|
return {
|
|
15
14
|
html: {
|
|
16
|
-
template: './index.html'
|
|
15
|
+
template: './index.html',
|
|
16
|
+
title: 'Rspack + React + TS'
|
|
17
17
|
},
|
|
18
18
|
source: {
|
|
19
19
|
entry: {
|
|
@@ -41,7 +41,11 @@ export default defineConfig(({ envMode, command }) => {
|
|
|
41
41
|
},
|
|
42
42
|
plugins: [
|
|
43
43
|
pluginTypeCheck(),
|
|
44
|
-
pluginEslint(
|
|
44
|
+
pluginEslint({
|
|
45
|
+
eslintPluginOptions: {
|
|
46
|
+
configType: 'flat'
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
45
49
|
pluginStyledComponents({
|
|
46
50
|
ssr: false,
|
|
47
51
|
displayName: false,
|
|
@@ -68,11 +72,8 @@ export default defineConfig(({ envMode, command }) => {
|
|
|
68
72
|
compress: false,
|
|
69
73
|
proxy: [
|
|
70
74
|
{
|
|
71
|
-
context: [
|
|
72
|
-
target: 'http://127.0.0.1:3000'
|
|
73
|
-
pathRewrite: {
|
|
74
|
-
[proxyBaseUrl]: ''
|
|
75
|
-
}
|
|
75
|
+
context: [env.PUBLIC_API_HOST],
|
|
76
|
+
target: 'http://127.0.0.1:3000'
|
|
76
77
|
}
|
|
77
78
|
]
|
|
78
79
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRouter,
|
|
1
|
+
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
|
|
2
2
|
import names from './names'
|
|
3
3
|
import * as homeRouter from './home'
|
|
4
4
|
|
|
@@ -21,6 +21,6 @@ const routes: RouteRecordRaw[] = [
|
|
|
21
21
|
export { default as routerNames } from './names'
|
|
22
22
|
|
|
23
23
|
export const router = createRouter({
|
|
24
|
-
history:
|
|
24
|
+
history: createWebHistory(import.meta.env.PUBLIC_BASE_URL),
|
|
25
25
|
routes
|
|
26
26
|
})
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "stylelint-config-standard",
|
|
3
|
-
"customSyntax": "postcss-styled-syntax",
|
|
2
|
+
"extends": "stylelint-config-standard-scss",
|
|
4
3
|
"rules": {
|
|
5
4
|
"comment-empty-line-before": "never",
|
|
6
5
|
"no-empty-source": null,
|
|
@@ -9,7 +8,7 @@
|
|
|
9
8
|
"at-rule-no-unknown": [
|
|
10
9
|
true,
|
|
11
10
|
{
|
|
12
|
-
"ignoreAtRules": ["use"]
|
|
11
|
+
"ignoreAtRules": ["tailwind", "apply", "use"]
|
|
13
12
|
}
|
|
14
13
|
],
|
|
15
14
|
"declaration-block-no-redundant-longhand-properties": null,
|
|
@@ -19,6 +18,12 @@
|
|
|
19
18
|
"ignorePseudoClasses": ["global"]
|
|
20
19
|
}
|
|
21
20
|
],
|
|
22
|
-
"selector-class-pattern": null
|
|
21
|
+
"selector-class-pattern": null,
|
|
22
|
+
"scss/at-rule-no-unknown": [
|
|
23
|
+
true,
|
|
24
|
+
{
|
|
25
|
+
"ignoreAtRules": ["tailwind", "apply"]
|
|
26
|
+
}
|
|
27
|
+
]
|
|
23
28
|
}
|
|
24
29
|
}
|
package/template/web-app/{react-webpack/commitlint.config.js → vue-rsbuild/commitlint.config.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = { extends: ['@commitlint/config-conventional'] }
|
|
1
|
+
module.exports = { extends: ['@commitlint/config-conventional'] }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<router-view />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { router, routerNames } from '@/router'
|
|
7
|
+
|
|
8
|
+
router.beforeEach(async to => {
|
|
9
|
+
if (!Object.values(routerNames).includes(to.name as string)) {
|
|
10
|
+
return {
|
|
11
|
+
replace: true,
|
|
12
|
+
name: routerNames.notFound
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<style scoped></style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as App } from './app.vue'
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createVNode, render, VNodeChild } from 'vue'
|
|
2
|
+
import { assign, keys } from 'lodash-es'
|
|
3
|
+
import app from './app'
|
|
4
|
+
|
|
5
|
+
const store = new Map()
|
|
6
|
+
|
|
7
|
+
function reset(oldObj: Record<string, any>, newObj: Record<string, any>) {
|
|
8
|
+
keys(oldObj).forEach(k => {
|
|
9
|
+
oldObj[k] = void 0
|
|
10
|
+
})
|
|
11
|
+
assign(oldObj, newObj)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function createComponentInstance<
|
|
15
|
+
P extends Record<string, any>,
|
|
16
|
+
E extends Record<string, any>,
|
|
17
|
+
Slots extends Record<string, () => VNodeChild> = Record<string, () => VNodeChild>
|
|
18
|
+
>(name: string, component: any, props?: P, slots?: Slots) {
|
|
19
|
+
let vNode = store.get(name)
|
|
20
|
+
function updateProps(props: Partial<P>) {
|
|
21
|
+
reset(vNode.component.props, props)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function updateSlots(slots: Partial<Record<string, () => VNodeChild>>) {
|
|
25
|
+
reset(vNode.component.slots, slots)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!vNode) {
|
|
29
|
+
const container = document.createElement('div')
|
|
30
|
+
vNode = createVNode(component, props, slots)
|
|
31
|
+
vNode.appContext = app._context || {}
|
|
32
|
+
store.set(name, vNode)
|
|
33
|
+
render(vNode, container)
|
|
34
|
+
} else {
|
|
35
|
+
updateProps(props || {})
|
|
36
|
+
updateSlots(slots || {})
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
instance: vNode,
|
|
40
|
+
updateProps,
|
|
41
|
+
updateSlots,
|
|
42
|
+
...(vNode.component?.exposed as E)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="@rsbuild/core/types" />
|
|
2
|
+
|
|
3
|
+
declare module '*.vue' {
|
|
4
|
+
import type { DefineComponent } from 'vue'
|
|
5
|
+
const component: DefineComponent<Record<string, any>, Record<string, any>, any>
|
|
6
|
+
export default component
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface ImportMetaEnv {
|
|
10
|
+
readonly PUBLIC_BASE_URL: string
|
|
11
|
+
readonly PUBLIC_API_HOST: string
|
|
12
|
+
// 更多环境变量...
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface ImportMeta {
|
|
16
|
+
readonly env: ImportMetaEnv
|
|
17
|
+
}
|
|
@@ -2,21 +2,18 @@ import eslint from '@eslint/js'
|
|
|
2
2
|
import globals from 'globals'
|
|
3
3
|
import tseslint from 'typescript-eslint'
|
|
4
4
|
import importPlugin from 'eslint-plugin-import'
|
|
5
|
-
import
|
|
6
|
-
import reactHooksPlugin from 'eslint-plugin-react-hooks'
|
|
5
|
+
import pluginVue from 'eslint-plugin-vue'
|
|
7
6
|
|
|
8
7
|
const scriptExtensions = ['js', 'jsx', 'mjs', 'cjs', 'ts', 'tsx']
|
|
9
|
-
const files = scriptExtensions.map(ext => `**/*.${ext}`)
|
|
8
|
+
const files = [...scriptExtensions.map(ext => `**/*.${ext}`), '**/*.vue']
|
|
10
9
|
|
|
11
10
|
export default tseslint.config([
|
|
12
|
-
{
|
|
13
|
-
ignores: ['**/node_modules/', '**/dist/', '**/.history/', '**/.vscode/', 'vite.config.ts.*']
|
|
14
|
-
},
|
|
11
|
+
{ ignores: ['**/node_modules/', 'dist/', '.history/', '.vscode'] },
|
|
15
12
|
eslint.configs.recommended,
|
|
16
13
|
importPlugin.flatConfigs.recommended,
|
|
17
14
|
tseslint.configs.recommended,
|
|
15
|
+
pluginVue.configs['flat/recommended'],
|
|
18
16
|
{
|
|
19
|
-
plugins: { reactPlugin, reactHooksPlugin },
|
|
20
17
|
files,
|
|
21
18
|
languageOptions: {
|
|
22
19
|
ecmaVersion: 2018,
|
|
@@ -36,9 +33,6 @@ export default tseslint.config([
|
|
|
36
33
|
'import/resolver': {
|
|
37
34
|
typescript: true,
|
|
38
35
|
node: true
|
|
39
|
-
},
|
|
40
|
-
react: {
|
|
41
|
-
version: '18'
|
|
42
36
|
}
|
|
43
37
|
},
|
|
44
38
|
rules: {
|
|
@@ -61,12 +55,10 @@ export default tseslint.config([
|
|
|
61
55
|
'type'
|
|
62
56
|
],
|
|
63
57
|
pathGroups: [
|
|
64
|
-
{ pattern: '
|
|
65
|
-
{ pattern: '
|
|
66
|
-
{ pattern: 'react-router', group: 'external', position: 'before' },
|
|
67
|
-
{ pattern: 'react-router-dom', group: 'external', position: 'before' }
|
|
58
|
+
{ pattern: 'vue', group: 'external', position: 'before' },
|
|
59
|
+
{ pattern: 'vue-router', group: 'external', position: 'before' }
|
|
68
60
|
],
|
|
69
|
-
pathGroupsExcludedImportTypes: ['
|
|
61
|
+
pathGroupsExcludedImportTypes: ['vue', 'vue-router']
|
|
70
62
|
}
|
|
71
63
|
],
|
|
72
64
|
'no-case-declarations': 'off',
|
|
@@ -93,11 +85,24 @@ export default tseslint.config([
|
|
|
93
85
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
94
86
|
'@typescript-eslint/ban-ts-comment': 'off',
|
|
95
87
|
'@typescript-eslint/no-empty-interface': 'off',
|
|
96
|
-
'
|
|
97
|
-
'
|
|
98
|
-
'
|
|
99
|
-
'
|
|
100
|
-
'
|
|
88
|
+
'vue/multi-word-component-names': 0,
|
|
89
|
+
'vue/html-indent': ['error', 4],
|
|
90
|
+
'vue/require-default-prop': 'off',
|
|
91
|
+
'vue/one-component-per-file': 'off',
|
|
92
|
+
'vue/html-self-closing': [
|
|
93
|
+
'error',
|
|
94
|
+
{
|
|
95
|
+
html: {
|
|
96
|
+
void: 'always',
|
|
97
|
+
normal: 'always',
|
|
98
|
+
component: 'always'
|
|
99
|
+
},
|
|
100
|
+
svg: 'always',
|
|
101
|
+
math: 'always'
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
'vue/max-attributes-per-line': 'off',
|
|
105
|
+
'vue/singleline-html-element-content-newline': 'off',
|
|
101
106
|
'no-constant-condition': 'off'
|
|
102
107
|
}
|
|
103
108
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>webpack5 + React + TS</title>
|
|
8
7
|
</head>
|
|
9
8
|
<body>
|
|
10
|
-
<div id="
|
|
9
|
+
<div id="app"></div>
|
|
10
|
+
<script type="module" src="/main.ts"></script>
|
|
11
11
|
</body>
|
|
12
12
|
</html>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vue-vite",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"prepare": "husky install",
|
|
8
|
+
"dev": "rsbuild dev",
|
|
9
|
+
"build": "rsbuild build",
|
|
10
|
+
"build:analyse": "rsbuild build --env-mode analyse",
|
|
11
|
+
"build:rsdoctor": "cross-env RSDOCTOR=true rsbuild build",
|
|
12
|
+
"preview": "rsbuild preview",
|
|
13
|
+
"up:rsbuild": "pnpm up @rsbuild/* -L",
|
|
14
|
+
"format": "prettier --write \"**/*.{vue,ts,js,tsx,jsx,json,css,scss,less}\"",
|
|
15
|
+
"lint": "vue-tsc --noEmit && eslint --no-error-on-unmatched-pattern && stylelint **/*.{css,scss,less}",
|
|
16
|
+
"lint:fix": "eslint --fix && stylelint **/*.{css,scss,less} --fix",
|
|
17
|
+
"cz": "cz",
|
|
18
|
+
"push": "npm run commit && git push",
|
|
19
|
+
"commit": "git add . && npm run cz",
|
|
20
|
+
"up:vite": "pnpm up vite @vitejs/* vite-plugin-* -L"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@tanstack/vue-query": "5.51.15",
|
|
24
|
+
"axios": "1.7.9",
|
|
25
|
+
"lodash-es": "4.17.21",
|
|
26
|
+
"pinia": "2.3.1",
|
|
27
|
+
"vue": "3.5.13",
|
|
28
|
+
"vue-router": "4.5.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@commitlint/cli": "17.6.1",
|
|
32
|
+
"@commitlint/config-conventional": "17.6.1",
|
|
33
|
+
"@commitlint/cz-commitlint": "17.5.0",
|
|
34
|
+
"@eslint/js": "9.15.0",
|
|
35
|
+
"@rsbuild/core": "1.2.2",
|
|
36
|
+
"@rsbuild/plugin-eslint": "1.1.0",
|
|
37
|
+
"@rsbuild/plugin-vue": "1.0.5",
|
|
38
|
+
"@rsbuild/plugin-styled-components": "1.2.0",
|
|
39
|
+
"@rsbuild/plugin-svgr": "1.0.6",
|
|
40
|
+
"@rsbuild/plugin-type-check": "1.2.1",
|
|
41
|
+
"@rsdoctor/rspack-plugin": "0.4.13",
|
|
42
|
+
"@faker-js/faker": "8.4.1",
|
|
43
|
+
"@types/lodash-es": "4.17.12",
|
|
44
|
+
"@types/mockjs": "1.0.10",
|
|
45
|
+
"autoprefixer": "10.4.14",
|
|
46
|
+
"commitizen": "4.3.0",
|
|
47
|
+
"cssnano": "6.0.0",
|
|
48
|
+
"eslint": "9.17.0",
|
|
49
|
+
"eslint-import-resolver-typescript": "3.7.0",
|
|
50
|
+
"eslint-plugin-import": "2.31.0",
|
|
51
|
+
"eslint-plugin-vue": "9.32.0",
|
|
52
|
+
"globals": "15.12.0",
|
|
53
|
+
"husky": "9.1.6",
|
|
54
|
+
"inquirer": "8.1.2",
|
|
55
|
+
"postcss": "8.4.38",
|
|
56
|
+
"postcss-import": "16.1.0",
|
|
57
|
+
"postcss-nesting": "12.1.1",
|
|
58
|
+
"prettier": "3.2.5",
|
|
59
|
+
"rollup-plugin-visualizer": "5.12.0",
|
|
60
|
+
"stylelint": "16.10.0",
|
|
61
|
+
"stylelint-config-standard-scss": "13.1.0",
|
|
62
|
+
"stylelint-webpack-plugin": "5.0.0",
|
|
63
|
+
"tailwindcss": "3.4.3",
|
|
64
|
+
"typescript": "5.7.2",
|
|
65
|
+
"typescript-eslint": "8.15.0",
|
|
66
|
+
"vue-tsc": "2.2.0"
|
|
67
|
+
},
|
|
68
|
+
"config": {
|
|
69
|
+
"commitizen": {
|
|
70
|
+
"path": "@commitlint/cz-commitlint"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './view.vue'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { watch } from 'vue'
|
|
3
|
+
import { useHomeQuery } from '@/shared/service'
|
|
4
|
+
|
|
5
|
+
const { data } = useHomeQuery()
|
|
6
|
+
|
|
7
|
+
watch(data, data => {
|
|
8
|
+
console.log('data', data?.data)
|
|
9
|
+
})
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div>Home</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<style scoped></style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './index.vue'
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
plugins: {
|
|
3
|
-
'postcss-import': {},
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: {
|
|
3
|
+
'postcss-import': {},
|
|
4
|
+
'tailwindcss/nesting': 'postcss-nesting',
|
|
5
|
+
tailwindcss: {},
|
|
6
|
+
autoprefixer: {},
|
|
7
|
+
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {})
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
|
|
2
|
+
import names from './names'
|
|
3
|
+
import * as homeRouter from './home'
|
|
4
|
+
|
|
5
|
+
const routes: RouteRecordRaw[] = [
|
|
6
|
+
{
|
|
7
|
+
path: '/',
|
|
8
|
+
component: () => import('@/pages'),
|
|
9
|
+
redirect: { name: names.home },
|
|
10
|
+
children: [
|
|
11
|
+
...homeRouter.routes,
|
|
12
|
+
{
|
|
13
|
+
path: '/404',
|
|
14
|
+
name: names.notFound,
|
|
15
|
+
component: () => import('@/pages/not-found.vue')
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
export { default as routerNames } from './names'
|
|
22
|
+
|
|
23
|
+
export const router = createRouter({
|
|
24
|
+
history: createWebHistory(import.meta.env.PUBLIC_BASE_URL),
|
|
25
|
+
routes
|
|
26
|
+
})
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineConfig, loadEnv } from '@rsbuild/core'
|
|
2
|
+
import { pluginVue } from '@rsbuild/plugin-vue'
|
|
3
|
+
import { pluginEslint } from '@rsbuild/plugin-eslint'
|
|
4
|
+
import StylelintWebpackPlugin from 'stylelint-webpack-plugin'
|
|
5
|
+
import { pluginTypeCheck } from '@rsbuild/plugin-type-check'
|
|
6
|
+
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin'
|
|
7
|
+
import { pluginSvgr } from '@rsbuild/plugin-svgr'
|
|
8
|
+
import { createChunks } from './scripts'
|
|
9
|
+
|
|
10
|
+
export default defineConfig(({ envMode, command }) => {
|
|
11
|
+
const { parsed: env } = loadEnv()
|
|
12
|
+
return {
|
|
13
|
+
html: {
|
|
14
|
+
template: './index.html',
|
|
15
|
+
title: 'Vite + Vue + TS'
|
|
16
|
+
},
|
|
17
|
+
source: {
|
|
18
|
+
entry: {
|
|
19
|
+
index: './main.ts'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
resolve: {
|
|
23
|
+
alias: {
|
|
24
|
+
'@': __dirname
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
output: {
|
|
28
|
+
distPath: {
|
|
29
|
+
root: 'dist'
|
|
30
|
+
},
|
|
31
|
+
cleanDistPath: true
|
|
32
|
+
},
|
|
33
|
+
tools: {
|
|
34
|
+
rspack: {
|
|
35
|
+
plugins: [
|
|
36
|
+
new StylelintWebpackPlugin(),
|
|
37
|
+
process.env.RSDOCTOR && new RsdoctorRspackPlugin()
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
plugins: [
|
|
42
|
+
pluginTypeCheck(),
|
|
43
|
+
pluginEslint({
|
|
44
|
+
eslintPluginOptions: {
|
|
45
|
+
configType: 'flat'
|
|
46
|
+
}
|
|
47
|
+
}),
|
|
48
|
+
pluginSvgr(),
|
|
49
|
+
pluginVue()
|
|
50
|
+
],
|
|
51
|
+
performance: {
|
|
52
|
+
removeConsole: command === 'build' ? ['log'] : false,
|
|
53
|
+
chunkSplit: {
|
|
54
|
+
strategy: 'custom',
|
|
55
|
+
splitChunks: {
|
|
56
|
+
minChunks: 1,
|
|
57
|
+
cacheGroups: createChunks([{ libs: ['vue', 'vue-router'], name: 'vue' }])
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
bundleAnalyze: envMode === 'analyse' ? { openAnalyzer: true } : void 0
|
|
61
|
+
},
|
|
62
|
+
server: {
|
|
63
|
+
base: env.PUBLIC_BASE_URL,
|
|
64
|
+
host: '0.0.0.0',
|
|
65
|
+
compress: false,
|
|
66
|
+
proxy: [
|
|
67
|
+
{
|
|
68
|
+
context: [env.PUBLIC_API_HOST],
|
|
69
|
+
target: 'http://127.0.0.1:3000'
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CacheGroups } from '@rsbuild/core'
|
|
2
|
+
|
|
3
|
+
export function createChunks(
|
|
4
|
+
chunks: Array<{ name: string; libs: string[] | RegExp; priority?: number }>
|
|
5
|
+
) {
|
|
6
|
+
const result: CacheGroups = {
|
|
7
|
+
vendors: {
|
|
8
|
+
test: /[\\/]node_modules[\\/]/,
|
|
9
|
+
chunks: 'all',
|
|
10
|
+
name: 'vendors',
|
|
11
|
+
priority: -1
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
chunks.forEach(({ name, libs, priority }) => {
|
|
15
|
+
result[name] = {
|
|
16
|
+
test: Array.isArray(libs)
|
|
17
|
+
? new RegExp(`[\\\\/]node_modules[\\\\/](${libs.join('|')})[\\\\/]`)
|
|
18
|
+
: libs,
|
|
19
|
+
chunks: 'all',
|
|
20
|
+
name,
|
|
21
|
+
priority
|
|
22
|
+
}
|
|
23
|
+
return result
|
|
24
|
+
})
|
|
25
|
+
return result
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createChunks'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|