@gx-design-vue/create-gx-cli 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +4 -2
- package/src/cli.js +23 -24
- package/src/main.js +86 -29
- package/{template-mobile-ts → template-design-pro}/.editorconfig +0 -0
- package/template-design-pro/.env +2 -0
- package/template-design-pro/.env.development +18 -0
- package/template-design-pro/.env.pro +32 -0
- package/template-design-pro/.env.production +32 -0
- package/template-design-pro/.env.test +20 -0
- package/{template-mobile-ts → template-design-pro}/.eslintignore +0 -0
- package/{template-mobile-ts → template-design-pro}/.eslintrc.js +0 -0
- package/template-design-pro/.gitpod.yml +6 -0
- package/template-design-pro/.husky/pre-commit +4 -0
- package/{template-mobile-ts → template-design-pro}/.prettierignore +0 -0
- package/{template-mobile-ts → template-design-pro}/.stylelintignore +0 -0
- package/template-design-pro/.yarnclean +48 -0
- package/template-design-pro/LICENSE +21 -0
- package/template-design-pro/README.md +111 -0
- package/template-design-pro/build/constant.ts +6 -0
- package/template-design-pro/build/generate/generateModifyVars.ts +18 -0
- package/template-design-pro/build/getConfigFileName.ts +13 -0
- package/template-design-pro/build/script/buildConf.ts +44 -0
- package/template-design-pro/build/script/postBuild.ts +25 -0
- package/template-design-pro/build/script/reSetRootHtml.ts +20 -0
- package/template-design-pro/build/utils.ts +85 -0
- package/template-design-pro/build/vite/cdn.ts +7 -0
- package/template-design-pro/build/vite/optimizer.ts +22 -0
- package/template-design-pro/build/vite/plugin/autoImport.ts +18 -0
- package/template-design-pro/build/vite/plugin/compress.ts +35 -0
- package/template-design-pro/build/vite/plugin/hmr.ts +25 -0
- package/template-design-pro/build/vite/plugin/html.ts +47 -0
- package/template-design-pro/build/vite/plugin/index.ts +89 -0
- package/template-design-pro/build/vite/plugin/mock.ts +20 -0
- package/template-design-pro/build/vite/plugin/pwa.ts +37 -0
- package/template-design-pro/build/vite/plugin/styleImport.ts +129 -0
- package/template-design-pro/build/vite/plugin/visualizer.ts +17 -0
- package/template-design-pro/build/vite/plugin/vite-plugin-antd-theme/index.ts +24 -0
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/createMockServer.ts +303 -0
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/createProdMockServer.ts +93 -0
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/index.ts +68 -0
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/types.ts +30 -0
- package/template-design-pro/build/vite/plugin/vite-plugin-mock/utils.ts +26 -0
- package/template-design-pro/commitlint.config.js +32 -0
- package/template-design-pro/config/config.ts +14 -0
- package/template-design-pro/config/default/animate.ts +30 -0
- package/template-design-pro/config/default/defaultSettings.ts +75 -0
- package/template-design-pro/config/default/network.ts +16 -0
- package/template-design-pro/config/default/proxy.ts +26 -0
- package/template-design-pro/config/default/theme.ts +43 -0
- package/template-design-pro/config/default/themeColor.ts +62 -0
- package/template-design-pro/index.html +45 -0
- package/template-design-pro/jest.config.mjs +36 -0
- package/template-design-pro/mock/_createProductionServer.ts +19 -0
- package/template-design-pro/mock/_util.ts +55 -0
- package/template-design-pro/mock/controller/menu.ts +85 -0
- package/template-design-pro/mock/controller/notices.ts +114 -0
- package/template-design-pro/mock/system/dict.ts +60 -0
- package/template-design-pro/mock/system/user.ts +218 -0
- package/template-design-pro/package.json +151 -0
- package/template-design-pro/pnpm-lock.yaml +9913 -0
- package/template-design-pro/postcss.config.js +5 -0
- package/{template-mobile-ts → template-design-pro}/prettier.config.js +0 -0
- package/template-design-pro/public/resource/css/index.css +171 -0
- package/{template-mobile-ts/public → template-design-pro/public/resource/img}/favicon.ico +0 -0
- package/template-design-pro/public/resource/img/logo.png +0 -0
- package/template-design-pro/public/resource/img/pro_icon.svg +5 -0
- package/template-design-pro/public/resource/img/pwa-192x192.png +0 -0
- package/template-design-pro/public/resource/img/pwa-512x512.png +0 -0
- package/template-design-pro/src/App.vue +47 -0
- package/template-design-pro/src/assets/error_images/403.png +0 -0
- package/template-design-pro/src/assets/error_images/404.png +0 -0
- package/template-design-pro/src/assets/error_images/cloud.png +0 -0
- package/template-design-pro/src/assets/login_images/login_background.svg +69 -0
- package/template-design-pro/src/assets/logo.png +0 -0
- package/template-design-pro/src/assets/menu_font/iconfont.css +94 -0
- package/template-design-pro/src/assets/menu_font/iconfont.eot +0 -0
- package/template-design-pro/src/assets/menu_font/iconfont.js +1 -0
- package/template-design-pro/src/assets/menu_font/iconfont.json +142 -0
- package/template-design-pro/src/assets/menu_font/iconfont.svg +57 -0
- package/template-design-pro/src/assets/menu_font/iconfont.ttf +0 -0
- package/template-design-pro/src/assets/menu_font/iconfont.woff +0 -0
- package/template-design-pro/src/assets/menu_font/iconfont.woff2 +0 -0
- package/template-design-pro/src/assets/menu_font/index.less +94 -0
- package/template-design-pro/src/common/global.ts +1 -0
- package/template-design-pro/src/components/GDesign/ProLayout/BasicLayout.less +80 -0
- package/template-design-pro/src/components/GDesign/ProLayout/BasicLayout.tsx +342 -0
- package/template-design-pro/src/components/GDesign/ProLayout/PageLoading.tsx +20 -0
- package/template-design-pro/src/components/GDesign/ProLayout/RenderTypings.ts +31 -0
- package/template-design-pro/src/components/GDesign/ProLayout/RouteContext.tsx +82 -0
- package/template-design-pro/src/components/GDesign/ProLayout/WrapContent.tsx +69 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalFooter/index.tsx +88 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/DefaultHeader.tsx +189 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/Header.less +8 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/index.tsx +105 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/props.ts +69 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/style.less +144 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/LogoContent/index.tsx +81 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/LogoContent/props.ts +29 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/MultiTab/index.tsx +384 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/MultiTab/props.ts +15 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/MultiTab/style.less +79 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/NoticeIcon.tsx +148 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/NoticeList.module.less +115 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/NoticeList.tsx +154 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/index.less +39 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/index.tsx +133 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/index.tsx +190 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/props.ts +48 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/style.less +128 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/typings.ts +0 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/AvatarDropdown.tsx +63 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/HeaderSearch.tsx +122 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/headerSearch.less +30 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/index.tsx +95 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/style.less +90 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/BlockCheckbox.tsx +70 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/LayoutSetting.tsx +107 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/ThemeColor.tsx +68 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/index.tsx +346 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/BaseMenu.tsx +224 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/SiderMenu.tsx +224 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/index.tsx +43 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/props.ts +112 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/style.less +262 -0
- package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/typings.ts +44 -0
- package/template-design-pro/src/components/GDesign/ProLayout/default.less +2 -0
- package/template-design-pro/src/components/GDesign/ProLayout/defaultSettings.ts +121 -0
- package/template-design-pro/src/components/GDesign/ProLayout/hooks/context/index.ts +45 -0
- package/template-design-pro/src/components/GDesign/ProLayout/index.ts +43 -0
- package/template-design-pro/src/components/GDesign/ProLayout/props.ts +57 -0
- package/template-design-pro/src/components/GDesign/ProLayout/style.less +272 -0
- package/template-design-pro/src/components/GDesign/ProLayout/typings.ts +1 -0
- package/template-design-pro/src/components/GDesign/ProLayout/utils/getMenuData.ts +31 -0
- package/template-design-pro/src/components/GDesign/ProLayout/utils/index.ts +94 -0
- package/template-design-pro/src/components/GDesign/ProLayout/utils/isImg/index.ts +6 -0
- package/template-design-pro/src/components/GDesign/ProLayout/utils/isUrl/index.ts +5 -0
- package/template-design-pro/src/components/GDesign/Result/index.tsx +142 -0
- package/template-design-pro/src/components/GDesign/Result/style.less +140 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/components/Bar/index.tsx +56 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/components/Bar/props.ts +23 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/components/Thumb/index.tsx +164 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/components/Thumb/props.ts +11 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/context.ts +10 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/index.tsx +200 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/props.ts +65 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/style.less +85 -0
- package/template-design-pro/src/components/GDesign/Scrollbars/util.ts +40 -0
- package/template-design-pro/src/components/GDesign/utils/index.ts +7 -0
- package/template-design-pro/src/components/PageLoading/index.tsx +44 -0
- package/template-design-pro/src/components/PageTransition/index.vue +98 -0
- package/template-design-pro/src/components/index.ts +6 -0
- package/template-design-pro/src/core/ant-design/index.ts +14 -0
- package/template-design-pro/src/core/gx-admin-design/index.ts +7 -0
- package/template-design-pro/src/core/gx-admin-directives/index.ts +8 -0
- package/template-design-pro/src/core/gx-admin-directives/permission.ts +28 -0
- package/template-design-pro/src/core/gx-design/index.ts +7 -0
- package/template-design-pro/src/core/gx-pro-design/index.ts +10 -0
- package/template-design-pro/src/core/index.ts +27 -0
- package/template-design-pro/src/design/ant-design/index.less +4 -0
- package/template-design-pro/src/design/ant-design/layout.less +29 -0
- package/template-design-pro/src/design/ant-design/menu.less +55 -0
- package/template-design-pro/src/design/ant-design/table.less +67 -0
- package/template-design-pro/src/design/ant-design/tooltip.less +13 -0
- package/template-design-pro/src/design/color.less +1 -0
- package/template-design-pro/src/design/config.less +5 -0
- package/template-design-pro/src/design/index.less +41 -0
- package/template-design-pro/src/design/mixin.less +66 -0
- package/template-design-pro/src/design/normalize.less +390 -0
- package/template-design-pro/src/global.less +15 -0
- package/template-design-pro/src/hooks/core/index.ts +3 -0
- package/template-design-pro/src/hooks/core/useRequest/index.ts +70 -0
- package/template-design-pro/src/hooks/core/useRequest/typings.ts +0 -0
- package/template-design-pro/src/hooks/event/index.ts +3 -0
- package/template-design-pro/src/hooks/event/useClipboard.ts +14 -0
- package/template-design-pro/src/hooks/system/index.ts +5 -0
- package/template-design-pro/src/hooks/system/useDict.ts +62 -0
- package/template-design-pro/src/hooks/system/usePermissions.ts +39 -0
- package/template-design-pro/src/hooks/typings.ts +17 -0
- package/template-design-pro/src/layout/BasicLayout.vue +104 -0
- package/template-design-pro/src/layout/BlankLayout.vue +5 -0
- package/template-design-pro/src/layout/ContentView.vue +76 -0
- package/template-design-pro/src/layout/IframeView.vue +1 -0
- package/template-design-pro/src/layout/UserLayout.vue +7 -0
- package/template-design-pro/src/main.ts +34 -0
- package/template-design-pro/src/plugins/index.ts +3 -0
- package/template-design-pro/src/router/guard/index.ts +84 -0
- package/template-design-pro/src/router/guard/permissions.ts +73 -0
- package/template-design-pro/src/router/guard/stateGuard.ts +11 -0
- package/template-design-pro/src/router/helper/routeHelper.ts +244 -0
- package/template-design-pro/src/router/helper/utils.ts +19 -0
- package/template-design-pro/src/router/index.ts +30 -0
- package/template-design-pro/src/router/routes/index.ts +85 -0
- package/template-design-pro/src/router/routes/modules/workplace.ts +19 -0
- package/template-design-pro/src/services/common/index.ts +11 -0
- package/template-design-pro/src/services/controller/router.ts +10 -0
- package/template-design-pro/src/services/controller/user.ts +35 -0
- package/template-design-pro/src/services/system/dictData.ts +10 -0
- package/template-design-pro/src/services/system/notices.ts +9 -0
- package/template-design-pro/src/store/index.ts +32 -0
- package/template-design-pro/src/store/modules/dict.ts +27 -0
- package/template-design-pro/src/store/modules/permission.ts +19 -0
- package/template-design-pro/src/store/modules/routes.ts +110 -0
- package/template-design-pro/src/store/modules/settings.ts +102 -0
- package/template-design-pro/src/store/modules/tabsRouter.ts +73 -0
- package/template-design-pro/src/store/modules/user.ts +153 -0
- package/template-design-pro/src/utils/accessToken.ts +93 -0
- package/{template-mobile-ts/src/utils/cryptoJS.ts → template-design-pro/src/utils/crypto.ts} +0 -0
- package/{template-mobile-ts → template-design-pro}/src/utils/env.ts +0 -0
- package/template-design-pro/src/utils/fetchFile.ts +79 -0
- package/template-design-pro/src/utils/index.ts +127 -0
- package/template-design-pro/src/utils/pageTitle.ts +17 -0
- package/template-design-pro/src/utils/request/XHR.ts +131 -0
- package/{template-mobile-ts → template-design-pro}/src/utils/request/axiosCancel.ts +0 -0
- package/template-design-pro/src/utils/request/checkStatus.ts +26 -0
- package/template-design-pro/src/utils/request/index.ts +145 -0
- package/template-design-pro/src/utils/request/typings.ts +114 -0
- package/template-design-pro/src/utils/storage.ts +194 -0
- package/template-design-pro/src/utils/uploadFile.ts +26 -0
- package/template-design-pro/src/utils/util.ts +278 -0
- package/template-design-pro/src/utils/validate.ts +221 -0
- package/template-design-pro/src/views/Iframe/index.vue +76 -0
- package/template-design-pro/src/views/MenuOne/index.vue +15 -0
- package/template-design-pro/src/views/MenuTwo/index.vue +13 -0
- package/template-design-pro/src/views/exception/403/index.vue +9 -0
- package/template-design-pro/src/views/exception/404/index.vue +9 -0
- package/template-design-pro/src/views/user/login/index.vue +110 -0
- package/template-design-pro/src/views/user/login/style.less +38 -0
- package/template-design-pro/stylelint.config.js +106 -0
- package/template-design-pro/tests/__mocks__/fileMock.ts +1 -0
- package/template-design-pro/tests/__mocks__/styleMock.ts +1 -0
- package/template-design-pro/tests/__mocks__/workerMock.ts +5 -0
- package/template-design-pro/tests/server/README.md +15 -0
- package/template-design-pro/tests/server/controller/FileController.ts +18 -0
- package/template-design-pro/tests/server/controller/UserController.ts +15 -0
- package/template-design-pro/tests/server/ecosystem.config.js +18 -0
- package/template-design-pro/tests/server/index.ts +63 -0
- package/template-design-pro/tests/server/nodemon.json +8 -0
- package/template-design-pro/tests/server/package.json +36 -0
- package/template-design-pro/tests/server/routes.ts +23 -0
- package/template-design-pro/tests/server/service/FileService.ts +54 -0
- package/template-design-pro/tests/server/service/UserService.ts +25 -0
- package/template-design-pro/tests/server/tsconfig.json +15 -0
- package/template-design-pro/tests/server/utils.ts +9 -0
- package/template-design-pro/tests/server/yarn.lock +2955 -0
- package/template-design-pro/tests/test.spec.ts +16 -0
- package/template-design-pro/tsconfig.json +47 -0
- package/{template-mobile-ts → template-design-pro}/types/auto-imports.d.ts +0 -0
- package/template-design-pro/types/config.d.ts +100 -0
- package/template-design-pro/types/global.d.ts +103 -0
- package/template-design-pro/types/gx-components.d.ts +24 -0
- package/template-design-pro/types/index.d.ts +13 -0
- package/template-design-pro/types/mock.d.ts +23 -0
- package/template-design-pro/types/module.d.ts +16 -0
- package/template-design-pro/types/response.d.ts +15 -0
- package/template-design-pro/types/route.d.ts +89 -0
- package/template-design-pro/vite.config.ts +136 -0
- package/template-design-pro/yarn.lock +9697 -0
- package/template-mobile-vant-cli/.editorconfig +19 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/.env.development +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/.env.pro +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/.env.production +0 -0
- package/template-mobile-vant-cli/.eslintignore +16 -0
- package/template-mobile-vant-cli/.eslintrc.js +64 -0
- package/template-mobile-vant-cli/.prettierignore +9 -0
- package/template-mobile-vant-cli/.stylelintignore +3 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/README.md +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/build/cdn.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/build/optimizer.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/build/plugin/autoImport.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/build/plugin/html.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/build/plugin/index.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/build/plugin/mock.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/build/script/postBuild.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/index.html +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/mock/_createProductionServer.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/mock/api/index.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/mock/utils.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/package.json +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/postcss.config.js +0 -0
- package/template-mobile-vant-cli/prettier.config.js +18 -0
- package/template-mobile-vant-cli/public/favicon.ico +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/public/js/flexible.js +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/App.vue +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/components/PageContainer/ProSkeleton.tsx +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/components/PageContainer/index.tsx +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/components/PageContainer/style.module.less +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/core/gx-design/index.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/core/index.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/core/vant-design/index.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/design/index.less +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/design/reset.less +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/design/root.less +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/design/vant.less +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/global.less +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/hooks/web/index.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/hooks/web/usePageLoading.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/layout/BasicLayout.vue +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/layout/basicLayout.less +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/main.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/pages/home.vue +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/router/index.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/router/routes.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/router/typings.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/services/index.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/settings/index.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/store/index.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/store/modules/global.ts +0 -0
- package/template-mobile-vant-cli/src/utils/cryptoJS.ts +39 -0
- package/template-mobile-vant-cli/src/utils/env.ts +52 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/utils/pageTitle.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/utils/request/XHR.ts +0 -0
- package/template-mobile-vant-cli/src/utils/request/axiosCancel.ts +60 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/utils/request/checkStatus.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/utils/request/index.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/utils/request/typings.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/utils/storage.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/utils/util.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/src/utils/validate.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/stylelint.config.js +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/tsconfig.json +0 -0
- package/template-mobile-vant-cli/types/auto-imports.d.ts +61 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/types/components.d.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/types/global.d.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/types/gx-components.d.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/types/module.d.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/types/response.d.ts +0 -0
- package/{template-mobile-ts → template-mobile-vant-cli}/vite.config.ts +0 -0
- package/template-mobile-vant-html/README.md +4 -0
- package/template-mobile-vant-html/css/global.css +293 -0
- package/template-mobile-vant-html/css/global.css.map +1 -0
- package/template-mobile-vant-html/css/global.less +293 -0
- package/template-mobile-vant-html/css/index.css +20 -0
- package/template-mobile-vant-html/css/index.css.map +1 -0
- package/template-mobile-vant-html/css/index.less +21 -0
- package/template-mobile-vant-html/image/disconnected.svg +60 -0
- package/template-mobile-vant-html/image/empty.svg +52 -0
- package/template-mobile-vant-html/image/error.svg +53 -0
- package/template-mobile-vant-html/image/loading.svg +1 -0
- package/template-mobile-vant-html/index.html +91 -0
- package/template-mobile-vant-html/js/index.js +29 -0
- package/template-mobile-vant-html/js/plugin/day.min.js +1 -0
- package/template-mobile-vant-html/js/plugin/fastclick.js +730 -0
- package/template-mobile-vant-html/js/plugin/jquery.min.js +2 -0
- package/template-mobile-vant-html/js/plugin/rem.js +28 -0
- package/template-mobile-vant-html/js/utils/appUtil.js +70 -0
- package/template-mobile-vant-html/js/utils/config.js +3 -0
- package/template-mobile-vant-html/js/utils/request.js +61 -0
- package/template-mobile-vant-html/js/utils/utils.js +65 -0
- package/template-mobile-vant-html/js/utils/validate.js +292 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
// import { mount } from '@vue/test-utils';
|
2
|
+
// import { Button } from '@/components/Button';
|
3
|
+
|
4
|
+
test('if jest is normal.', async () => {
|
5
|
+
expect('jest').toEqual('jest');
|
6
|
+
});
|
7
|
+
|
8
|
+
// TODO Vue component testing is not supported temporarily
|
9
|
+
// test('is a Vue instance.', async () => {
|
10
|
+
// const wrapper = mount(Button, {
|
11
|
+
// slots: {
|
12
|
+
// default: 'Button text',
|
13
|
+
// },
|
14
|
+
// });
|
15
|
+
// expect(wrapper.html()).toContain('Button text');
|
16
|
+
// });
|
@@ -0,0 +1,47 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"target": "esnext",
|
4
|
+
"module": "esnext",
|
5
|
+
"moduleResolution": "node",
|
6
|
+
"forceConsistentCasingInFileNames": true,
|
7
|
+
"allowSyntheticDefaultImports": true,
|
8
|
+
"strictFunctionTypes": false,
|
9
|
+
"jsx": "preserve",
|
10
|
+
"baseUrl": "./",
|
11
|
+
"allowJs": true,
|
12
|
+
"sourceMap": true,
|
13
|
+
"esModuleInterop": true,
|
14
|
+
"resolveJsonModule": true,
|
15
|
+
"noUnusedLocals": true,
|
16
|
+
"noUnusedParameters": true,
|
17
|
+
"experimentalDecorators": true,
|
18
|
+
"lib": ["dom", "esnext"],
|
19
|
+
"types": ["vite/client"],
|
20
|
+
"typeRoots": ["./node_modules/@types/", "./types"],
|
21
|
+
"noImplicitAny": false,
|
22
|
+
"skipLibCheck": true,
|
23
|
+
"paths": {
|
24
|
+
"@/*": ["src/*"],
|
25
|
+
"/types/*": ["types/*"],
|
26
|
+
"/config/*": ["config/*"],
|
27
|
+
"@gx-vuex": ["src/store/index.ts"],
|
28
|
+
"@gx-admin/hooks/*": ["src/hooks/*"],
|
29
|
+
"@gx-design/*": ["src/components/GDesign/*"]
|
30
|
+
}
|
31
|
+
},
|
32
|
+
"include": [
|
33
|
+
"tests/**/*.ts",
|
34
|
+
"src/**/*.ts",
|
35
|
+
"src/**/*.less",
|
36
|
+
"src/**/*.d.ts",
|
37
|
+
"src/**/*.tsx",
|
38
|
+
"src/**/*.vue",
|
39
|
+
"types/**/*.d.ts",
|
40
|
+
"types/**/*.ts",
|
41
|
+
"build/**/*.ts",
|
42
|
+
"build/**/*.d.ts",
|
43
|
+
"mock/**/*.ts",
|
44
|
+
"vite.config.ts"
|
45
|
+
],
|
46
|
+
"exclude": ["node_modules", "tests/server/**/*.ts", "dist", "**/*.js", ".history"]
|
47
|
+
}
|
File without changes
|
@@ -0,0 +1,100 @@
|
|
1
|
+
import { MenuTheme } from '@gx-pro/pro-layout'
|
2
|
+
|
3
|
+
export interface configSeting {
|
4
|
+
theme: themeConfig;
|
5
|
+
proxy: any;
|
6
|
+
network: networkConfig;
|
7
|
+
animate: animateConfig;
|
8
|
+
defaultSettings: settingConfig;
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface settingConfig {
|
12
|
+
publicPath: string;
|
13
|
+
outputDir: string;
|
14
|
+
assetsDir: string;
|
15
|
+
title: string;
|
16
|
+
shortName: string;
|
17
|
+
titleSeparator: string;
|
18
|
+
titleReverse: boolean;
|
19
|
+
waterMark: boolean;
|
20
|
+
waterMarkTitle: string;
|
21
|
+
viewScrollRoot: string;
|
22
|
+
useCdn: boolean;
|
23
|
+
useProxy: boolean;
|
24
|
+
proxyTarget: string;
|
25
|
+
requestPrefix?: string | object;
|
26
|
+
devPort: number;
|
27
|
+
copyright: string;
|
28
|
+
keepAliveMaxNum: number;
|
29
|
+
routerMode: string;
|
30
|
+
routerLoadTime: number;
|
31
|
+
routesWhiteList: Array<string>;
|
32
|
+
loadingText: string;
|
33
|
+
tokenName: string;
|
34
|
+
tokenTableName: string;
|
35
|
+
storage: string;
|
36
|
+
recordRoute: boolean;
|
37
|
+
logo: string;
|
38
|
+
loginInterception: boolean;
|
39
|
+
loginRSA: boolean;
|
40
|
+
authentication: string;
|
41
|
+
rolesControl: boolean;
|
42
|
+
uniqueOpened: boolean;
|
43
|
+
defaultOpeneds: Array<string>;
|
44
|
+
debounce: Array<string>;
|
45
|
+
}
|
46
|
+
|
47
|
+
export interface networkConfig {
|
48
|
+
contentType: string;
|
49
|
+
messageDuration: number;
|
50
|
+
requestTimeout: number;
|
51
|
+
successCode: (string | number)[];
|
52
|
+
}
|
53
|
+
|
54
|
+
export type Theme = 'dark' | 'light';
|
55
|
+
|
56
|
+
export type MenuTheme = Theme;
|
57
|
+
|
58
|
+
export interface themeConfig {
|
59
|
+
theme: MenuTheme | undefined;
|
60
|
+
primaryColor: string;
|
61
|
+
layout: 'side' | 'mix' | 'simple' | 'wide';
|
62
|
+
splitMenus: boolean;
|
63
|
+
fixedMultiTab: boolean;
|
64
|
+
fixedHeader: boolean;
|
65
|
+
fixSiderbar: boolean;
|
66
|
+
showProgressBar: boolean;
|
67
|
+
showTabsBar: boolean;
|
68
|
+
showFullScreen?: boolean;
|
69
|
+
headerHeight?: number;
|
70
|
+
wideWidth?: number;
|
71
|
+
autoHideHeader: boolean;
|
72
|
+
title: string;
|
73
|
+
iconfontUrl?: string;
|
74
|
+
animate?: {
|
75
|
+
disabled?: boolean;
|
76
|
+
name: string;
|
77
|
+
direction: string;
|
78
|
+
};
|
79
|
+
}
|
80
|
+
|
81
|
+
export interface customizeConfig {
|
82
|
+
donation: boolean;
|
83
|
+
templateFolder: string;
|
84
|
+
}
|
85
|
+
|
86
|
+
export interface animateConfig {
|
87
|
+
preset: Array<animatePreset>;
|
88
|
+
}
|
89
|
+
|
90
|
+
export interface animatePreset {
|
91
|
+
name: string;
|
92
|
+
alias: string;
|
93
|
+
directions: Array<any>;
|
94
|
+
}
|
95
|
+
|
96
|
+
export interface themeAnimateSeting {
|
97
|
+
name: string;
|
98
|
+
direction: string;
|
99
|
+
disabled?: boolean;
|
100
|
+
}
|
@@ -0,0 +1,103 @@
|
|
1
|
+
import type {
|
2
|
+
Slot,
|
3
|
+
VNode,
|
4
|
+
VNodeChild,
|
5
|
+
ComponentPublicInstance,
|
6
|
+
FunctionalComponent,
|
7
|
+
PropType as VuePropType
|
8
|
+
} from 'vue'
|
9
|
+
import type { ProColumnType as GProColumnType } from '@gx-design-vue/pro-table'
|
10
|
+
|
11
|
+
declare global {
|
12
|
+
const __APP_INFO__: {
|
13
|
+
pkg: {
|
14
|
+
name: string;
|
15
|
+
version: string;
|
16
|
+
dependencies: Recordable<string>;
|
17
|
+
devDependencies: Recordable<string>;
|
18
|
+
};
|
19
|
+
lastBuildTime: string;
|
20
|
+
}
|
21
|
+
|
22
|
+
declare type LocalResult = {
|
23
|
+
value: any;
|
24
|
+
time: string;
|
25
|
+
expired: number;
|
26
|
+
}
|
27
|
+
|
28
|
+
declare type ProColumnType = GProColumnType
|
29
|
+
|
30
|
+
// vue
|
31
|
+
declare type Key = string | number;
|
32
|
+
declare type PropType<T> = VuePropType<T>;
|
33
|
+
declare type VueNode = VNodeChild | JSX.Element;
|
34
|
+
|
35
|
+
declare type WithFalse<T> = T | false;
|
36
|
+
|
37
|
+
declare type RecordType = Record<string, any>;
|
38
|
+
|
39
|
+
declare type CustomRender =
|
40
|
+
| Slot
|
41
|
+
| VNodeChild
|
42
|
+
| VNode
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
44
|
+
| ((...props: any[]) => Slot)
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
46
|
+
| ((...props: any[]) => VNode)
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
48
|
+
| ((...args: any[]) => VNode)
|
49
|
+
| VNode[]
|
50
|
+
| JSX.Element
|
51
|
+
| string
|
52
|
+
| null
|
53
|
+
| undefined
|
54
|
+
|
55
|
+
declare type Nullable<T> = T | null;
|
56
|
+
declare type Recordable<T = any> = Record<string, T>;
|
57
|
+
declare type ReadonlyRecordable<T = any> = {
|
58
|
+
readonly [key: string]: T;
|
59
|
+
};
|
60
|
+
declare type TimeoutHandle = ReturnType<typeof setTimeout>;
|
61
|
+
declare interface ViteEnv {
|
62
|
+
VITE_PORT: number;
|
63
|
+
VITE_USE_MODE: string;
|
64
|
+
VITE_USE_THEME: boolean;
|
65
|
+
VITE_USE_MOCK: boolean;
|
66
|
+
VITE_NODE_ENV: string;
|
67
|
+
VITE_USE_PWA: boolean;
|
68
|
+
VITE_BASE_URL: string;
|
69
|
+
VITE_APP_ENV: string;
|
70
|
+
VUE_APP_VERSION: string;
|
71
|
+
VUE_APP_AUTHOR: any;
|
72
|
+
VITE_OSS_BUCKET: string;
|
73
|
+
VITE_OSS_ORIGIN: string;
|
74
|
+
VITE_PROXY: [ string, string ][];
|
75
|
+
VITE_USE_CDN: boolean;
|
76
|
+
VITE_DROP_CONSOLE: boolean;
|
77
|
+
VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
|
78
|
+
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
|
79
|
+
VITE_LEGACY: boolean;
|
80
|
+
VITE_GENERATE_UI: string;
|
81
|
+
}
|
82
|
+
|
83
|
+
declare type ViteEnvKey = keyof ViteEnv
|
84
|
+
|
85
|
+
declare function parseInt(s: string | number, radix?: number): number;
|
86
|
+
|
87
|
+
declare function parseFloat(string: string | number): number;
|
88
|
+
|
89
|
+
namespace JSX {
|
90
|
+
type Element = VNode;
|
91
|
+
|
92
|
+
interface IntrinsicAttributes {
|
93
|
+
[elem: string]: any;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
declare module 'vue' {
|
99
|
+
export type JSXComponent<Props = any> =
|
100
|
+
| { new(): ComponentPublicInstance<Props> }
|
101
|
+
| FunctionalComponent<Props>;
|
102
|
+
}
|
103
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
// generated by unplugin-vue-components
|
2
|
+
// We suggest you to commit this file into source control
|
3
|
+
// Read more: https://github.com/vuejs/vue-next/pull/3399
|
4
|
+
import '@vue/runtime-core'
|
5
|
+
|
6
|
+
export {}
|
7
|
+
|
8
|
+
declare module '@vue/runtime-core' {
|
9
|
+
export interface GlobalComponents {
|
10
|
+
GBars: typeof import('./../src/components/GDesign/Scrollbars')['default']
|
11
|
+
GProModal: typeof import('./../src/components/GDesign/ProModal')['default']
|
12
|
+
GUpload: typeof import('./../src/components/GDesign/Upload')['default']
|
13
|
+
GProPageContainer: typeof import('./../src/components/GDesign/ProLayout/components/PageContainer')['default']
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
declare global {
|
18
|
+
const GProCard: typeof import('@gx-design-vue/pro-card')['GProCard']
|
19
|
+
const GProForm: typeof import('@gx-design-vue/pro-form')['GProForm']
|
20
|
+
const GProTable: typeof import('@gx-design-vue/pro-table')['GProTable']
|
21
|
+
const GPorWaterMark: typeof import('@gx-design-vue/pro-watermark')['GPorWaterMark']
|
22
|
+
}
|
23
|
+
|
24
|
+
export { }
|
@@ -0,0 +1,13 @@
|
|
1
|
+
declare interface Fn<T = any, R = T> {
|
2
|
+
(...arg: T[]): R;
|
3
|
+
}
|
4
|
+
|
5
|
+
declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
|
6
|
+
$el: T;
|
7
|
+
}
|
8
|
+
|
9
|
+
declare type EmitType = (event: string, ...args: any[]) => void;
|
10
|
+
|
11
|
+
declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;
|
12
|
+
|
13
|
+
declare type ComponentRef<T extends HTMLElement = HTMLDivElement> = ComponentElRef<T> | null;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'http'
|
2
|
+
|
3
|
+
declare type MethodType = 'get' | 'post' | 'put' | 'delete' | 'patch'
|
4
|
+
|
5
|
+
declare interface RespThisType {
|
6
|
+
req: IncomingMessage
|
7
|
+
res: ServerResponse
|
8
|
+
parseJson: () => any
|
9
|
+
}
|
10
|
+
|
11
|
+
declare interface MockMethod {
|
12
|
+
url: string
|
13
|
+
method?: MethodType
|
14
|
+
timeout?: number
|
15
|
+
statusCode?: number
|
16
|
+
response?:
|
17
|
+
| ((
|
18
|
+
this: RespThisType,
|
19
|
+
opt: { url: Recordable; body: Recordable; query: Recordable; headers: Recordable },
|
20
|
+
) => any)
|
21
|
+
| any
|
22
|
+
rawResponse?: (this: RespThisType, req: IncomingMessage, res: ServerResponse) => void
|
23
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
declare module '*.vue' {
|
2
|
+
import { DefineComponent } from 'vue';
|
3
|
+
const Component: DefineComponent<{}, {}, any>;
|
4
|
+
export default Component;
|
5
|
+
}
|
6
|
+
|
7
|
+
declare module 'ant-design-vue/es/locale/*' {
|
8
|
+
import { Locale } from 'ant-design-vue/types/locale-provider';
|
9
|
+
const locale: Locale & ReadonlyRecordable;
|
10
|
+
export default locale as Locale & ReadonlyRecordable;
|
11
|
+
}
|
12
|
+
|
13
|
+
declare module 'virtual:*' {
|
14
|
+
const result: any;
|
15
|
+
export default result;
|
16
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
declare interface ResponseResult<T = any> extends TableResult<T> {
|
2
|
+
code: number;
|
3
|
+
msg?: string;
|
4
|
+
message?: string;
|
5
|
+
data?: T;
|
6
|
+
roles?: any;
|
7
|
+
user?: any;
|
8
|
+
permissions?: any;
|
9
|
+
}
|
10
|
+
|
11
|
+
declare interface TableResult<T = any> {
|
12
|
+
total?: number;
|
13
|
+
pageNum?: number;
|
14
|
+
rows?: T;
|
15
|
+
}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
import { defineComponent } from 'vue'
|
2
|
+
import { RouteRecordRaw } from 'vue-router'
|
3
|
+
|
4
|
+
export type Component<T extends any = any> =
|
5
|
+
| ReturnType<typeof defineComponent>
|
6
|
+
| (() => Promise<typeof import('*.vue')>)
|
7
|
+
| (() => Promise<T>);
|
8
|
+
|
9
|
+
declare global {
|
10
|
+
type AppRouteModule = {
|
11
|
+
meta?: Meta;
|
12
|
+
linkPath?: string;
|
13
|
+
children?: AppRouteModule[];
|
14
|
+
hidden?: boolean;
|
15
|
+
component?: Component;
|
16
|
+
} & Omit<RouteRecordRaw, 'meta' | 'children'>
|
17
|
+
|
18
|
+
interface MenuDataItem extends MenuMeta {
|
19
|
+
id?: number;
|
20
|
+
menuId?: number;
|
21
|
+
parentId?: number;
|
22
|
+
createTime?: string;
|
23
|
+
menuType?: 'M' | 'C' | null;
|
24
|
+
orderNum?: string;
|
25
|
+
name?: string;
|
26
|
+
path?: string;
|
27
|
+
target?: string;
|
28
|
+
linkPath?: string;
|
29
|
+
key?: string;
|
30
|
+
redirect?: string;
|
31
|
+
component?: string;
|
32
|
+
hidden?: boolean;
|
33
|
+
meta?: MenuMeta;
|
34
|
+
children?: MenuDataItem[];
|
35
|
+
}
|
36
|
+
|
37
|
+
interface MenuMeta {
|
38
|
+
// 名称
|
39
|
+
title?: string;
|
40
|
+
// 是否外链 0:是 1:否
|
41
|
+
isFrame?: '0' | '1';
|
42
|
+
// 菜单类型 M:目录 C:菜单
|
43
|
+
menuType?: 'M' | 'C' | null;
|
44
|
+
// 主页
|
45
|
+
homePageFlag?: 1 | 0;
|
46
|
+
// 菜单图标
|
47
|
+
icon?: string;
|
48
|
+
// 菜单图标类型
|
49
|
+
iconType?: 0 | 1 | 2;
|
50
|
+
// //外链类型(选择是系统内则以iframe形式在系统内部展示,否则跳转新页面打开) 0:系统内 1:系统外
|
51
|
+
outLinkType?: 0 | 1;
|
52
|
+
// 标签栏显示状态(隐藏的路由是否显示在标签栏中(只有标签栏为显示转态才生效))0:显示 1:隐藏
|
53
|
+
tagHidden?: '0' | '1';
|
54
|
+
// 标签栏固定状态(标签栏路由地址是否固定(只有标签栏为显示转态才生效))0:是 1:否
|
55
|
+
tagFixed?: '0' | '1';
|
56
|
+
// 是否缓存
|
57
|
+
keepAlive?: boolean;
|
58
|
+
}
|
59
|
+
|
60
|
+
interface Meta {
|
61
|
+
// 名称
|
62
|
+
title?: string;
|
63
|
+
// 主页
|
64
|
+
homePage?: 1 | 0;
|
65
|
+
// 菜单图标
|
66
|
+
icon?: string;
|
67
|
+
// 菜单图标类型
|
68
|
+
iconType?: number;
|
69
|
+
//隐藏
|
70
|
+
hidden?: boolean;
|
71
|
+
// 菜单隐藏
|
72
|
+
hideInMenu?: boolean;
|
73
|
+
// 菜单以及children隐藏
|
74
|
+
hideChildrenInMenu?: boolean;
|
75
|
+
//外链类型(选择是系统内则以iframe形式在系统内部展示,否则跳转新页面打开) 0:系统内 1:系统外
|
76
|
+
targetStatus?: number;
|
77
|
+
// 外链地址
|
78
|
+
target?: string;
|
79
|
+
// 标签栏显示状态(隐藏的路由是否显示在标签栏中(只有标签栏为显示转态才生效))
|
80
|
+
tagHidden?: boolean;
|
81
|
+
// 标签栏固定状态(标签栏路由地址是否固定(只有标签栏为显示转态才生效))
|
82
|
+
tagFixed?: boolean;
|
83
|
+
type?: string;
|
84
|
+
disabled?: boolean;
|
85
|
+
danger?: boolean;
|
86
|
+
// 是否缓存
|
87
|
+
keepAlive?: boolean;
|
88
|
+
}
|
89
|
+
}
|
@@ -0,0 +1,136 @@
|
|
1
|
+
import type { UserConfig, ConfigEnv } from 'vite'
|
2
|
+
import { loadEnv } from 'vite'
|
3
|
+
import { resolve } from 'path'
|
4
|
+
import dayjs from 'dayjs'
|
5
|
+
import externalGlobals from 'rollup-plugin-external-globals'
|
6
|
+
import { generateModifyVars } from './build/generate/generateModifyVars'
|
7
|
+
import { wrapperEnv } from './build/utils'
|
8
|
+
import { createVitePlugins } from './build/vite/plugin'
|
9
|
+
import { configManualChunk } from './build/vite/optimizer'
|
10
|
+
import config, { createProxy } from './config/config'
|
11
|
+
|
12
|
+
import pkg from './package.json'
|
13
|
+
|
14
|
+
function pathResolve(dir: string) {
|
15
|
+
return resolve(process.cwd(), '.', dir)
|
16
|
+
}
|
17
|
+
|
18
|
+
const { publicPath, outputDir, assetsDir, devPort, useCdn, useProxy } = config.defaultSettings
|
19
|
+
|
20
|
+
const { dependencies, devDependencies, name, version } = pkg
|
21
|
+
|
22
|
+
const __APP_INFO__ = {
|
23
|
+
pkg: { dependencies, devDependencies, name, version },
|
24
|
+
lastBuildTime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
25
|
+
}
|
26
|
+
|
27
|
+
process.env.VUE_APP_VERSION = version
|
28
|
+
|
29
|
+
export default ({ command, mode }: ConfigEnv): UserConfig => {
|
30
|
+
|
31
|
+
const root = process.cwd()
|
32
|
+
|
33
|
+
const env = loadEnv(mode, root)
|
34
|
+
|
35
|
+
// The boolean type read by loadEnv is a string. This function can be converted to boolean type
|
36
|
+
const viteEnv = wrapperEnv(env)
|
37
|
+
|
38
|
+
const { VITE_DROP_CONSOLE, VITE_APP_ENV, VITE_BASE_URL } = viteEnv
|
39
|
+
|
40
|
+
const isBuild = command === 'build'
|
41
|
+
|
42
|
+
return {
|
43
|
+
base: publicPath,
|
44
|
+
root,
|
45
|
+
resolve: {
|
46
|
+
alias: [
|
47
|
+
{
|
48
|
+
find: '@',
|
49
|
+
replacement: pathResolve('src') + '/'
|
50
|
+
},
|
51
|
+
{
|
52
|
+
find: /\/types\//,
|
53
|
+
replacement: pathResolve('types') + '/'
|
54
|
+
},
|
55
|
+
{
|
56
|
+
find: /\/config\//,
|
57
|
+
replacement: pathResolve('config') + '/'
|
58
|
+
},
|
59
|
+
{
|
60
|
+
find: '@gx-vuex',
|
61
|
+
replacement: pathResolve('src/store') + '/index.ts'
|
62
|
+
},
|
63
|
+
{
|
64
|
+
find: '@gx-design',
|
65
|
+
replacement: pathResolve('src/components/GDesign') + '/'
|
66
|
+
},
|
67
|
+
{
|
68
|
+
find: '@gx-admin/hooks',
|
69
|
+
replacement: pathResolve('src/hooks') + '/'
|
70
|
+
}
|
71
|
+
]
|
72
|
+
},
|
73
|
+
server: {
|
74
|
+
open: true,
|
75
|
+
host: true,
|
76
|
+
port: devPort,
|
77
|
+
proxy: useProxy ? createProxy(VITE_BASE_URL)[VITE_APP_ENV] : {}
|
78
|
+
},
|
79
|
+
esbuild: {
|
80
|
+
drop: VITE_DROP_CONSOLE ? ['console', 'debugger'] : [],
|
81
|
+
},
|
82
|
+
build: {
|
83
|
+
outDir: outputDir,
|
84
|
+
assetsDir,
|
85
|
+
target: 'es2015',
|
86
|
+
cssTarget: 'chrome80',
|
87
|
+
reportCompressedSize: false,
|
88
|
+
chunkSizeWarningLimit: 2500,
|
89
|
+
commonjsOptions: {
|
90
|
+
ignoreTryCatch: false
|
91
|
+
},
|
92
|
+
rollupOptions: useCdn
|
93
|
+
? {
|
94
|
+
output: {
|
95
|
+
manualChunks: configManualChunk
|
96
|
+
},
|
97
|
+
external: [ 'echarts' ],
|
98
|
+
plugins: [
|
99
|
+
externalGlobals({
|
100
|
+
echarts: 'echarts'
|
101
|
+
})
|
102
|
+
]
|
103
|
+
} : {
|
104
|
+
output: {
|
105
|
+
manualChunks: configManualChunk
|
106
|
+
}
|
107
|
+
}
|
108
|
+
},
|
109
|
+
define: {
|
110
|
+
__INTLIFY_PROD_DEVTOOLS__: false,
|
111
|
+
__APP_INFO__: JSON.stringify(__APP_INFO__)
|
112
|
+
},
|
113
|
+
css: {
|
114
|
+
modules: {
|
115
|
+
generateScopedName: 'gx-pro-[local]-[hash:base64:5]'
|
116
|
+
},
|
117
|
+
preprocessorOptions: {
|
118
|
+
less: {
|
119
|
+
modifyVars: generateModifyVars(viteEnv),
|
120
|
+
javascriptEnabled: true
|
121
|
+
}
|
122
|
+
}
|
123
|
+
},
|
124
|
+
|
125
|
+
plugins: createVitePlugins(viteEnv, isBuild),
|
126
|
+
|
127
|
+
optimizeDeps: {
|
128
|
+
include: [
|
129
|
+
'@vue/runtime-core',
|
130
|
+
'@vue/shared',
|
131
|
+
'ant-design-vue/es/locale/zh_CN',
|
132
|
+
'ant-design-vue/es/locale/en_US'
|
133
|
+
]
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|