create-packer 1.45.18 → 1.45.20
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/electron-vue/.editorconfig +14 -0
- package/template/electron-vue/.env +3 -0
- package/template/electron-vue/.env.development +3 -0
- package/template/electron-vue/.gitignore +28 -0
- package/template/electron-vue/.husky/commit-msg +4 -0
- package/template/electron-vue/.husky/pre-commit +4 -0
- package/template/electron-vue/.prettierignore +6 -0
- package/template/electron-vue/.prettierrc +18 -0
- package/template/electron-vue/.stylelintignore +4 -0
- package/template/electron-vue/.stylelintrc +35 -0
- package/template/electron-vue/.vscode/extensions.json +9 -0
- package/template/electron-vue/README.md +14 -0
- package/template/electron-vue/assets/rspack.png +0 -0
- package/template/electron-vue/build.config.json +40 -0
- package/template/electron-vue/commitlint.config.cjs +1 -0
- package/template/electron-vue/configs/clean.ts +10 -0
- package/template/electron-vue/configs/config.ts +25 -0
- package/template/electron-vue/configs/createChunks.ts +26 -0
- package/template/electron-vue/configs/rsbuild.main.config.ts +54 -0
- package/template/electron-vue/configs/rsbuild.preload.config.ts +54 -0
- package/template/electron-vue/configs/rsbuild.renderer.config.ts +64 -0
- package/template/electron-vue/env.d.ts +18 -0
- package/template/electron-vue/eslint.config.mjs +115 -0
- package/template/electron-vue/main/main.ts +83 -0
- package/template/electron-vue/main/tools/html.ts +8 -0
- package/template/electron-vue/main/tools/index.ts +1 -0
- package/template/electron-vue/package.json +87 -0
- package/template/electron-vue/pnpm-lock.yaml +10158 -0
- package/template/electron-vue/postcss.config.cjs +9 -0
- package/template/electron-vue/preload/index.ts +1 -0
- package/template/electron-vue/preload/toolr.ts +26 -0
- package/template/electron-vue/renderer/domain/app/app.ts +4 -0
- package/template/electron-vue/renderer/domain/app/components/app.vue +18 -0
- package/template/electron-vue/renderer/domain/app/components/index.ts +1 -0
- package/template/electron-vue/renderer/domain/app/createComponentInstance.ts +43 -0
- package/template/electron-vue/renderer/domain/app/index.ts +3 -0
- package/template/electron-vue/renderer/domain/router/home/index.ts +2 -0
- package/template/electron-vue/renderer/domain/router/home/names.ts +3 -0
- package/template/electron-vue/renderer/domain/router/home/routes.ts +8 -0
- package/template/electron-vue/renderer/domain/router/index.ts +26 -0
- package/template/electron-vue/renderer/domain/router/names.ts +5 -0
- package/template/electron-vue/renderer/index.html +11 -0
- package/template/electron-vue/renderer/main.css +4 -0
- package/template/electron-vue/renderer/main.ts +6 -0
- package/template/electron-vue/renderer/pages/home/index.ts +1 -0
- package/template/electron-vue/renderer/pages/home/view.vue +12 -0
- package/template/electron-vue/renderer/pages/index.ts +1 -0
- package/template/electron-vue/renderer/pages/index.vue +3 -0
- package/template/electron-vue/renderer/pages/not-found.vue +3 -0
- package/template/electron-vue/renderer/public/vite.svg +1 -0
- package/template/electron-vue/renderer/shared/assets/vue.svg +1 -0
- package/template/electron-vue/renderer/shared/components/index.ts +0 -0
- package/template/electron-vue/renderer/shared/constant/index.ts +0 -0
- package/template/electron-vue/renderer/shared/hooks/index.ts +2 -0
- package/template/electron-vue/renderer/shared/hooks/useList.ts +86 -0
- package/template/electron-vue/renderer/shared/hooks/useVisible.ts +27 -0
- package/template/electron-vue/renderer/shared/service/api.ts +1 -0
- package/template/electron-vue/renderer/shared/service/home.ts +7 -0
- package/template/electron-vue/renderer/shared/service/index.ts +3 -0
- package/template/electron-vue/renderer/shared/service/request.ts +5 -0
- package/template/electron-vue/renderer/shared/tools/index.ts +0 -0
- package/template/electron-vue/tsconfig.json +25 -0
- package/template/electron-vue/tsconfig.node.json +10 -0
- package/template/web-app/react-rsbuild/domain/app/components/app-context.tsx +8 -6
- package/template/web-app/react-rsbuild/env.d.ts +7 -0
- package/template/web-app/react-rsbuild/package.json +3 -2
- package/template/web-app/react-rsbuild/pages/home/view.styled.ts +5 -0
- package/template/web-app/react-rsbuild/pages/home/view.tsx +2 -3
- package/template/web-app/react-rsbuild/rsbuild.config.ts +12 -1
- package/template/web-app/react-rsbuild/shared/styles/global.ts +5 -5
- package/template/web-app/react-rsbuild/shared/styles/index.ts +1 -1
- package/template/web-app/react-rsbuild/tsconfig.json +1 -0
- package/template/web-app/react-vite/domain/app/components/app-context.tsx +8 -6
- package/template/web-app/react-vite/package.json +2 -1
- package/template/web-app/react-vite/pages/home/view.styled.ts +5 -0
- package/template/web-app/react-vite/pages/home/view.tsx +2 -3
- package/template/web-app/react-vite/shared/styles/global.ts +5 -5
- package/template/web-app/react-vite/shared/styles/index.ts +0 -1
- package/template/web-app/react-vite/tsconfig.json +1 -0
- package/template/web-app/react-vite/vite-env.d.ts +15 -6
- package/template/web-app/react-vite/vite.config.ts +3 -1
- package/template/web-app/vue-rsbuild/package.json +73 -73
- package/template/web-extension/eslint.config.js +0 -1
- package/template/web-extension/package.json +2 -1
- package/template/web-extension/shared/components/app-context/view.tsx +8 -6
- package/template/web-extension/shared/styles/global.ts +6 -6
- package/template/web-extension/shared/styles/index.ts +0 -1
- package/template/web-extension/tsconfig.json +1 -0
- package/template/web-extension/vite-env.d.ts +15 -6
- package/template/web-extension/wxt.config.ts +1 -1
- package/template/web-app/react-rsbuild/pages/home/view.css.ts +0 -7
- package/template/web-app/react-rsbuild/shared/styles/tss.ts +0 -6
- package/template/web-app/react-vite/pages/home/view.css.ts +0 -7
- package/template/web-app/react-vite/shared/styles/tss.ts +0 -6
- package/template/web-extension/shared/styles/tss.ts +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './toolr'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron'
|
|
2
|
+
|
|
3
|
+
export type Channels = 'ipc-example'
|
|
4
|
+
|
|
5
|
+
const electronHandler = {
|
|
6
|
+
ipcRenderer: {
|
|
7
|
+
sendMessage(channel: Channels, ...args: unknown[]) {
|
|
8
|
+
ipcRenderer.send(channel, ...args)
|
|
9
|
+
},
|
|
10
|
+
on(channel: Channels, func: (...args: unknown[]) => void) {
|
|
11
|
+
const subscription = (_event: IpcRendererEvent, ...args: unknown[]) => func(...args)
|
|
12
|
+
ipcRenderer.on(channel, subscription)
|
|
13
|
+
|
|
14
|
+
return () => {
|
|
15
|
+
ipcRenderer.removeListener(channel, subscription)
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
once(channel: Channels, func: (...args: unknown[]) => void) {
|
|
19
|
+
ipcRenderer.once(channel, (_event, ...args) => func(...args))
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
contextBridge.exposeInMainWorld('electron', electronHandler)
|
|
25
|
+
|
|
26
|
+
export type ElectronHandler = typeof electronHandler
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<router-view />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { router, routerNames } from '@/renderer/domain/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,43 @@
|
|
|
1
|
+
import { createVNode, render, VNodeChild } from 'vue'
|
|
2
|
+
import app from './app'
|
|
3
|
+
|
|
4
|
+
const store = new Map()
|
|
5
|
+
|
|
6
|
+
function reset(oldObj: Record<string, any>, newObj: Record<string, any>) {
|
|
7
|
+
Object.keys(oldObj).forEach(k => {
|
|
8
|
+
oldObj[k] = void 0
|
|
9
|
+
})
|
|
10
|
+
Object.assign(oldObj, newObj)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function createComponentInstance<
|
|
14
|
+
P extends Record<string, any>,
|
|
15
|
+
E extends Record<string, any>,
|
|
16
|
+
Slots extends Record<string, () => VNodeChild> = Record<string, () => VNodeChild>
|
|
17
|
+
>(name: string, component: any, props?: P, slots?: Slots) {
|
|
18
|
+
let vNode = store.get(name)
|
|
19
|
+
function updateProps(props: Partial<P>) {
|
|
20
|
+
reset(vNode.component.props, props)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function updateSlots(slots: Partial<Record<string, () => VNodeChild>>) {
|
|
24
|
+
reset(vNode.component.slots, slots)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!vNode) {
|
|
28
|
+
const container = document.createElement('div')
|
|
29
|
+
vNode = createVNode(component, props, slots)
|
|
30
|
+
vNode.appContext = app._context || {}
|
|
31
|
+
store.set(name, vNode)
|
|
32
|
+
render(vNode, container)
|
|
33
|
+
} else {
|
|
34
|
+
updateProps(props || {})
|
|
35
|
+
updateSlots(slots || {})
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
instance: vNode,
|
|
39
|
+
updateProps,
|
|
40
|
+
updateSlots,
|
|
41
|
+
...(vNode.component?.exposed as E)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRouter, createWebHashHistory, 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('@/renderer/pages'),
|
|
9
|
+
redirect: { name: names.home },
|
|
10
|
+
children: [
|
|
11
|
+
...homeRouter.routes,
|
|
12
|
+
{
|
|
13
|
+
path: '/404',
|
|
14
|
+
name: names.notFound,
|
|
15
|
+
component: () => import('@/renderer/pages/not-found.vue')
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
export { default as routerNames } from './names'
|
|
22
|
+
|
|
23
|
+
export const router = createRouter({
|
|
24
|
+
history: createWebHashHistory(import.meta.env.PUBLIC_BASE_URL),
|
|
25
|
+
routes
|
|
26
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
9
|
+
<div id="app"></div>
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './view.vue'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { fetchHomeData } from '@/renderer/shared/service'
|
|
3
|
+
|
|
4
|
+
const data = fetchHomeData()
|
|
5
|
+
console.log('data', data)
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div class="tw:flex tw:justify-center tw:align-middle">Home</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<style scoped></style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './index.vue'
|
|
@@ -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 @@
|
|
|
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>
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ref, reactive, computed, unref } from 'vue'
|
|
2
|
+
import { cloneDeep, pick, isNil } from 'es-toolkit'
|
|
3
|
+
import { assign, size, max } from 'es-toolkit/compat'
|
|
4
|
+
|
|
5
|
+
export interface configType<ListItem, P> {
|
|
6
|
+
/**
|
|
7
|
+
* @description 默认请求参数
|
|
8
|
+
*/
|
|
9
|
+
defaultParams: P
|
|
10
|
+
/** 列表请求 */
|
|
11
|
+
fetch: (state: { params: P }) => Promise<{
|
|
12
|
+
list: ListItem[]
|
|
13
|
+
page?: number
|
|
14
|
+
pageSize?: number
|
|
15
|
+
total?: number
|
|
16
|
+
sum?: Record<string, any>
|
|
17
|
+
}>
|
|
18
|
+
/** 初始化列表时的配置 */
|
|
19
|
+
initConfig?: {
|
|
20
|
+
/** 初始化的时候需要保留值的字段 */
|
|
21
|
+
keepParamsKeys?: Array<keyof P>
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function createListStore<
|
|
26
|
+
P extends { page?: number; pageSize?: number; [key: string]: any },
|
|
27
|
+
ListItem extends Record<string, any> = Record<string, any>
|
|
28
|
+
>(config: configType<ListItem, P>) {
|
|
29
|
+
const loading = ref(true)
|
|
30
|
+
const total = ref(0)
|
|
31
|
+
const params = reactive(cloneDeep(config.defaultParams))
|
|
32
|
+
const list = ref<ListItem[]>([])
|
|
33
|
+
const sum = reactive<Record<string, any>>({})
|
|
34
|
+
const selected = ref<ListItem[]>([])
|
|
35
|
+
const selectedKeys = ref<(string | number)[]>([])
|
|
36
|
+
const pagination = computed(() => ({
|
|
37
|
+
current: params.page || 0,
|
|
38
|
+
pageSize: params.pageSize || 0,
|
|
39
|
+
total: total.value
|
|
40
|
+
}))
|
|
41
|
+
const selectedLen = computed(() => {
|
|
42
|
+
return max([size(selected.value), size(selectedKeys.value)]) || 0
|
|
43
|
+
})
|
|
44
|
+
function resetParams() {
|
|
45
|
+
assign(params, cloneDeep(config.defaultParams))
|
|
46
|
+
}
|
|
47
|
+
async function fetchList(arg?: { params?: Partial<P>; isConcat?: boolean; isInit?: boolean }) {
|
|
48
|
+
loading.value = true
|
|
49
|
+
try {
|
|
50
|
+
if (arg?.isInit) {
|
|
51
|
+
assign(
|
|
52
|
+
params,
|
|
53
|
+
cloneDeep(config.defaultParams),
|
|
54
|
+
pick(params, (config?.initConfig?.keepParamsKeys || []) as never)
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
assign(params, arg?.params)
|
|
58
|
+
const result = await config.fetch({ params: unref(params) })
|
|
59
|
+
if (!isNil(result.page) && arg?.isConcat) {
|
|
60
|
+
list.value = [...list.value, ...result.list] as ListItem[]
|
|
61
|
+
} else {
|
|
62
|
+
list.value = result.list
|
|
63
|
+
}
|
|
64
|
+
sum.value = result.sum || {}
|
|
65
|
+
total.value = result.total || total.value
|
|
66
|
+
params.page = result.page || params.page
|
|
67
|
+
params.pageSize = result.pageSize || params.pageSize
|
|
68
|
+
} finally {
|
|
69
|
+
loading.value = false
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
loading,
|
|
75
|
+
total,
|
|
76
|
+
params,
|
|
77
|
+
list,
|
|
78
|
+
sum,
|
|
79
|
+
selected,
|
|
80
|
+
selectedKeys,
|
|
81
|
+
pagination,
|
|
82
|
+
selectedLen,
|
|
83
|
+
resetParams,
|
|
84
|
+
fetchList
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
2
|
+
import { isFunction } from 'es-toolkit'
|
|
3
|
+
|
|
4
|
+
export interface useVisibleConfigType {
|
|
5
|
+
defaultVisible?: boolean
|
|
6
|
+
onBeforeShow?: () => Promise<boolean | void>
|
|
7
|
+
onBeforeHide?: () => Promise<boolean | void>
|
|
8
|
+
}
|
|
9
|
+
export default function useVisible(config?: useVisibleConfigType) {
|
|
10
|
+
const visible = ref(config?.defaultVisible ?? false)
|
|
11
|
+
const onShow = async () => {
|
|
12
|
+
let isShow: boolean | void = true
|
|
13
|
+
if (isFunction(config?.onBeforeShow)) {
|
|
14
|
+
isShow = await config?.onBeforeShow?.()
|
|
15
|
+
}
|
|
16
|
+
visible.value = isShow !== false
|
|
17
|
+
}
|
|
18
|
+
const onClose = async () => {
|
|
19
|
+
let isHide: boolean | void = true
|
|
20
|
+
if (isFunction(config?.onBeforeHide)) {
|
|
21
|
+
isHide = await config?.onBeforeHide?.()
|
|
22
|
+
}
|
|
23
|
+
visible.value = isHide === false
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return { visible, onShow, onClose }
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const HOME_DATA = '/homeData'
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"jsx": "preserve",
|
|
10
|
+
"jsxImportSource": "vue",
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"strictPropertyInitialization": false,
|
|
15
|
+
"esModuleInterop": true,
|
|
16
|
+
"lib": ["ESNext", "DOM"],
|
|
17
|
+
"skipLibCheck": true,
|
|
18
|
+
"paths": {
|
|
19
|
+
"@/*": ["./*"],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
"include": ["**/*.tsx", "**/*.ts", "**/*.vue"],
|
|
23
|
+
"exclude": ["scripts", "rsbuild.config.ts"],
|
|
24
|
+
"references": [{ "path": "./tsconfig.node.json" }],
|
|
25
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react'
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
3
|
-
import {
|
|
3
|
+
import { Global, ThemeProvider } from '@emotion/react'
|
|
4
4
|
import { request } from '@/shared/service'
|
|
5
|
-
import { globalCss } from '@/shared/styles'
|
|
5
|
+
import { globalCss, theme } from '@/shared/styles'
|
|
6
6
|
|
|
7
7
|
const queryClient = new QueryClient({
|
|
8
8
|
defaultOptions: {
|
|
@@ -21,9 +21,11 @@ export interface propsType {
|
|
|
21
21
|
}
|
|
22
22
|
export const Root: FunctionComponent<propsType> = props => {
|
|
23
23
|
return (
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
<ThemeProvider theme={theme}>
|
|
25
|
+
<QueryClientProvider client={queryClient}>
|
|
26
|
+
<Global styles={globalCss} />
|
|
27
|
+
{props.children}
|
|
28
|
+
</QueryClientProvider>
|
|
29
|
+
</ThemeProvider>
|
|
28
30
|
)
|
|
29
31
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/// <reference types="@rsbuild/core/types" />
|
|
2
2
|
|
|
3
|
+
import '@emotion/react'
|
|
4
|
+
import { type themeType } from '@/shared/styles'
|
|
5
|
+
|
|
3
6
|
declare global {
|
|
4
7
|
interface ImportMetaEnv {
|
|
5
8
|
readonly PUBLIC_BASE_URL: string
|
|
@@ -19,3 +22,7 @@ declare module '*.svg?react' {
|
|
|
19
22
|
const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement>>
|
|
20
23
|
export default ReactComponent
|
|
21
24
|
}
|
|
25
|
+
|
|
26
|
+
declare module '@emotion/react' {
|
|
27
|
+
export interface Theme extends themeType {}
|
|
28
|
+
}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@emotion/react": "11.14.0",
|
|
23
|
+
"@emotion/styled": "11.14.1",
|
|
23
24
|
"@tanstack/react-query": "5.51.15",
|
|
24
25
|
"axios": "1.7.9",
|
|
25
26
|
"define-zustand": "3.4.0",
|
|
@@ -30,7 +31,6 @@
|
|
|
30
31
|
"react-dom": "18.3.1",
|
|
31
32
|
"react-router": "7.5.0",
|
|
32
33
|
"react-use": "17.5.0",
|
|
33
|
-
"tss-react": "4.9.19",
|
|
34
34
|
"type-fest": "4.33.0",
|
|
35
35
|
"zustand": "5.0.3"
|
|
36
36
|
},
|
|
@@ -39,12 +39,13 @@
|
|
|
39
39
|
"@commitlint/config-conventional": "17.6.1",
|
|
40
40
|
"@commitlint/cz-commitlint": "17.5.0",
|
|
41
41
|
"@eslint/js": "9.15.0",
|
|
42
|
-
"@rsbuild/core": "1.5.
|
|
42
|
+
"@rsbuild/core": "1.5.10",
|
|
43
43
|
"@rsbuild/plugin-eslint": "1.1.2",
|
|
44
44
|
"@rsbuild/plugin-react": "1.4.0",
|
|
45
45
|
"@rsbuild/plugin-svgr": "1.2.2",
|
|
46
46
|
"@rsbuild/plugin-type-check": "1.2.4",
|
|
47
47
|
"@rsdoctor/rspack-plugin": "1.2.3",
|
|
48
|
+
"@swc/plugin-emotion": "11.1.0",
|
|
48
49
|
"@types/node": "18.16.0",
|
|
49
50
|
"@types/qs": "6.9.7",
|
|
50
51
|
"@types/react": "18.3.3",
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useHomeData } from '@/shared/service'
|
|
2
|
-
import {
|
|
2
|
+
import { StyledRoot } from './view.styled'
|
|
3
3
|
|
|
4
4
|
export default function Home() {
|
|
5
5
|
const { data } = useHomeData()
|
|
6
|
-
const { classes } = useStyles()
|
|
7
6
|
|
|
8
7
|
console.log('data', data)
|
|
9
8
|
|
|
10
|
-
return <
|
|
9
|
+
return <StyledRoot>sdfs</StyledRoot>
|
|
11
10
|
}
|
|
@@ -41,6 +41,13 @@ export default defineConfig(({ envMode, command }) => {
|
|
|
41
41
|
new StylelintWebpackPlugin(),
|
|
42
42
|
process.env.RSDOCTOR && new RsdoctorRspackPlugin()
|
|
43
43
|
]
|
|
44
|
+
},
|
|
45
|
+
swc: {
|
|
46
|
+
jsc: {
|
|
47
|
+
experimental: {
|
|
48
|
+
plugins: [['@swc/plugin-emotion', {}]]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
44
51
|
}
|
|
45
52
|
},
|
|
46
53
|
plugins: [
|
|
@@ -52,7 +59,11 @@ export default defineConfig(({ envMode, command }) => {
|
|
|
52
59
|
}
|
|
53
60
|
}),
|
|
54
61
|
pluginSvgr(),
|
|
55
|
-
pluginReact(
|
|
62
|
+
pluginReact({
|
|
63
|
+
swcReactOptions: {
|
|
64
|
+
importSource: '@emotion/react'
|
|
65
|
+
}
|
|
66
|
+
})
|
|
56
67
|
],
|
|
57
68
|
performance: {
|
|
58
69
|
removeConsole: command === 'build' ? ['log'] : false,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './global'
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './theme'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react'
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
3
|
-
import {
|
|
3
|
+
import { Global, ThemeProvider } from '@emotion/react'
|
|
4
4
|
import { request } from '@/shared/service'
|
|
5
|
-
import { globalCss } from '@/shared/styles'
|
|
5
|
+
import { globalCss, theme } from '@/shared/styles'
|
|
6
6
|
|
|
7
7
|
const queryClient = new QueryClient({
|
|
8
8
|
defaultOptions: {
|
|
@@ -21,9 +21,11 @@ export interface propsType {
|
|
|
21
21
|
}
|
|
22
22
|
export const Root: FunctionComponent<propsType> = props => {
|
|
23
23
|
return (
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
<ThemeProvider theme={theme}>
|
|
25
|
+
<QueryClientProvider client={queryClient}>
|
|
26
|
+
<Global styles={globalCss} />
|
|
27
|
+
{props.children}
|
|
28
|
+
</QueryClientProvider>
|
|
29
|
+
</ThemeProvider>
|
|
28
30
|
)
|
|
29
31
|
}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@emotion/react": "11.14.0",
|
|
22
|
+
"@emotion/styled": "11.14.1",
|
|
22
23
|
"@tanstack/react-query": "5.51.15",
|
|
23
24
|
"axios": "1.7.9",
|
|
24
25
|
"define-zustand": "3.4.0",
|
|
@@ -29,7 +30,6 @@
|
|
|
29
30
|
"react-dom": "18.3.1",
|
|
30
31
|
"react-router": "7.5.0",
|
|
31
32
|
"react-use": "17.5.0",
|
|
32
|
-
"tss-react": "4.9.19",
|
|
33
33
|
"type-fest": "4.33.0",
|
|
34
34
|
"zustand": "5.0.3"
|
|
35
35
|
},
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@commitlint/cli": "17.6.1",
|
|
38
38
|
"@commitlint/config-conventional": "17.6.1",
|
|
39
39
|
"@commitlint/cz-commitlint": "17.5.0",
|
|
40
|
+
"@emotion/babel-plugin": "11.13.5",
|
|
40
41
|
"@eslint/js": "9.15.0",
|
|
41
42
|
"@faker-js/faker": "8.4.1",
|
|
42
43
|
"@types/node": "18.16.0",
|