create-packer 1.47.2 → 1.48.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/package.json +79 -79
- package/template/web-extension/entrypoints/content/domain/app/tools/insertApp.tsx +1 -3
- package/template/web-extension/entrypoints/content/index.tsx +0 -1
- package/template/web-extension/entrypoints/content/modules/common/common.tsx +7 -1
- package/template/web-extension/entrypoints/content/modules/common/view.styled.ts +10 -0
- package/template/web-extension/entrypoints/popup/main.tsx +0 -1
- package/template/web-extension/entrypoints/popup/popup.styled.ts +5 -0
- package/template/web-extension/entrypoints/popup/popup.tsx +3 -1
- package/template/web-extension/package.json +2 -2
- package/template/web-extension/shared/components/app-context/view.tsx +8 -2
- package/template/web-extension/shared/styles/theme.ts +55 -0
- package/template/web-extension/vite-env.d.ts +15 -6
- package/template/web-extension/wxt.config.ts +18 -2
- package/template/web-extension/shared/styles/theme.css +0 -4
package/package.json
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-rsbuild",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"prepare": "husky",
|
|
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
|
-
"up:tailwind": "pnpm up tailwindcss @tailwindcss/* -L",
|
|
15
|
-
"format": "prettier --write \"**/*.{ts,js,tsx,jsx,json,css,scss,less}\"",
|
|
16
|
-
"lint": "tsc --noEmit && eslint --no-error-on-unmatched-pattern && stylelint **/*.{css,scss,less,ts,tsx}",
|
|
17
|
-
"lint:fix": "eslint --fix && stylelint **/*.{css,scss,less,ts,tsx} --fix",
|
|
18
|
-
"cz": "cz",
|
|
19
|
-
"push": "npm run commit && git push",
|
|
20
|
-
"commit": "git add . && npm run cz"
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@tanstack/react-query": "5.51.15",
|
|
24
|
-
"axios": "1.7.9",
|
|
25
|
-
"define-zustand": "3.4.0",
|
|
26
|
-
"es-toolkit": "1.43.0",
|
|
27
|
-
"immer": "10.0.1",
|
|
28
|
-
"qs": "6.11.2",
|
|
29
|
-
"react": "18.3.1",
|
|
30
|
-
"react-dom": "18.3.1",
|
|
31
|
-
"react-router": "7.5.0",
|
|
32
|
-
"react-use": "17.5.0",
|
|
33
|
-
"tailwindcss": "4.1.4",
|
|
34
|
-
"type-fest": "4.33.0",
|
|
35
|
-
"zustand": "5.0.3"
|
|
36
|
-
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@commitlint/cli": "17.6.1",
|
|
39
|
-
"@commitlint/config-conventional": "17.6.1",
|
|
40
|
-
"@commitlint/cz-commitlint": "17.5.0",
|
|
41
|
-
"@eslint/js": "9.15.0",
|
|
42
|
-
"@rsbuild/core": "1.6.15",
|
|
43
|
-
"@rsbuild/plugin-eslint": "1.2.0",
|
|
44
|
-
"@rsbuild/plugin-react": "1.4.2",
|
|
45
|
-
"@rsbuild/plugin-svgr": "1.2.3",
|
|
46
|
-
"@rsbuild/plugin-type-check": "1.3.2",
|
|
47
|
-
"@rsdoctor/rspack-plugin": "1.4.0",
|
|
48
|
-
"@tailwindcss/postcss": "4.1.4",
|
|
49
|
-
"@types/node": "18.16.0",
|
|
50
|
-
"@types/qs": "6.9.7",
|
|
51
|
-
"@types/react": "18.3.3",
|
|
52
|
-
"@types/react-dom": "18.3.0",
|
|
53
|
-
"autoprefixer": "10.4.14",
|
|
54
|
-
"commitizen": "4.3.0",
|
|
55
|
-
"cross-env": "7.0.3",
|
|
56
|
-
"cssnano": "6.0.0",
|
|
57
|
-
"eslint": "9.17.0",
|
|
58
|
-
"eslint-import-resolver-typescript": "3.7.0",
|
|
59
|
-
"eslint-plugin-import": "2.31.0",
|
|
60
|
-
"eslint-plugin-react": "7.37.2",
|
|
61
|
-
"eslint-plugin-react-hooks": "5.1.0",
|
|
62
|
-
"globals": "15.12.0",
|
|
63
|
-
"husky": "9.1.6",
|
|
64
|
-
"postcss": "8.4.35",
|
|
65
|
-
"postcss-import": "16.0.1",
|
|
66
|
-
"postcss-nesting": "12.0.3",
|
|
67
|
-
"postcss-styled-syntax": "0.6.4",
|
|
68
|
-
"prettier": "3.2.5",
|
|
69
|
-
"stylelint": "16.10.0",
|
|
70
|
-
"stylelint-config-standard": "36.0.1",
|
|
71
|
-
"stylelint-webpack-plugin": "5.0.0",
|
|
72
|
-
"typescript": "5.8.2"
|
|
73
|
-
},
|
|
74
|
-
"config": {
|
|
75
|
-
"commitizen": {
|
|
76
|
-
"path": "@commitlint/cz-commitlint"
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "react-rsbuild",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"prepare": "husky",
|
|
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
|
+
"up:tailwind": "pnpm up tailwindcss @tailwindcss/* -L",
|
|
15
|
+
"format": "prettier --write \"**/*.{ts,js,tsx,jsx,json,css,scss,less}\"",
|
|
16
|
+
"lint": "tsc --noEmit && eslint --no-error-on-unmatched-pattern && stylelint **/*.{css,scss,less,ts,tsx}",
|
|
17
|
+
"lint:fix": "eslint --fix && stylelint **/*.{css,scss,less,ts,tsx} --fix",
|
|
18
|
+
"cz": "cz",
|
|
19
|
+
"push": "npm run commit && git push",
|
|
20
|
+
"commit": "git add . && npm run cz"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@tanstack/react-query": "5.51.15",
|
|
24
|
+
"axios": "1.7.9",
|
|
25
|
+
"define-zustand": "3.4.0",
|
|
26
|
+
"es-toolkit": "1.43.0",
|
|
27
|
+
"immer": "10.0.1",
|
|
28
|
+
"qs": "6.11.2",
|
|
29
|
+
"react": "18.3.1",
|
|
30
|
+
"react-dom": "18.3.1",
|
|
31
|
+
"react-router": "7.5.0",
|
|
32
|
+
"react-use": "17.5.0",
|
|
33
|
+
"tailwindcss": "4.1.4",
|
|
34
|
+
"type-fest": "4.33.0",
|
|
35
|
+
"zustand": "5.0.3"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@commitlint/cli": "17.6.1",
|
|
39
|
+
"@commitlint/config-conventional": "17.6.1",
|
|
40
|
+
"@commitlint/cz-commitlint": "17.5.0",
|
|
41
|
+
"@eslint/js": "9.15.0",
|
|
42
|
+
"@rsbuild/core": "1.6.15",
|
|
43
|
+
"@rsbuild/plugin-eslint": "1.2.0",
|
|
44
|
+
"@rsbuild/plugin-react": "1.4.2",
|
|
45
|
+
"@rsbuild/plugin-svgr": "1.2.3",
|
|
46
|
+
"@rsbuild/plugin-type-check": "1.3.2",
|
|
47
|
+
"@rsdoctor/rspack-plugin": "1.4.0",
|
|
48
|
+
"@tailwindcss/postcss": "4.1.4",
|
|
49
|
+
"@types/node": "18.16.0",
|
|
50
|
+
"@types/qs": "6.9.7",
|
|
51
|
+
"@types/react": "18.3.3",
|
|
52
|
+
"@types/react-dom": "18.3.0",
|
|
53
|
+
"autoprefixer": "10.4.14",
|
|
54
|
+
"commitizen": "4.3.0",
|
|
55
|
+
"cross-env": "7.0.3",
|
|
56
|
+
"cssnano": "6.0.0",
|
|
57
|
+
"eslint": "9.17.0",
|
|
58
|
+
"eslint-import-resolver-typescript": "3.7.0",
|
|
59
|
+
"eslint-plugin-import": "2.31.0",
|
|
60
|
+
"eslint-plugin-react": "7.37.2",
|
|
61
|
+
"eslint-plugin-react-hooks": "5.1.0",
|
|
62
|
+
"globals": "15.12.0",
|
|
63
|
+
"husky": "9.1.6",
|
|
64
|
+
"postcss": "8.4.35",
|
|
65
|
+
"postcss-import": "16.0.1",
|
|
66
|
+
"postcss-nesting": "12.0.3",
|
|
67
|
+
"postcss-styled-syntax": "0.6.4",
|
|
68
|
+
"prettier": "3.2.5",
|
|
69
|
+
"stylelint": "16.10.0",
|
|
70
|
+
"stylelint-config-standard": "36.0.1",
|
|
71
|
+
"stylelint-webpack-plugin": "5.0.0",
|
|
72
|
+
"typescript": "5.8.2"
|
|
73
|
+
},
|
|
74
|
+
"config": {
|
|
75
|
+
"commitizen": {
|
|
76
|
+
"path": "@commitlint/cz-commitlint"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -50,9 +50,7 @@ export function insertApp<T extends HTMLElement>(
|
|
|
50
50
|
target.appendChild(result.rootEle)
|
|
51
51
|
}
|
|
52
52
|
const root = createRoot(result.rootEle)
|
|
53
|
-
root.render(
|
|
54
|
-
<AppContext.Root classNameSpace={classNameSpace}>{option.reactNode}</AppContext.Root>
|
|
55
|
-
)
|
|
53
|
+
root.render(<AppContext.Root>{option.reactNode}</AppContext.Root>)
|
|
56
54
|
result.result = true
|
|
57
55
|
return result
|
|
58
56
|
}
|
|
@@ -2,7 +2,6 @@ import { StrictMode } from 'react'
|
|
|
2
2
|
import { createRoot } from 'react-dom/client'
|
|
3
3
|
import { AppContext } from '@/shared/components'
|
|
4
4
|
import Popup from './popup'
|
|
5
|
-
import '@/shared/styles/theme.css'
|
|
6
5
|
|
|
7
6
|
createRoot(document.getElementById('root') as HTMLElement).render(
|
|
8
7
|
<StrictMode>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"qs": "6.11.2",
|
|
35
35
|
"react": "18.3.1",
|
|
36
36
|
"react-dom": "18.3.1",
|
|
37
|
-
"
|
|
37
|
+
"styled-components": "6.2.0",
|
|
38
38
|
"type-fest": "4.33.0",
|
|
39
39
|
"zustand": "5.0.3"
|
|
40
40
|
},
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"@commitlint/config-conventional": "17.6.1",
|
|
44
44
|
"@commitlint/cz-commitlint": "17.5.0",
|
|
45
45
|
"@eslint/js": "9.15.0",
|
|
46
|
-
"@tailwindcss/vite": "4.1.18",
|
|
47
46
|
"@types/chrome": "0.0.254",
|
|
48
47
|
"@types/node": "18.16.0",
|
|
49
48
|
"@types/qs": "6.9.7",
|
|
@@ -51,6 +50,7 @@
|
|
|
51
50
|
"@types/react-dom": "18.3.0",
|
|
52
51
|
"@vitejs/plugin-react": "5.1.2",
|
|
53
52
|
"autoprefixer": "10.4.14",
|
|
53
|
+
"babel-plugin-styled-components": "2.1.4",
|
|
54
54
|
"commitizen": "4.3.0",
|
|
55
55
|
"cssnano": "6.0.0",
|
|
56
56
|
"eslint": "9.17.0",
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react'
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
3
|
+
import { ThemeProvider } from 'styled-components'
|
|
4
|
+
import { createTheme } from '@/shared/styles/theme'
|
|
3
5
|
|
|
4
6
|
const queryClient = new QueryClient()
|
|
5
7
|
|
|
6
|
-
const AppContext: FunctionComponent<{ children: ReactNode
|
|
7
|
-
return
|
|
8
|
+
const AppContext: FunctionComponent<{ children: ReactNode }> = props => {
|
|
9
|
+
return (
|
|
10
|
+
<ThemeProvider theme={createTheme()}>
|
|
11
|
+
<QueryClientProvider client={queryClient}>{props.children}</QueryClientProvider>
|
|
12
|
+
</ThemeProvider>
|
|
13
|
+
)
|
|
8
14
|
}
|
|
9
15
|
|
|
10
16
|
export default AppContext
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { CSSProperties } from 'react'
|
|
2
|
+
import { isString } from 'es-toolkit'
|
|
3
|
+
import { isNumber } from 'es-toolkit/compat'
|
|
4
|
+
|
|
5
|
+
export function createTheme() {
|
|
6
|
+
return {
|
|
7
|
+
tools: {
|
|
8
|
+
ellipsis: () => ({
|
|
9
|
+
overflow: 'hidden',
|
|
10
|
+
textOverflow: 'ellipsis',
|
|
11
|
+
whiteSpace: 'nowrap'
|
|
12
|
+
}),
|
|
13
|
+
lineClamp: (n: number) => {
|
|
14
|
+
return {
|
|
15
|
+
WebkitLineClamp: `${n}`,
|
|
16
|
+
WebkitBoxOrient: 'vertical',
|
|
17
|
+
overflow: 'hidden',
|
|
18
|
+
display: '-webkit-box',
|
|
19
|
+
wordBreak: 'break-all'
|
|
20
|
+
} satisfies CSSProperties
|
|
21
|
+
},
|
|
22
|
+
size: (s: string) => ({ width: s, height: s }),
|
|
23
|
+
py: (s: string) => ({ paddingTop: s, paddingBottom: s }),
|
|
24
|
+
px: (s: string) => ({ paddingLeft: s, paddingRight: s }),
|
|
25
|
+
my: (s: string) => ({ marginTop: s, marginBottom: s }),
|
|
26
|
+
mx: (s: string) => ({ marginLeft: s, marginRight: s }),
|
|
27
|
+
flex: (
|
|
28
|
+
align: CSSProperties['alignItems'],
|
|
29
|
+
justify: CSSProperties['justifyContent'],
|
|
30
|
+
vertical?: boolean
|
|
31
|
+
) => {
|
|
32
|
+
return {
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: align,
|
|
35
|
+
justifyContent: justify,
|
|
36
|
+
flexDirection: vertical ? 'column' : 'row'
|
|
37
|
+
} satisfies CSSProperties
|
|
38
|
+
},
|
|
39
|
+
/** 数字为元素数量,字符串为对应css的值 */
|
|
40
|
+
grid: (
|
|
41
|
+
rows: number | CSSProperties['gridTemplateRows'],
|
|
42
|
+
cols: number | CSSProperties['gridTemplateColumns'],
|
|
43
|
+
gap?: number | string
|
|
44
|
+
) => {
|
|
45
|
+
return {
|
|
46
|
+
display: 'grid',
|
|
47
|
+
gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
|
|
48
|
+
gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
|
|
49
|
+
gap: isNumber(gap) ? `${gap}px` : gap
|
|
50
|
+
} satisfies CSSProperties
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export type themeType = ReturnType<typeof createTheme>
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
2
|
/// <reference types="./.wxt/wxt.d.ts" />
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import 'styled-components'
|
|
5
|
+
import { type themeType } from './shared/styles/theme'
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
interface ImportMetaEnv {
|
|
9
|
+
readonly VITE_BASE_URL: string
|
|
10
|
+
readonly VITE_API_HOST: string
|
|
11
|
+
// 更多环境变量...
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface ImportMeta {
|
|
15
|
+
readonly env: ImportMetaEnv
|
|
16
|
+
}
|
|
8
17
|
}
|
|
9
18
|
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
declare module 'styled-components' {
|
|
20
|
+
export interface DefaultTheme extends themeType {}
|
|
12
21
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineConfig, UserManifestFn } from 'wxt'
|
|
2
2
|
import react from '@vitejs/plugin-react'
|
|
3
3
|
import svgr from 'vite-plugin-svgr'
|
|
4
|
-
import tailwindcss from '@tailwindcss/vite'
|
|
5
4
|
import pkgJson from './package.json'
|
|
6
5
|
|
|
7
6
|
const manifest: UserManifestFn = () => {
|
|
@@ -30,7 +29,24 @@ export default defineConfig({
|
|
|
30
29
|
runner: { disabled: true },
|
|
31
30
|
imports: { eslintrc: { enabled: 9 } },
|
|
32
31
|
vite: ({ mode }) => ({
|
|
33
|
-
plugins: [
|
|
32
|
+
plugins: [
|
|
33
|
+
svgr(),
|
|
34
|
+
react({
|
|
35
|
+
babel: {
|
|
36
|
+
plugins: [
|
|
37
|
+
[
|
|
38
|
+
'babel-plugin-styled-components',
|
|
39
|
+
{
|
|
40
|
+
ssr: false,
|
|
41
|
+
displayName: false,
|
|
42
|
+
fileName: false,
|
|
43
|
+
transpileTemplateLiterals: false
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
] as any,
|
|
34
50
|
resolve: {
|
|
35
51
|
alias: {
|
|
36
52
|
'@': __dirname
|