create-bubbles 0.0.16 → 0.0.18

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bubbles",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "author": "bubbles plant",
6
6
  "bin": {
@@ -1,3 +1,5 @@
1
1
  # port
2
- PUBLIC_PORT = 9200
3
- PUBLIC_PATH = '/'
2
+ PUBLIC_PORT = 9945
3
+ PUBLIC_PATH = '/'
4
+ PUBLIC_APP_NAME = 'xxx'
5
+ PUBLIC_API_AFFIX = '/api'
@@ -0,0 +1 @@
1
+ PUBLIC_API_URL = 'http://localhost:8080'
@@ -0,0 +1 @@
1
+ PUBLIC_API_URL = 'http://localhost:8080'
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "editor.formatOnSave": true,
3
- "editor.defaultFormatter": "biomejs.biome",// 控制相关文件嵌套展示
3
+ "editor.defaultFormatter": "biomejs.biome", // 控制相关文件嵌套展示
4
4
  "explorer.fileNesting.enabled": true,
5
5
  "explorer.fileNesting.expand": false,
6
6
  "explorer.fileNesting.patterns": {
@@ -10,12 +10,5 @@
10
10
  "package.json": "pnpm-lock.yaml",
11
11
  ".prettierrc": ".prettierignore"
12
12
  },
13
- "cSpell.words": [
14
- "ahooks",
15
- "ianvs",
16
- "lefthook",
17
- "rsbuild",
18
- "unocss",
19
- "unplugin"
20
- ],
13
+ "cSpell.words": ["ahooks", "ianvs", "lefthook", "rsbuild", "rspack", "unocss", "unplugin"]
21
14
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "ignoreUnknown": true,
4
- "ignore": ["dist/*", "node_modules", "package.json", "auto-import.d.ts", "*.js", ".vscode/*"]
4
+ "ignore": ["dist/*", "node_modules", "package.json", "auto-import.d.ts", "*.js"]
5
5
  },
6
6
  "formatter": {
7
7
  "enabled": true,
@@ -28,6 +28,8 @@
28
28
  "@ianvs/prettier-plugin-sort-imports": "^4.4.1",
29
29
  "@rsbuild/core": "^1.3.6",
30
30
  "@rsbuild/plugin-react": "^1.2.0",
31
+ "@rsbuild/plugin-sass": "^1.3.1",
32
+ "@rsbuild/plugin-svgr": "^1.2.0",
31
33
  "@types/react": "^19.1.2",
32
34
  "@types/react-dom": "^19.1.2",
33
35
  "@unocss/postcss": "66.1.0-beta.11",
@@ -2,6 +2,8 @@ import { defineConfig } from '@rsbuild/core'
2
2
  import { pluginReact } from '@rsbuild/plugin-react'
3
3
  import AutoImport from 'unplugin-auto-import/rspack'
4
4
  import UnoCSS from '@unocss/postcss'
5
+ import { pluginSass } from '@rsbuild/plugin-sass'
6
+ import { pluginSvgr } from '@rsbuild/plugin-svgr'
5
7
 
6
8
  export default defineConfig({
7
9
  html: {
@@ -15,12 +17,20 @@ export default defineConfig({
15
17
  server: {
16
18
  port: Number(process.env.PUBLIC_PORT),
17
19
  },
18
- plugins: [pluginReact()],
20
+ plugins: [
21
+ pluginReact(),
22
+ pluginSass({
23
+ sassLoaderOptions: {
24
+ // additionalData: `@import "@/styles/variables.scss";`,
25
+ },
26
+ }),
27
+ pluginSvgr(),
28
+ ],
19
29
  tools: {
20
30
  rspack: {
21
31
  plugins: [
22
32
  AutoImport({
23
- imports: ['react', 'react-router', 'react-router-dom'],
33
+ imports: ['react', 'react-router'],
24
34
  dts: './src/types/auto-import.d.ts',
25
35
  }),
26
36
  ],
@@ -0,0 +1,7 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="32" height="32" rx="8" fill="white" fill-opacity="0.96"/>
3
+ <path d="M19.0579 9.09827L15.8082 11.0706L12.9421 9.09827L6 13.3109V21.7368L12.9421 25.9498L16.1918 24.2105L19.0579 25.9498L26 21.7368V13.3109L19.0579 9.09827ZM12.9421 24.705L7.02568 21.1148V13.9336L12.9421 10.3433L14.7822 11.6929L12.1157 13.3112V21.7371L15.1661 23.5882L12.9421 24.705ZM13.1417 20.0549H18.8586V21.3475L16.1918 22.9658L13.1417 21.1148V20.0549ZM13.1417 18.9765V16.5097H18.8586V18.9765H13.1417ZM18.8586 15.4312H13.1417V13.9336L15.8082 12.3153L18.8586 14.1663V15.4312ZM24.9743 21.1148L19.0579 24.705L17.2178 23.5882L19.8846 21.9699V13.544L16.8342 11.6929L19.0582 10.3433L24.9746 13.9336L24.9743 21.1148Z" fill="#146AE1"/>
4
+ <path d="M14.573 7.86376L13.3172 5.51634C13.3835 5.37271 13.4218 5.21177 13.4218 5.04137C13.4218 4.43853 12.9568 3.94971 12.3832 3.94971C11.8097 3.94971 11.3447 4.43853 11.3447 5.04137C11.3447 5.64421 11.7792 6.0987 12.326 6.1302L13.5704 8.45652C13.6759 8.65401 13.8713 8.76487 14.0723 8.76487C14.1676 8.76487 14.2647 8.73999 14.3537 8.68708C14.6306 8.5233 14.7289 8.15479 14.573 7.86376Z" fill="#FDC23A"/>
5
+ <path d="M17.4268 7.86376L18.6826 5.51634C18.6164 5.37271 18.5781 5.21177 18.5781 5.04137C18.5781 4.43853 19.0431 3.94971 19.6169 3.94971C20.1904 3.94971 20.6555 4.43853 20.6555 5.04137C20.6555 5.62405 20.221 6.0987 19.6742 6.1302L18.4297 8.45652C18.3243 8.65401 18.1289 8.76487 17.9278 8.76487C17.8325 8.76487 17.7355 8.73999 17.6465 8.68708C17.3696 8.5233 17.2713 8.15479 17.4271 7.86376H17.4268Z" fill="#FDC23A"/>
6
+ </svg>
7
+
@@ -1,20 +1,20 @@
1
- import React, { Suspense } from 'react';
2
- import ReactDOM from 'react-dom/client';
1
+ import React, { Suspense } from 'react'
2
+ import ReactDOM from 'react-dom/client'
3
3
 
4
- import App from './App';
4
+ import App from './App'
5
5
 
6
- import '@/styles/index.css';
6
+ import '@/styles/index.scss'
7
7
 
8
- import Loading from './components/Loading/PageLoading';
8
+ import Loading from './components/Loading/PageLoading'
9
9
 
10
- const rootEl = document.getElementById('root');
10
+ const rootEl = document.getElementById('root')
11
11
  if (rootEl) {
12
- const root = ReactDOM.createRoot(rootEl);
12
+ const root = ReactDOM.createRoot(rootEl)
13
13
  root.render(
14
14
  <React.StrictMode>
15
15
  <Suspense fallback={<Loading />}>
16
16
  <App />
17
17
  </Suspense>
18
18
  </React.StrictMode>,
19
- );
19
+ )
20
20
  }
@@ -0,0 +1,10 @@
1
+ import { Outlet } from 'react-router'
2
+ const Layout = () => {
3
+ return (
4
+ <div className="w-full">
5
+ <Outlet />
6
+ </div>
7
+ )
8
+ }
9
+
10
+ export default memo(Layout)
@@ -1,5 +1,5 @@
1
1
  const Home = () => {
2
- return <h1 className="text-red text-30px">111</h1>
2
+ return <h1 className="flex-center w-full h-full text-red abc-var(--menu-bg)">111</h1>
3
3
  }
4
4
 
5
5
  export default Home
@@ -1,27 +1,38 @@
1
- import { Suspense } from 'react';
2
- import { createBrowserRouter, type RouteObject } from 'react-router';
3
-
4
- import Loading from '@/components/Loading/PageLoading';
5
-
1
+ import { createBrowserRouter, Navigate, type RouteObject } from 'react-router'
2
+ import Layout from '@/layout/default'
3
+ import { envVariables } from '@/utils/env'
6
4
  export const lazyLoad = (path: string) => {
7
- const Module = lazy(() => import(`@/pages/${path}.tsx`));
8
- return (
9
- <Suspense fallback={<Loading />}>
10
- <Module />
11
- </Suspense>
12
- );
13
- };
5
+ const Module = lazy(() => import(`@/pages/${path}.tsx`))
6
+ return <Module />
7
+ }
14
8
 
15
- const routes: RouteObject[] = [
9
+ export const menuRoutes: RouteObject[] = [
16
10
  {
17
- path: '/',
11
+ path: 'home',
18
12
  id: 'home',
13
+ handle: { title: '首页' },
19
14
  element: lazyLoad('home/index'),
20
15
  },
21
- ];
16
+ ]
17
+
18
+ const routes: RouteObject[] = [
19
+ {
20
+ path: '/',
21
+ id: 'layout',
22
+ element: <Layout />,
23
+ children: [
24
+ {
25
+ path: '',
26
+ id: 'index',
27
+ element: <Navigate to={'/home'} />,
28
+ },
29
+ ...menuRoutes,
30
+ ],
31
+ },
32
+ ]
22
33
 
23
34
  export const router = createBrowserRouter(routes, {
24
- basename: import.meta.env.PUBLIC_PATH,
25
- });
35
+ basename: envVariables.PUBLIC_PATH,
36
+ })
26
37
 
27
- export default router;
38
+ export default router
@@ -0,0 +1,4 @@
1
+ @font-face {
2
+ font-family: 'Alimama ShuHeiTi';
3
+ src: url('@/assets/font/AlimamaShuHeiTi-Bold.ttf');
4
+ }
@@ -1,4 +1,6 @@
1
1
  @unocss;
2
+ @import "./variables.scss";
3
+ @import "./fonts.scss";
2
4
 
3
5
  html,
4
6
  body,
@@ -0,0 +1,4 @@
1
+ :root {
2
+ --header-height: 64px;
3
+ --menu-bg: linear-gradient(180deg, #2a2d3e 0%, #2a2d3e 100%);
4
+ }
@@ -6,12 +6,6 @@
6
6
  // biome-ignore lint: disable
7
7
  export {}
8
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
9
  const createRef: typeof import('react')['createRef']
16
10
  const forwardRef: typeof import('react')['forwardRef']
17
11
  const lazy: typeof import('react')['lazy']
@@ -22,25 +16,23 @@ declare global {
22
16
  const useDebugValue: typeof import('react')['useDebugValue']
23
17
  const useDeferredValue: typeof import('react')['useDeferredValue']
24
18
  const useEffect: typeof import('react')['useEffect']
25
- const useHref: typeof import('react-router-dom')['useHref']
19
+ const useHref: typeof import('react-router')['useHref']
26
20
  const useId: typeof import('react')['useId']
27
21
  const useImperativeHandle: typeof import('react')['useImperativeHandle']
28
- const useInRouterContext: typeof import('react-router-dom')['useInRouterContext']
22
+ const useInRouterContext: typeof import('react-router')['useInRouterContext']
29
23
  const useInsertionEffect: typeof import('react')['useInsertionEffect']
30
24
  const useLayoutEffect: typeof import('react')['useLayoutEffect']
31
- const useLinkClickHandler: typeof import('react-router-dom')['useLinkClickHandler']
32
- const useLocation: typeof import('react-router-dom')['useLocation']
25
+ const useLocation: typeof import('react-router')['useLocation']
33
26
  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']
27
+ const useNavigate: typeof import('react-router')['useNavigate']
28
+ const useNavigationType: typeof import('react-router')['useNavigationType']
29
+ const useOutlet: typeof import('react-router')['useOutlet']
30
+ const useOutletContext: typeof import('react-router')['useOutletContext']
31
+ const useParams: typeof import('react-router')['useParams']
39
32
  const useReducer: typeof import('react')['useReducer']
40
33
  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']
34
+ const useResolvedPath: typeof import('react-router')['useResolvedPath']
35
+ const useRoutes: typeof import('react-router')['useRoutes']
44
36
  const useState: typeof import('react')['useState']
45
37
  const useSyncExternalStore: typeof import('react')['useSyncExternalStore']
46
38
  const useTransition: typeof import('react')['useTransition']
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 通过一个文件导出所有的环境变量这样方便统一修改
3
+ * @returns
4
+ */
5
+ export const envVariables = {
6
+ PUBLIC_PORT: import.meta.env.PUBLIC_PORT,
7
+ PUBLIC_PATH: import.meta.env.PUBLIC_PATH,
8
+ PUBLIC_APP_NAME: import.meta.env.PUBLIC_APP_NAME,
9
+ PUBLIC_API_AFFIX: import.meta.env.PUBLIC_API_AFFIX,
10
+ }
@@ -1,5 +1,6 @@
1
1
  import { message } from 'antd'
2
2
  import axios, { type AxiosResponse } from 'axios'
3
+ import { envVariables } from '@/utils/env'
3
4
 
4
5
  import { router } from '@/router'
5
6
  import { useUserStore } from '@/store/modules/user'
@@ -24,7 +25,7 @@ export default (customConfig?: CustomConfig) => {
24
25
  const token = useUserStore((state) => state.token)
25
26
 
26
27
  const instance = axios.create({
27
- baseURL: import.meta.env.PUBLIC_API_AFFIX,
28
+ baseURL: envVariables.PUBLIC_API_AFFIX,
28
29
  })
29
30
 
30
31
  instance.interceptors.request.use(
@@ -19,11 +19,17 @@
19
19
  "noUnusedLocals": true,
20
20
  "noUnusedParameters": true,
21
21
 
22
- "baseUrl": "./",
22
+ "baseUrl": ".",
23
23
  "paths": {
24
24
  "@/*": ["src/*"]
25
25
  }
26
26
  },
27
- "include": ["src"],
28
- "exclude": ["node_modules", "dist"]
27
+ "include": [
28
+ "src/**/*.ts",
29
+ "src/**/*.d.ts",
30
+ "src/**/*.tsx",
31
+ "src/types/**/*.d.ts",
32
+ "src/types/**/*.ts"
33
+ ],
34
+ "exclude": ["node_modules", "dist", "**/*.js"]
29
35
  }
@@ -5,4 +5,6 @@ export default defineConfig({
5
5
  filesystem: ['**/*.{html,js,ts,jsx,tsx,vue,svelte,astro}'],
6
6
  },
7
7
  presets: [presetWind3()],
8
+ rules: [],
9
+ shortcuts: [['flex-center', 'flex items-center justify-center']],
8
10
  })