@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
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gx-design-vue/create-gx-cli",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.5",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "a cli to bootstrap gx project",
|
6
6
|
"main": "src/index.js",
|
@@ -9,7 +9,7 @@
|
|
9
9
|
"access": "public"
|
10
10
|
},
|
11
11
|
"keywords": [
|
12
|
-
"gx-cli",
|
12
|
+
"create-gx-cli",
|
13
13
|
"create-project"
|
14
14
|
],
|
15
15
|
"author": "gx12358",
|
@@ -20,7 +20,9 @@
|
|
20
20
|
"kolorist": "^1.6.0",
|
21
21
|
"listr": "^0.14.3",
|
22
22
|
"minimist": "^1.2.7",
|
23
|
+
"nanospinner": "^1.1.0",
|
23
24
|
"ncp": "^2.0.0",
|
25
|
+
"obtain-git-repo": "^1.0.2",
|
24
26
|
"prompts": "^2.4.2"
|
25
27
|
},
|
26
28
|
"files": [
|
package/src/cli.js
CHANGED
@@ -1,28 +1,32 @@
|
|
1
|
-
import fs from 'fs'
|
2
|
-
import path from 'path'
|
3
1
|
import minimist from 'minimist'
|
4
2
|
import prompts from 'prompts'
|
5
|
-
import { yellow, reset } from 'kolorist'
|
3
|
+
import { yellow, reset, blue, red, green } from 'kolorist'
|
6
4
|
import { createProject } from './main'
|
7
5
|
|
8
6
|
const defaultTargetDir = 'gx-cli-project'
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
const FRAMEWORKS = [
|
9
|
+
{
|
10
|
+
name: 'gx-design-pro',
|
11
|
+
color: red
|
12
|
+
},
|
13
|
+
{
|
14
|
+
name: 'design-pro',
|
15
|
+
color: blue
|
16
|
+
},
|
17
|
+
{
|
18
|
+
name: 'mobile-vant-cli',
|
19
|
+
color: yellow
|
20
|
+
},
|
21
|
+
{
|
22
|
+
name: 'mobile-vant-html',
|
23
|
+
color: green
|
18
24
|
}
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
})
|
25
|
-
}
|
25
|
+
]
|
26
|
+
|
27
|
+
const TEMPLATES = FRAMEWORKS.map(
|
28
|
+
(f) => (f.variants && f.variants.map((v) => v.name)) || [f.name]
|
29
|
+
).reduce((a, b) => a.concat(b), [])
|
26
30
|
|
27
31
|
function formatTargetDir(targetDir) {
|
28
32
|
return targetDir ? targetDir.trim().replace(/\/+$/g, '') : ''
|
@@ -39,11 +43,6 @@ function parseArgumentsIntoOptions() {
|
|
39
43
|
}
|
40
44
|
|
41
45
|
async function promptForMissingOptions(options) {
|
42
|
-
const FRAMEWORKS = getTemplate()
|
43
|
-
|
44
|
-
const TEMPLATES = FRAMEWORKS.map(
|
45
|
-
(f) => (f.variants && f.variants.map((v) => v.name)) || [f.name]
|
46
|
-
).reduce((a, b) => a.concat(b), [])
|
47
46
|
const answers = await prompts([
|
48
47
|
{
|
49
48
|
type: options.projectName ? null : 'text',
|
@@ -59,7 +58,7 @@ async function promptForMissingOptions(options) {
|
|
59
58
|
? reset(
|
60
59
|
`"${options.template}" isn't a valid template. Please choose from below: `,
|
61
60
|
)
|
62
|
-
: reset('Select a
|
61
|
+
: reset('Select a Template:'),
|
63
62
|
choices: FRAMEWORKS.map((framework) => {
|
64
63
|
const frameworkColor = framework.color
|
65
64
|
return {
|
package/src/main.js
CHANGED
@@ -5,11 +5,20 @@ import Listr from 'listr'
|
|
5
5
|
import ncp from 'ncp'
|
6
6
|
import path from 'path'
|
7
7
|
import { promisify } from 'util'
|
8
|
+
import { createSpinner } from 'nanospinner'
|
9
|
+
import { download } from 'obtain-git-repo'
|
8
10
|
|
9
11
|
const access = promisify(fs.access)
|
10
12
|
const copy = promisify(ncp)
|
11
13
|
const writeFileSync = promisify(fs.writeFileSync)
|
12
14
|
|
15
|
+
const gitRepositoryList = [
|
16
|
+
{
|
17
|
+
name: 'gx-design-pro',
|
18
|
+
git: 'https://gitee.com/gx12358/vue-antd-admin.git#v2'
|
19
|
+
}
|
20
|
+
]
|
21
|
+
|
13
22
|
async function copyTemplateFiles(templateDir, root) {
|
14
23
|
return copy(templateDir, root, {
|
15
24
|
clobber: false
|
@@ -17,7 +26,32 @@ async function copyTemplateFiles(templateDir, root) {
|
|
17
26
|
}
|
18
27
|
|
19
28
|
function writeFile(path, content) {
|
20
|
-
|
29
|
+
if (Object.keys(content).length > 0) {
|
30
|
+
writeFileSync(path, content)
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
function editPackageJson(root, projectName) {
|
35
|
+
let pkg = {}
|
36
|
+
|
37
|
+
if (fs.existsSync(path.join(root, `package.json`))) {
|
38
|
+
pkg = JSON.parse(
|
39
|
+
fs.readFileSync(path.join(root, `package.json`), 'utf-8')
|
40
|
+
)
|
41
|
+
|
42
|
+
pkg.name = projectName
|
43
|
+
}
|
44
|
+
|
45
|
+
writeFile(path.join(root, 'package.json'), JSON.stringify(pkg, null, 2))
|
46
|
+
}
|
47
|
+
|
48
|
+
function doneLog(cwd, root) {
|
49
|
+
if (root !== cwd) {
|
50
|
+
console.log(chalk.blueBright(`cd ${path.relative(cwd, root)}`))
|
51
|
+
}
|
52
|
+
console.log(chalk.blueBright(`pnpm(yarn、npm) install`))
|
53
|
+
console.log(chalk.blueBright(`pnpm(yarn、npm) run dev`))
|
54
|
+
console.log()
|
21
55
|
}
|
22
56
|
|
23
57
|
export async function createProject(options) {
|
@@ -28,48 +62,71 @@ export async function createProject(options) {
|
|
28
62
|
const getProjectName = () =>
|
29
63
|
options.projectName === '.' ? path.basename(path.resolve()) : options.projectName
|
30
64
|
|
65
|
+
const downloadGit = gitRepositoryList.find(el => el.name === options.template)
|
66
|
+
|
31
67
|
const templateDir = path.resolve(
|
32
68
|
fileURLToPath(import.meta.url),
|
33
69
|
'../..',
|
34
|
-
`template-${options.template}
|
70
|
+
`template-${options.template}`
|
35
71
|
)
|
36
72
|
|
37
|
-
const pkg = JSON.parse(
|
38
|
-
fs.readFileSync(path.join(templateDir, `package.json`), 'utf-8')
|
39
|
-
)
|
40
|
-
|
41
|
-
pkg.name = options.projectName || getProjectName()
|
42
|
-
|
43
73
|
try {
|
44
74
|
await access(templateDir, fs.constants.R_OK)
|
45
75
|
} catch (err) {
|
46
|
-
|
76
|
+
if (!downloadGit) {
|
77
|
+
console.log(chalk.redBright('模版目录不存在'))
|
78
|
+
process.exit(1)
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
//目录是否已经存在
|
83
|
+
const dirIsExists = fs.existsSync(root)
|
84
|
+
|
85
|
+
if (dirIsExists) {
|
86
|
+
console.log(chalk.redBright('目录已经存在'))
|
47
87
|
process.exit(1)
|
48
88
|
}
|
49
89
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
90
|
+
if (downloadGit) {
|
91
|
+
const spinner = createSpinner(`开始下载...${downloadGit.git}`).start()
|
92
|
+
// 下载git代码
|
93
|
+
download(`direct:${downloadGit.git}`, root, { clone: true }, async function(err) {
|
94
|
+
if (err) {
|
95
|
+
console.log(err)
|
96
|
+
spinner.error({ text: '下载失败' })
|
97
|
+
} else {
|
98
|
+
await editPackageJson(root, options.projectName || getProjectName())
|
99
|
+
spinner.success({
|
100
|
+
text: '项目创建成功,请依次执行以下命令'
|
101
|
+
})
|
102
|
+
doneLog(cwd, root)
|
59
103
|
}
|
60
|
-
|
61
|
-
|
62
|
-
|
104
|
+
})
|
105
|
+
} else {
|
106
|
+
let pkg = {}
|
107
|
+
|
108
|
+
if (fs.existsSync(path.join(templateDir, `package.json`))) {
|
109
|
+
pkg = JSON.parse(
|
110
|
+
fs.readFileSync(path.join(templateDir, `package.json`), 'utf-8')
|
111
|
+
)
|
112
|
+
|
113
|
+
pkg.name = options.projectName || getProjectName()
|
63
114
|
}
|
64
|
-
|
115
|
+
const tasks = new Listr(
|
116
|
+
[
|
117
|
+
{
|
118
|
+
title: '项目创建成功,请依次执行以下命令',
|
119
|
+
task: () => copyTemplateFiles(templateDir, root)
|
120
|
+
}
|
121
|
+
],
|
122
|
+
{
|
123
|
+
exitOnError: false
|
124
|
+
}
|
125
|
+
)
|
65
126
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
console.log(`cd ${path.relative(cwd, root)}`)
|
127
|
+
await tasks.run()
|
128
|
+
await editPackageJson(root)
|
129
|
+
doneLog(cwd, root)
|
70
130
|
}
|
71
|
-
console.log(`pnpm(yarn、npm) install`)
|
72
|
-
console.log(`pnpm(yarn、npm) run dev`)
|
73
|
-
console.log()
|
74
131
|
return true
|
75
132
|
}
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# 实际执行环境 development
|
2
|
+
VITE_NODE_ENV= development
|
3
|
+
|
4
|
+
# environment 代码环境
|
5
|
+
VITE_USE_MODE = development
|
6
|
+
|
7
|
+
# 是否开启mock
|
8
|
+
VITE_USE_MOCK = true
|
9
|
+
|
10
|
+
# 是否删除console
|
11
|
+
VITE_DROP_CONSOLE = false
|
12
|
+
|
13
|
+
# api前缀
|
14
|
+
VITE_BASE_URL=/api
|
15
|
+
|
16
|
+
# oss信息
|
17
|
+
VITE_OSS_BUCKET = oss-*
|
18
|
+
VITE_OSS_ORIGIN = oss-cn-*
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# 实际执行环境 production
|
2
|
+
VITE_NODE_ENV= production
|
3
|
+
|
4
|
+
# environment 代码环境
|
5
|
+
VITE_USE_MODE = production
|
6
|
+
|
7
|
+
# 是否开启mock
|
8
|
+
VITE_USE_MOCK = true
|
9
|
+
|
10
|
+
# 是否删除console
|
11
|
+
VITE_DROP_CONSOLE = false
|
12
|
+
|
13
|
+
# Whether to enable gzip or brotli compression
|
14
|
+
# Optional: gzip | brotli | none
|
15
|
+
# If you need multiple forms, you can use `,` to separate
|
16
|
+
VITE_BUILD_COMPRESS = 'none'
|
17
|
+
|
18
|
+
# 使用压缩时是否删除源文件,默认为false
|
19
|
+
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
|
20
|
+
|
21
|
+
# 是否使用pwa
|
22
|
+
VITE_USE_PWA = false
|
23
|
+
|
24
|
+
# 是否为打包后的文件提供传统浏览器兼容性支持
|
25
|
+
VITE_LEGACY = false
|
26
|
+
|
27
|
+
# api前缀
|
28
|
+
VITE_BASE_URL=/mock-server
|
29
|
+
|
30
|
+
# oss信息
|
31
|
+
VITE_OSS_BUCKET = oss-*
|
32
|
+
VITE_OSS_ORIGIN = oss-cn-*
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# 实际执行环境 test
|
2
|
+
VITE_NODE_ENV= test
|
3
|
+
|
4
|
+
# environment 代码环境
|
5
|
+
VITE_USE_MODE = test
|
6
|
+
|
7
|
+
# 是否开启mock
|
8
|
+
VITE_USE_MOCK = true
|
9
|
+
|
10
|
+
# 是否删除console
|
11
|
+
VITE_DROP_CONSOLE = false
|
12
|
+
|
13
|
+
# Whether to enable gzip or brotli compression
|
14
|
+
# Optional: gzip | brotli | none
|
15
|
+
# If you need multiple forms, you can use `,` to separate
|
16
|
+
VITE_BUILD_COMPRESS = 'none'
|
17
|
+
|
18
|
+
# 使用压缩时是否删除源文件,默认为false
|
19
|
+
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
|
20
|
+
|
21
|
+
# 是否使用pwa
|
22
|
+
VITE_USE_PWA = false
|
23
|
+
|
24
|
+
# 是否为打包后的文件提供传统浏览器兼容性支持
|
25
|
+
VITE_LEGACY = false
|
26
|
+
|
27
|
+
# api前缀
|
28
|
+
VITE_BASE_URL=/mock-server
|
29
|
+
|
30
|
+
# oss信息
|
31
|
+
VITE_OSS_BUCKET = oss-*
|
32
|
+
VITE_OSS_ORIGIN = oss-cn-*
|
@@ -0,0 +1,20 @@
|
|
1
|
+
VITE_NODE_ENV=production
|
2
|
+
# Whether to open mock
|
3
|
+
VITE_USE_MOCK = true
|
4
|
+
|
5
|
+
# Delete console
|
6
|
+
VITE_DROP_CONSOLE = true
|
7
|
+
|
8
|
+
# Whether to enable gzip or brotli compression
|
9
|
+
# Optional: gzip | brotli | none
|
10
|
+
# If you need multiple forms, you can use `,` to separate
|
11
|
+
VITE_BUILD_COMPRESS = 'none'
|
12
|
+
|
13
|
+
# Whether to delete origin files when using compress, default false
|
14
|
+
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
|
15
|
+
|
16
|
+
# use pwa
|
17
|
+
VITE_USE_PWA = false
|
18
|
+
|
19
|
+
# Is it compatible with older browsers
|
20
|
+
VITE_LEGACY = false
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# test directories
|
2
|
+
__tests__
|
3
|
+
test
|
4
|
+
tests
|
5
|
+
powered-test
|
6
|
+
|
7
|
+
# asset directories
|
8
|
+
docs
|
9
|
+
doc
|
10
|
+
website
|
11
|
+
images
|
12
|
+
assets
|
13
|
+
|
14
|
+
# examples
|
15
|
+
example
|
16
|
+
examples
|
17
|
+
|
18
|
+
# code coverage directories
|
19
|
+
coverage
|
20
|
+
.nyc_output
|
21
|
+
|
22
|
+
# build scripts
|
23
|
+
Makefile
|
24
|
+
Gulpfile.js
|
25
|
+
Gruntfile.js
|
26
|
+
|
27
|
+
# configs
|
28
|
+
appveyor.yml
|
29
|
+
circle.yml
|
30
|
+
codeship-services.yml
|
31
|
+
codeship-steps.yml
|
32
|
+
wercker.yml
|
33
|
+
.tern-project
|
34
|
+
.gitattributes
|
35
|
+
.editorconfig
|
36
|
+
.*ignore
|
37
|
+
.eslintrc
|
38
|
+
.jshintrc
|
39
|
+
.flowconfig
|
40
|
+
.documentup.json
|
41
|
+
.yarn-metadata.json
|
42
|
+
.travis.yml
|
43
|
+
|
44
|
+
# misc
|
45
|
+
*.md
|
46
|
+
|
47
|
+
!istanbul-reports/lib/html/assets
|
48
|
+
!istanbul-api/node_modules/istanbul-reports/lib/html/assets
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 gx12358
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,111 @@
|
|
1
|
+
<div align="center"> <a href="https://gitee.com/gx12358/vite-admin-pro"> <img alt="VbenAdmin Logo" width="200" height="200" src="https://zbbf9-hw.ahtv.cn/ahtv-obs/20210811/d5b6f8d7-b759-243d-b8f3-906a6b8570bf.png"> </a> <br> <br>
|
2
|
+
|
3
|
+
<h1>GX Pro Admin(Ant Design Vue)</h1>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
## 简介
|
7
|
+
|
8
|
+
GX Pro Admin 是一个免费开源的中后台模版。使用了最新的`vue3.0+`,`vite2`,`TypeScript`, `Ant Design Vue3.0+`等主流技术开发,开箱即用的中后台前端解决方案,也可用于学习参考。
|
9
|
+
|
10
|
+
## 特性
|
11
|
+
|
12
|
+
- **最新技术栈**:使用 Vue3/vite2 等前端前沿技术开发
|
13
|
+
- **TypeScript**: 应用程序级 JavaScript 的语言
|
14
|
+
- **主题**:可配置的主题
|
15
|
+
- **Mock 数据** 内置 Mock 数据方案
|
16
|
+
- **权限** 内置完善的动态路由权限生成方案
|
17
|
+
- **组件** 二次封装了多个常用的组件
|
18
|
+
|
19
|
+
## 预览
|
20
|
+
|
21
|
+
- [🚀 pro 版演示地址](http://121.36.16.172:9000/gx.pro.admin)
|
22
|
+
|
23
|
+
测试账号: admin/123456
|
24
|
+
|
25
|
+
## 准备
|
26
|
+
|
27
|
+
- [node](http://nodejs.org/) 和 [git](https://git-scm.com/) -项目开发环境
|
28
|
+
- [Vite](https://vitejs.dev/) - 熟悉 vite 特性
|
29
|
+
- [Vue3](https://v3.vuejs.org/) - 熟悉 Vue 基础语法
|
30
|
+
- [TypeScript](https://www.typescriptlang.org/) - 熟悉`TypeScript`基本语法
|
31
|
+
- [Es6+](http://es6.ruanyifeng.com/) - 熟悉 es6 基本语法
|
32
|
+
- [Vue-Router-Next](https://next.router.vuejs.org/) - 熟悉 vue-router 基本使用
|
33
|
+
- [Ant-Design-Vue](https://next.antdv.com/components/overview-cn/) - ui 基本使用
|
34
|
+
- [Mock.js](https://github.com/nuysoft/Mock) - mockjs 基本语法
|
35
|
+
|
36
|
+
## 安装使用
|
37
|
+
|
38
|
+
- 获取项目代码
|
39
|
+
|
40
|
+
```bash
|
41
|
+
git clone https://gitee.com/gx12358/vite-admin-pro
|
42
|
+
```
|
43
|
+
|
44
|
+
- 安装依赖
|
45
|
+
|
46
|
+
```bash
|
47
|
+
cd gx-admin-pro
|
48
|
+
|
49
|
+
yarn install
|
50
|
+
|
51
|
+
```
|
52
|
+
|
53
|
+
- 运行
|
54
|
+
|
55
|
+
```bash
|
56
|
+
yarn serve
|
57
|
+
```
|
58
|
+
|
59
|
+
- 打包
|
60
|
+
|
61
|
+
```bash
|
62
|
+
yarn build
|
63
|
+
```
|
64
|
+
|
65
|
+
## Git 贡献提交规范
|
66
|
+
|
67
|
+
- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular))
|
68
|
+
|
69
|
+
- `feat` 增加新功能
|
70
|
+
- `fix` 修复问题/BUG
|
71
|
+
- `style` 代码风格相关无影响运行结果的
|
72
|
+
- `perf` 优化/性能提升
|
73
|
+
- `refactor` 重构
|
74
|
+
- `revert` 撤销修改
|
75
|
+
- `test` 测试相关
|
76
|
+
- `docs` 文档/注释
|
77
|
+
- `chore` 依赖更新/脚手架配置修改等
|
78
|
+
- `workflow` 工作流改进
|
79
|
+
- `ci` 持续集成
|
80
|
+
- `types` 类型定义文件更改
|
81
|
+
- `wip` 开发中
|
82
|
+
|
83
|
+
## 浏览器支持
|
84
|
+
|
85
|
+
本地开发推荐使用`Chrome 80+` 浏览器
|
86
|
+
|
87
|
+
支持现代浏览器, 不支持 IE
|
88
|
+
|
89
|
+
## 相关仓库
|
90
|
+
|
91
|
+
如果这些插件对你有帮助,可以给一个 star 支持下
|
92
|
+
|
93
|
+
- [vite-plugin-html](https://github.com/anncwb/vite-plugin-html) - 用于 html 模版转换及压缩
|
94
|
+
- [vite-plugin-style-import](https://github.com/anncwb/vite-plugin-style-import) - 用于组件库样式按需引入
|
95
|
+
- [vite-plugin-imagemin](https://github.com/anncwb/vite-plugin-imagemin) - 用于打包压缩图片资源
|
96
|
+
- [vite-plugin-compression](https://github.com/anncwb/vite-plugin-compression) - 用于打包输出.gz|.brotil 文件
|
97
|
+
- [vite-plugin-svg-icons](https://github.com/anncwb/vite-plugin-svg-icons) - 用于快速生成 svg 雪碧图
|
98
|
+
|
99
|
+
## 维护者
|
100
|
+
|
101
|
+
[@gx12358](https://gitee.com/gx12358)
|
102
|
+
|
103
|
+
## 交流
|
104
|
+
|
105
|
+
`GX-ADMIN-PRO` 是完全开源免费的项目,在帮助开发者更方便地进行中大型管理系统开发,同时也提供 QQ 交流群使用问题欢迎在群内提问。
|
106
|
+
|
107
|
+
- QQ 群 `871430530`
|
108
|
+
|
109
|
+
## License
|
110
|
+
|
111
|
+
[MIT © gx12358-2021](./LICENSE)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { getThemeVariables } from 'ant-design-vue/dist/theme'
|
2
|
+
import { resolve } from 'path'
|
3
|
+
import config from '../../config/config'
|
4
|
+
|
5
|
+
export function generateModifyVars(viteEnv: ViteEnv) {
|
6
|
+
const { VITE_USE_THEME } = viteEnv
|
7
|
+
|
8
|
+
const modifyVars = getThemeVariables()
|
9
|
+
|
10
|
+
const modifyVarsParams = {
|
11
|
+
...modifyVars,
|
12
|
+
hack: `${modifyVars.hack} @import (reference) "${resolve('src/design/config.less')}";`
|
13
|
+
}
|
14
|
+
|
15
|
+
if (!VITE_USE_THEME) modifyVarsParams['primary-color'] = config.theme.primaryColor
|
16
|
+
|
17
|
+
return modifyVarsParams
|
18
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* Get the configuration file variable name
|
3
|
+
* @param env
|
4
|
+
*/
|
5
|
+
import config from '../config/config'
|
6
|
+
|
7
|
+
const { shortName } = config.defaultSettings
|
8
|
+
|
9
|
+
export const getConfigFileName = (_: RecordType) => {
|
10
|
+
return `__PRODUCTION__${shortName || '__APP'}__CONF__`
|
11
|
+
.toUpperCase()
|
12
|
+
.replace(/\s/g, '')
|
13
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
/**
|
2
|
+
* Generate additional configuration files when used for packaging. The file can be configured with some global variables, so that it can be changed directly externally without repackaging
|
3
|
+
*/
|
4
|
+
import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant'
|
5
|
+
import fs, { writeFileSync } from 'fs-extra'
|
6
|
+
import chalk from 'chalk'
|
7
|
+
|
8
|
+
import { getRootPath, getEnvConfig } from '../utils'
|
9
|
+
import { getConfigFileName } from '../getConfigFileName'
|
10
|
+
|
11
|
+
import pkg from '../../package.json'
|
12
|
+
|
13
|
+
function createConfig(
|
14
|
+
{
|
15
|
+
configName,
|
16
|
+
config,
|
17
|
+
configFileName = GLOB_CONFIG_FILE_NAME
|
18
|
+
}: { configName: string; config: any; configFileName?: string } = { configName: '', config: {} }
|
19
|
+
) {
|
20
|
+
try {
|
21
|
+
const windowConf = `window.${configName}`
|
22
|
+
// Ensure that the variable will not be modified
|
23
|
+
const configStr = `${windowConf}=${JSON.stringify(config)};
|
24
|
+
Object.freeze(${windowConf});
|
25
|
+
Object.defineProperty(window, "${configName}", {
|
26
|
+
configurable: false,
|
27
|
+
writable: false,
|
28
|
+
});
|
29
|
+
`.replace(/\s/g, '')
|
30
|
+
fs.mkdirp(getRootPath(OUTPUT_DIR))
|
31
|
+
writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr)
|
32
|
+
|
33
|
+
console.log(chalk.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`)
|
34
|
+
console.log(chalk.gray(OUTPUT_DIR + '/' + chalk.green(configFileName)) + '\n')
|
35
|
+
} catch (error) {
|
36
|
+
console.log(chalk.red('configuration file configuration file failed to package:\n' + error))
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
export function runBuildConfig() {
|
41
|
+
const config = getEnvConfig()
|
42
|
+
const configFileName = getConfigFileName(config)
|
43
|
+
createConfig({ config, configName: configFileName })
|
44
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// #!/usr/bin/env node
|
2
|
+
import chalk from 'chalk'
|
3
|
+
import reSetRootHtml from './reSetRootHtml'
|
4
|
+
import { runBuildConfig } from './buildConf'
|
5
|
+
import { wrapperEnv, getEnvConfig } from '../utils'
|
6
|
+
|
7
|
+
import pkg from '../../package.json'
|
8
|
+
|
9
|
+
export const runBuild = async () => {
|
10
|
+
try {
|
11
|
+
const argvList = process.argv.splice(2)
|
12
|
+
|
13
|
+
// Generate configuration file
|
14
|
+
if (!argvList.includes('disabled-config')) {
|
15
|
+
await runBuildConfig()
|
16
|
+
}
|
17
|
+
|
18
|
+
!wrapperEnv(getEnvConfig()).VITE_USE_THEME && reSetRootHtml('ant-design-vue')
|
19
|
+
console.log(`✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - build successfully!')
|
20
|
+
} catch (error) {
|
21
|
+
console.log(chalk.red('vite build error:\n' + error))
|
22
|
+
process.exit(1)
|
23
|
+
}
|
24
|
+
}
|
25
|
+
runBuild()
|