create-packer 1.43.13 → 1.44.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/lib/workspace/packages/ts/package.json +2 -2
- package/template/web-app/react-rsbuild/domain/app/components/app-context.tsx +15 -3
- package/template/web-app/react-rsbuild/domain/app/components/app.tsx +4 -4
- package/template/web-app/react-rsbuild/domain/app/startApp.tsx +6 -6
- package/template/web-app/react-rsbuild/domain/router/router.tsx +0 -1
- package/template/web-app/react-rsbuild/env.d.ts +14 -21
- package/template/web-app/react-rsbuild/main.css +7 -0
- package/template/web-app/react-rsbuild/main.tsx +4 -3
- package/template/web-app/react-rsbuild/package.json +3 -3
- package/template/web-app/react-rsbuild/pages/home/view.tsx +9 -11
- package/template/web-app/react-rsbuild/postcss.config.cjs +8 -7
- package/template/web-app/react-rsbuild/rsbuild.config.ts +2 -8
- package/template/web-app/react-rsbuild/shared/service/home.ts +6 -4
- package/template/web-app/react-rsbuild/tsconfig.node.json +1 -1
- package/template/web-app/react-vite/domain/app/components/app-context.tsx +15 -3
- package/template/web-app/react-vite/domain/app/components/app.tsx +4 -4
- package/template/web-app/react-vite/domain/router/router.tsx +0 -1
- package/template/web-app/react-vite/main.css +7 -0
- package/template/web-app/react-vite/main.tsx +1 -0
- package/template/web-app/react-vite/package.json +4 -3
- package/template/web-app/react-vite/pages/home/view.tsx +9 -11
- package/template/web-app/react-vite/shared/service/home.ts +6 -4
- package/template/web-app/react-vite/vite-env.d.ts +6 -14
- package/template/web-app/react-vite/vite.config.ts +80 -78
- package/template/web-app/vue/domain/app/components/app.vue +1 -1
- package/template/web-app/vue/{style.css → main.css} +2 -2
- package/template/web-app/vue/main.ts +2 -2
- package/template/web-app/vue/package.json +2 -2
- package/template/web-app/vue/pages/home/view.vue +1 -1
- package/template/web-app/vue/vite.config.ts +4 -5
- package/template/web-app/vue-rsbuild/domain/app/components/app.vue +1 -1
- package/template/web-app/vue-rsbuild/{style.css → main.css} +2 -2
- package/template/web-app/vue-rsbuild/main.ts +2 -2
- package/template/web-app/vue-rsbuild/package.json +2 -2
- package/template/web-app/vue-rsbuild/pages/home/view.vue +1 -1
- package/template/web-app/vue-rsbuild/tsconfig.node.json +2 -2
- package/template/web-extension/.wxt/eslint-auto-imports.mjs +29 -1
- package/template/web-extension/.wxt/types/imports-module.d.ts +20 -0
- package/template/web-extension/.wxt/types/imports.d.ts +45 -17
- package/template/web-extension/.wxt/types/paths.d.ts +1 -0
- package/template/web-extension/.wxt/wxt.d.ts +1 -1
- package/template/web-extension/entrypoints/content/constants/base.ts +1 -1
- package/template/web-extension/entrypoints/content/constants/index.ts +1 -1
- package/template/web-extension/entrypoints/content/domain/app/tools/insertApp.tsx +58 -58
- package/template/web-extension/entrypoints/content/index.tsx +1 -1
- package/template/web-extension/entrypoints/content/modules/common/common.tsx +10 -10
- package/template/web-extension/entrypoints/popup/main.tsx +2 -2
- package/template/web-extension/package.json +2 -2
- package/template/web-extension/shared/components/app-context/index.ts +1 -0
- package/template/web-extension/shared/components/{app-context.tsx → app-context/view.tsx} +4 -2
- package/template/web-extension/shared/components/index.ts +1 -1
- package/template/web-extension/shared/styles/global-style.tsx +14 -0
- package/template/web-extension/shared/styles/index.ts +2 -2
- package/template/web-extension/vite-env.d.ts +3 -3
- package/template/web-extension/wxt.config.ts +10 -4
- package/template/nest/.eslintrc.js +0 -25
- package/template/nest/.gitignore +0 -35
- package/template/nest/.husky/pre-commit +0 -4
- package/template/nest/.prettierrc +0 -6
- package/template/nest/README.md +0 -73
- package/template/nest/nest-cli.json +0 -5
- package/template/nest/package.json +0 -82
- package/template/nest/src/app.controller.spec.ts +0 -22
- package/template/nest/src/app.controller.ts +0 -12
- package/template/nest/src/app.module.ts +0 -10
- package/template/nest/src/app.service.ts +0 -8
- package/template/nest/src/main.ts +0 -10
- package/template/nest/src/utils/transform.interceptor.ts +0 -26
- package/template/nest/test/app.e2e-spec.ts +0 -24
- package/template/nest/test/jest-e2e.json +0 -9
- package/template/nest/tsconfig.build.json +0 -5
- package/template/nest/tsconfig.json +0 -21
- package/template/web-app/next/.editorconfig +0 -14
- package/template/web-app/next/.eslintrc.json +0 -8
- package/template/web-app/next/.gitignore +0 -36
- package/template/web-app/next/.husky/commit-msg +0 -4
- package/template/web-app/next/.husky/pre-commit +0 -4
- package/template/web-app/next/.prettierrc +0 -12
- package/template/web-app/next/.stylelintrc +0 -29
- package/template/web-app/next/.vscode/extensions.json +0 -7
- package/template/web-app/next/README.md +0 -34
- package/template/web-app/next/app/favicon.ico +0 -0
- package/template/web-app/next/app/globals.css +0 -22
- package/template/web-app/next/app/layout.tsx +0 -18
- package/template/web-app/next/app/page.tsx +0 -113
- package/template/web-app/next/commitlint.config.cjs +0 -1
- package/template/web-app/next/next-env.d.ts +0 -5
- package/template/web-app/next/next.config.js +0 -5
- package/template/web-app/next/package.json +0 -47
- package/template/web-app/next/postcss.config.js +0 -6
- package/template/web-app/next/public/next.svg +0 -1
- package/template/web-app/next/public/vercel.svg +0 -1
- package/template/web-app/next/tailwind.config.js +0 -20
- package/template/web-app/next/tsconfig.json +0 -21
- package/template/web-app/react-rsbuild/domain/app/app.styled.ts +0 -3
- package/template/web-app/react-rsbuild/pages/home/view.styled.ts +0 -7
- package/template/web-app/react-rsbuild/shared/theme/index.ts +0 -1
- package/template/web-app/react-rsbuild/shared/theme/theme.styled.ts +0 -56
- package/template/web-app/react-vite/domain/app/app.styled.ts +0 -3
- package/template/web-app/react-vite/pages/home/view.styled.ts +0 -7
- package/template/web-app/react-vite/shared/theme/index.ts +0 -1
- package/template/web-app/react-vite/shared/theme/theme.styled.ts +0 -55
- package/template/web-app/vue/tailwind.config.cjs +0 -15
- package/template/web-app/vue-rsbuild/tailwind.config.cjs +0 -15
- package/template/web-extension/shared/styles/global.styled.ts +0 -9
- /package/template/web-app/vue/{router → domain/router}/home/index.ts +0 -0
- /package/template/web-app/vue/{router → domain/router}/home/names.ts +0 -0
- /package/template/web-app/vue/{router → domain/router}/home/routes.ts +0 -0
- /package/template/web-app/vue/{router → domain/router}/index.ts +0 -0
- /package/template/web-app/vue/{router → domain/router}/names.ts +0 -0
- /package/template/web-app/vue-rsbuild/{router → domain/router}/home/index.ts +0 -0
- /package/template/web-app/vue-rsbuild/{router → domain/router}/home/names.ts +0 -0
- /package/template/web-app/vue-rsbuild/{router → domain/router}/home/routes.ts +0 -0
- /package/template/web-app/vue-rsbuild/{router → domain/router}/index.ts +0 -0
- /package/template/web-app/vue-rsbuild/{router → domain/router}/names.ts +0 -0
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@vitest/coverage-v8": "
|
|
19
|
+
"@vitest/coverage-v8": "3.1.2",
|
|
20
20
|
"eslint": "9.17.0",
|
|
21
21
|
"eslint-import-resolver-typescript": "3.7.0",
|
|
22
22
|
"eslint-plugin-import": "2.31.0",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"stylelint-config-standard-scss": "13.0.0",
|
|
26
26
|
"typescript": "5.8.2",
|
|
27
27
|
"typescript-eslint": "8.15.0",
|
|
28
|
-
"vitest": "
|
|
28
|
+
"vitest": "3.1.2"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
3
|
+
import { request } from '@/shared/service'
|
|
4
4
|
|
|
5
|
+
const queryClient = new QueryClient({
|
|
6
|
+
defaultOptions: {
|
|
7
|
+
queries: {
|
|
8
|
+
queryFn: async ({ queryKey }) => {
|
|
9
|
+
const { data } = await request.get(queryKey[0] as string, {
|
|
10
|
+
params: queryKey[1]
|
|
11
|
+
})
|
|
12
|
+
return data
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
})
|
|
5
17
|
export interface propsType {
|
|
6
18
|
children: ReactNode
|
|
7
19
|
}
|
|
8
20
|
export const Root: FunctionComponent<propsType> = props => {
|
|
9
|
-
return <
|
|
21
|
+
return <QueryClientProvider client={queryClient}>{props.children}</QueryClientProvider>
|
|
10
22
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { useLayoutEffect } from 'react'
|
|
1
|
+
import { useLayoutEffect, Suspense } from 'react'
|
|
2
2
|
import { RouterProvider } from 'react-router/dom'
|
|
3
3
|
import { request } from '@/shared/service'
|
|
4
4
|
import { routerInstance } from '@/domain/router'
|
|
5
|
-
import { GlobalStyle } from '../app.styled'
|
|
6
5
|
import * as AppContext from './app-context'
|
|
7
6
|
|
|
8
7
|
export const Root = () => {
|
|
@@ -17,8 +16,9 @@ export const Root = () => {
|
|
|
17
16
|
|
|
18
17
|
return (
|
|
19
18
|
<AppContext.Root>
|
|
20
|
-
<
|
|
21
|
-
|
|
19
|
+
<Suspense fallback={<>loading...</>}>
|
|
20
|
+
<RouterProvider router={routerInstance} />
|
|
21
|
+
</Suspense>
|
|
22
22
|
</AppContext.Root>
|
|
23
23
|
)
|
|
24
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createRoot } from 'react-dom/client'
|
|
2
|
-
import { App } from '@/domain/app'
|
|
3
|
-
|
|
4
|
-
export default function () {
|
|
5
|
-
createRoot(document.getElementById('root') as HTMLElement).render(<App.Root />)
|
|
6
|
-
}
|
|
1
|
+
import { createRoot } from 'react-dom/client'
|
|
2
|
+
import { App } from '@/domain/app'
|
|
3
|
+
|
|
4
|
+
export default function () {
|
|
5
|
+
createRoot(document.getElementById('root') as HTMLElement).render(<App.Root />)
|
|
6
|
+
}
|
|
@@ -1,28 +1,21 @@
|
|
|
1
1
|
/// <reference types="@rsbuild/core/types" />
|
|
2
|
-
import 'styled-components'
|
|
3
|
-
import { themeType } from './shared/theme'
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
interface ImportMetaEnv {
|
|
4
|
+
readonly PUBLIC_BASE_URL: string
|
|
5
|
+
readonly PUBLIC_API_HOST: string
|
|
6
|
+
readonly PUBLIC_ENV_MODE: 'production' | 'development'
|
|
7
7
|
}
|
|
8
|
-
declare global {
|
|
9
|
-
interface ImportMetaEnv {
|
|
10
|
-
readonly PUBLIC_BASE_URL: string
|
|
11
|
-
readonly PUBLIC_API_HOST: string
|
|
12
|
-
readonly PUBLIC_ENV_MODE: 'production' | 'development'
|
|
13
|
-
}
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
interface ImportMeta {
|
|
10
|
+
readonly env: ImportMetaEnv
|
|
11
|
+
}
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
declare module '*.svg' {
|
|
14
|
+
const content: string
|
|
15
|
+
export default content
|
|
16
|
+
}
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
18
|
+
declare module '*.svg?react' {
|
|
19
|
+
const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement>>
|
|
20
|
+
export default ReactComponent
|
|
28
21
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { startApp } from '@/domain/app'
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { startApp } from '@/domain/app'
|
|
2
|
+
import './main.css'
|
|
3
|
+
|
|
4
|
+
startApp()
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"commit": "git add . && npm run cz"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@tanstack/react-query": "5.51.15",
|
|
22
23
|
"axios": "1.7.9",
|
|
23
24
|
"define-zustand": "3.2.1",
|
|
24
25
|
"immer": "10.0.1",
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"react-dom": "18.3.1",
|
|
29
30
|
"react-router": "7.5.0",
|
|
30
31
|
"react-use": "17.5.0",
|
|
31
|
-
"
|
|
32
|
+
"tailwindcss": "4.1.4",
|
|
32
33
|
"type-fest": "4.33.0",
|
|
33
34
|
"zustand": "5.0.3"
|
|
34
35
|
},
|
|
@@ -40,10 +41,10 @@
|
|
|
40
41
|
"@rsbuild/core": "1.2.19",
|
|
41
42
|
"@rsbuild/plugin-eslint": "1.1.1",
|
|
42
43
|
"@rsbuild/plugin-react": "1.1.1",
|
|
43
|
-
"@rsbuild/plugin-styled-components": "1.2.1",
|
|
44
44
|
"@rsbuild/plugin-svgr": "1.0.7",
|
|
45
45
|
"@rsbuild/plugin-type-check": "1.2.1",
|
|
46
46
|
"@rsdoctor/rspack-plugin": "0.4.13",
|
|
47
|
+
"@tailwindcss/postcss": "4.1.4",
|
|
47
48
|
"@types/lodash-es": "4.17.12",
|
|
48
49
|
"@types/node": "18.16.0",
|
|
49
50
|
"@types/qs": "6.9.7",
|
|
@@ -63,7 +64,6 @@
|
|
|
63
64
|
"postcss": "8.4.35",
|
|
64
65
|
"postcss-import": "16.0.1",
|
|
65
66
|
"postcss-nesting": "12.0.3",
|
|
66
|
-
"postcss-styled-syntax": "0.6.4",
|
|
67
67
|
"prettier": "3.2.5",
|
|
68
68
|
"stylelint": "16.10.0",
|
|
69
69
|
"stylelint-config-standard": "36.0.1",
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return <StyledRoot>sdfs</StyledRoot>
|
|
11
|
-
}
|
|
1
|
+
import { useHomeData } from '@/shared/service'
|
|
2
|
+
|
|
3
|
+
export default function Home() {
|
|
4
|
+
const { data } = useHomeData()
|
|
5
|
+
|
|
6
|
+
console.log('data', data)
|
|
7
|
+
|
|
8
|
+
return <div className="tw:flex tw:items-center tw:justify-center">sdfs</div>
|
|
9
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
plugins: {
|
|
3
|
-
'postcss-import': {},
|
|
4
|
-
autoprefixer: {},
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: {
|
|
3
|
+
'postcss-import': {},
|
|
4
|
+
autoprefixer: {},
|
|
5
|
+
"@tailwindcss/postcss": {},
|
|
6
|
+
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {})
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineConfig, loadEnv } from '@rsbuild/core'
|
|
2
2
|
import { pluginReact } from '@rsbuild/plugin-react'
|
|
3
|
-
import { pluginStyledComponents } from '@rsbuild/plugin-styled-components'
|
|
4
3
|
import { pluginEslint } from '@rsbuild/plugin-eslint'
|
|
5
4
|
import StylelintWebpackPlugin from 'stylelint-webpack-plugin'
|
|
6
5
|
import { pluginTypeCheck } from '@rsbuild/plugin-type-check'
|
|
@@ -10,11 +9,12 @@ import { createChunks } from './scripts'
|
|
|
10
9
|
|
|
11
10
|
export default defineConfig(({ envMode, command }) => {
|
|
12
11
|
const { parsed: env } = loadEnv()
|
|
12
|
+
|
|
13
13
|
return {
|
|
14
14
|
html: {
|
|
15
15
|
template: './index.html',
|
|
16
16
|
title: 'Rsbuild + React + TS',
|
|
17
|
-
favicon: './shared/assets/react.
|
|
17
|
+
favicon: './shared/assets/react.svg'
|
|
18
18
|
},
|
|
19
19
|
source: {
|
|
20
20
|
entry: {
|
|
@@ -51,12 +51,6 @@ export default defineConfig(({ envMode, command }) => {
|
|
|
51
51
|
configType: 'flat'
|
|
52
52
|
}
|
|
53
53
|
}),
|
|
54
|
-
pluginStyledComponents({
|
|
55
|
-
ssr: false,
|
|
56
|
-
displayName: false,
|
|
57
|
-
fileName: false,
|
|
58
|
-
transpileTemplateLiterals: false
|
|
59
|
-
}),
|
|
60
54
|
pluginSvgr(),
|
|
61
55
|
pluginReact()
|
|
62
56
|
],
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useQuery, UndefinedInitialDataOptions } from '@tanstack/react-query'
|
|
2
2
|
import { HOME_DATA } from './api'
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export const useHomeData = (options?: UndefinedInitialDataOptions) => {
|
|
5
|
+
return useQuery({
|
|
6
|
+
...options,
|
|
7
|
+
queryKey: [HOME_DATA, ...(options?.queryKey || [])]
|
|
8
|
+
})
|
|
7
9
|
}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
3
|
+
import { request } from '@/shared/service'
|
|
4
4
|
|
|
5
|
+
const queryClient = new QueryClient({
|
|
6
|
+
defaultOptions: {
|
|
7
|
+
queries: {
|
|
8
|
+
queryFn: async ({ queryKey }) => {
|
|
9
|
+
const { data } = await request.get(queryKey[0] as string, {
|
|
10
|
+
params: queryKey[1]
|
|
11
|
+
})
|
|
12
|
+
return data
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
})
|
|
5
17
|
export interface propsType {
|
|
6
18
|
children: ReactNode
|
|
7
19
|
}
|
|
8
20
|
export const Root: FunctionComponent<propsType> = props => {
|
|
9
|
-
return <
|
|
21
|
+
return <QueryClientProvider client={queryClient}>{props.children}</QueryClientProvider>
|
|
10
22
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { useLayoutEffect } from 'react'
|
|
1
|
+
import { useLayoutEffect, Suspense } from 'react'
|
|
2
2
|
import { RouterProvider } from 'react-router/dom'
|
|
3
3
|
import { request } from '@/shared/service'
|
|
4
4
|
import { routerInstance } from '@/domain/router'
|
|
5
|
-
import { GlobalStyle } from '../app.styled'
|
|
6
5
|
import * as AppContext from './app-context'
|
|
7
6
|
|
|
8
7
|
export const Root = () => {
|
|
@@ -17,8 +16,9 @@ export const Root = () => {
|
|
|
17
16
|
|
|
18
17
|
return (
|
|
19
18
|
<AppContext.Root>
|
|
20
|
-
<
|
|
21
|
-
|
|
19
|
+
<Suspense fallback={<>loading...</>}>
|
|
20
|
+
<RouterProvider router={routerInstance} />
|
|
21
|
+
</Suspense>
|
|
22
22
|
</AppContext.Root>
|
|
23
23
|
)
|
|
24
24
|
}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"commit": "git add . && npm run cz"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
+
"@tanstack/react-query": "5.51.15",
|
|
21
22
|
"axios": "1.7.9",
|
|
22
23
|
"define-zustand": "3.2.1",
|
|
23
24
|
"immer": "10.0.1",
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"react-dom": "18.3.1",
|
|
28
29
|
"react-router": "7.5.0",
|
|
29
30
|
"react-use": "17.5.0",
|
|
30
|
-
"
|
|
31
|
+
"tailwindcss": "4.1.4",
|
|
31
32
|
"type-fest": "4.33.0",
|
|
32
33
|
"zustand": "5.0.3"
|
|
33
34
|
},
|
|
@@ -35,8 +36,10 @@
|
|
|
35
36
|
"@commitlint/cli": "17.6.1",
|
|
36
37
|
"@commitlint/config-conventional": "17.6.1",
|
|
37
38
|
"@commitlint/cz-commitlint": "17.5.0",
|
|
39
|
+
"@emotion/babel-plugin": "11.13.5",
|
|
38
40
|
"@eslint/js": "9.15.0",
|
|
39
41
|
"@faker-js/faker": "8.4.1",
|
|
42
|
+
"@tailwindcss/vite": "4.1.4",
|
|
40
43
|
"@types/lodash-es": "4.17.12",
|
|
41
44
|
"@types/node": "18.16.0",
|
|
42
45
|
"@types/qs": "6.9.7",
|
|
@@ -44,7 +47,6 @@
|
|
|
44
47
|
"@types/react-dom": "18.3.0",
|
|
45
48
|
"@vitejs/plugin-react": "4.3.4",
|
|
46
49
|
"autoprefixer": "10.4.14",
|
|
47
|
-
"babel-plugin-styled-components": "2.1.4",
|
|
48
50
|
"commitizen": "4.3.0",
|
|
49
51
|
"cssnano": "6.0.0",
|
|
50
52
|
"eslint": "9.17.0",
|
|
@@ -58,7 +60,6 @@
|
|
|
58
60
|
"postcss": "8.4.35",
|
|
59
61
|
"postcss-import": "16.0.1",
|
|
60
62
|
"postcss-nesting": "12.0.3",
|
|
61
|
-
"postcss-styled-syntax": "0.6.4",
|
|
62
63
|
"prettier": "3.2.5",
|
|
63
64
|
"rollup-plugin-visualizer": "5.12.0",
|
|
64
65
|
"stylelint": "16.10.0",
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return <StyledRoot>sdfs</StyledRoot>
|
|
11
|
-
}
|
|
1
|
+
import { useHomeData } from '@/shared/service'
|
|
2
|
+
|
|
3
|
+
export default function Home() {
|
|
4
|
+
const { data } = useHomeData()
|
|
5
|
+
|
|
6
|
+
console.log('data', data)
|
|
7
|
+
|
|
8
|
+
return <div className="tw:flex tw:items-center tw:justify-center">sdfs</div>
|
|
9
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useQuery, UndefinedInitialDataOptions } from '@tanstack/react-query'
|
|
2
2
|
import { HOME_DATA } from './api'
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export const useHomeData = (options?: UndefinedInitialDataOptions) => {
|
|
5
|
+
return useQuery({
|
|
6
|
+
...options,
|
|
7
|
+
queryKey: [HOME_DATA, ...(options?.queryKey || [])]
|
|
8
|
+
})
|
|
7
9
|
}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
2
|
/// <reference types="vite-plugin-svgr/client" />
|
|
3
|
-
import 'styled-components'
|
|
4
|
-
import { themeType } from './shared/theme'
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// 更多环境变量...
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface ImportMeta {
|
|
14
|
-
readonly env: ImportMetaEnv
|
|
15
|
-
}
|
|
4
|
+
interface ImportMetaEnv {
|
|
5
|
+
readonly VITE_BASE_URL: string
|
|
6
|
+
readonly VITE_API_HOST: string
|
|
7
|
+
// 更多环境变量...
|
|
16
8
|
}
|
|
17
9
|
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
interface ImportMeta {
|
|
11
|
+
readonly env: ImportMetaEnv
|
|
20
12
|
}
|
|
@@ -1,78 +1,80 @@
|
|
|
1
|
-
import { defineConfig, loadEnv } from 'vite'
|
|
2
|
-
import react from '@vitejs/plugin-react'
|
|
3
|
-
import svgr from 'vite-plugin-svgr'
|
|
4
|
-
import mockDevServer from 'vite-plugin-mock-dev-server'
|
|
5
|
-
import checker from 'vite-plugin-checker'
|
|
6
|
-
import { visualizer } from 'rollup-plugin-visualizer'
|
|
7
|
-
import { includes } from 'lodash-es'
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
1
|
+
import { defineConfig, loadEnv } from 'vite'
|
|
2
|
+
import react from '@vitejs/plugin-react'
|
|
3
|
+
import svgr from 'vite-plugin-svgr'
|
|
4
|
+
import mockDevServer from 'vite-plugin-mock-dev-server'
|
|
5
|
+
import checker from 'vite-plugin-checker'
|
|
6
|
+
import { visualizer } from 'rollup-plugin-visualizer'
|
|
7
|
+
import { includes } from 'lodash-es'
|
|
8
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
9
|
+
import { createChunks } from './scripts'
|
|
10
|
+
|
|
11
|
+
// https://vitejs.dev/config/
|
|
12
|
+
export default defineConfig(({ mode }) => {
|
|
13
|
+
const env = loadEnv(mode, process.cwd(), '')
|
|
14
|
+
const proxyBaseUrl = env.VITE_BASE_URL + env.VITE_API_HOST
|
|
15
|
+
const plugins: any[] = [
|
|
16
|
+
tailwindcss(),
|
|
17
|
+
svgr(),
|
|
18
|
+
mockDevServer({
|
|
19
|
+
include: ['**/*.mock.{ts,js}']
|
|
20
|
+
}),
|
|
21
|
+
checker({
|
|
22
|
+
enableBuild: false,
|
|
23
|
+
typescript: true,
|
|
24
|
+
eslint: { useFlatConfig: true, lintCommand: 'eslint', dev: { logLevel: ['error'] } }
|
|
25
|
+
}),
|
|
26
|
+
react({
|
|
27
|
+
babel: {
|
|
28
|
+
plugins: [
|
|
29
|
+
[
|
|
30
|
+
'babel-plugin-styled-components',
|
|
31
|
+
{
|
|
32
|
+
ssr: false,
|
|
33
|
+
displayName: false,
|
|
34
|
+
fileName: false,
|
|
35
|
+
transpileTemplateLiterals: false
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
if (mode === 'analyse') {
|
|
44
|
+
plugins.push(visualizer({ open: true, sourcemap: true, brotliSize: true, gzipSize: true }))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
base: env.VITE_BASE_URL,
|
|
49
|
+
plugins,
|
|
50
|
+
resolve: {
|
|
51
|
+
alias: {
|
|
52
|
+
'@': __dirname
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
esbuild: {
|
|
56
|
+
drop: includes(['production', 'analyse'], mode) ? ['console', 'debugger'] : []
|
|
57
|
+
},
|
|
58
|
+
build: {
|
|
59
|
+
sourcemap: mode === 'analyse',
|
|
60
|
+
reportCompressedSize: mode === 'analyse',
|
|
61
|
+
rollupOptions: {
|
|
62
|
+
output: {
|
|
63
|
+
manualChunks: createChunks({
|
|
64
|
+
react: ['react', 'react-dom']
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
server: {
|
|
70
|
+
host: '0.0.0.0',
|
|
71
|
+
proxy: {
|
|
72
|
+
[proxyBaseUrl]: {
|
|
73
|
+
target: 'http://127.0.0.1',
|
|
74
|
+
changeOrigin: true,
|
|
75
|
+
rewrite: path => path.replace(proxyBaseUrl, '')
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
})
|