Skip to content

Commit

Permalink
build: assign constant name to es bundle, fix publick-package-ci miss…
Browse files Browse the repository at this point in the history
…ing es bundle
  • Loading branch information
rookie-luochao committed Apr 29, 2024
1 parent 7dda1ed commit b195e8f
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-package-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: pnpm install
# 打包
- name: Running Build
run: npm run build
run: npm run build:package
# 测试
# - name: Running Test
# run: pnpm run test-unit
Expand Down
68 changes: 68 additions & 0 deletions src/assets/images/login-bg.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 9 additions & 8 deletions src/login/index.tsx → src/login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { map, throttle } from "lodash-es";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { ParsedUrlQuery, useRouterQuery } from "react-router-toolkit";
import backgroundImage from "../assets/images/login-bg.svg";
import LogoIcon from "../assets/images/logo.png";
import { ChangeLangComp } from "../components/change-lang";
import GithubStar from "../components/github-star";
Expand All @@ -13,7 +14,7 @@ import { getConfig } from "../core/http/config";
import { ITheme, dsc, lightTheme } from "../core/style/defaultStyleConfig";
import { SwitchTheme } from "../core/style/theme";
import { flexBetweenCenterOpts, flexCenterOpts, flexOpts } from "../core/style/utils";
import { defaultHeadTitleHeight } from "../main";
import { defaultHeadTitleHeight } from "../main/Main";
import { FileImportView } from "./ImportByFileView";
import { TextImportView } from "./ImportByTextView";
import { URLImportView } from "./ImportByURLView";
Expand All @@ -28,7 +29,7 @@ export default function Login() {
const { t } = useTranslation();
const theme = useTheme() as ITheme;
const [contentHeight, setContentHeight] = useState(document.documentElement.clientHeight);
const isZh = getConfig().env !== Env.zh;
const isZh = getConfig().env === Env.zh;

const throttledResizeHandler = throttle(
() => {
Expand All @@ -48,16 +49,16 @@ export default function Login() {

return (
<div
css={{
style={{
minHeight: contentHeight,
backgroundImage: "url(https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg)",
backgroundImage: `url(${backgroundImage})`,
backgroundSize: "100% 100%",
backgroundRepeat: "no-repeat",
backgroundColor: theme.color.bg,
color: theme.color.menuItem,
}}
>
<div css={{ minHeight: document.documentElement.clientHeight - 32 }}>
<div style={{ minHeight: document.documentElement.clientHeight - 32 }}>
<div css={[flexBetweenCenterOpts(), { minWidth: 1200, height: defaultHeadTitleHeight, padding: "0px 30px" }]}>
<img style={{ width: 128 }} src={LogoIcon} alt="openapi-ui" />
<div css={{ display: "flex", "& > *": { marginLeft: 4, ...flexCenterOpts() } }}>
Expand All @@ -67,7 +68,7 @@ export default function Login() {
<GithubStar />
</div>
</div>
<div css={{ width: 1200, margin: "0px auto", paddingTop: 128 }}>
<div style={{ width: 1200, margin: "0px auto", paddingTop: 128 }}>
<div
css={[
flexCenterOpts(),
Expand Down Expand Up @@ -111,12 +112,12 @@ export default function Login() {
}}
>
{displayImportModeTypeIcon(item, theme.color.textLight)}
<span css={{ marginLeft: 10 }}>{t(displayImportModeType(item))}</span>
<span style={{ marginLeft: 10 }}>{t(displayImportModeType(item))}</span>
</a>
))}
</div>
<div css={flexCenterOpts()}>
<div css={{ width: 600 }}>
<div style={{ width: 600 }}>
{activeImportModeType === ImportModeType.url && <URLImportView />}
{activeImportModeType === ImportModeType.file && <FileImportView />}
{activeImportModeType === ImportModeType.text && <TextImportView />}
Expand Down
2 changes: 1 addition & 1 deletion src/login/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { lazy } from "react";

const Login = lazy(() => import("./index"));
const Login = lazy(() => import("./Login"));
export const loginModuleName = "/login";

export const loginRoutes = {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/main/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { lazy } from "react";

const MainLayout = lazy(() => import("./index"));
const MainLayout = lazy(() => import("./Main"));
const OpenapiView = lazy(() => import("../openapi/OpenapiView"));
export const mainLayoutPath = "service";

Expand Down
2 changes: 1 addition & 1 deletion src/postman/index.tsx → src/postman/Postman.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getConfig } from "../core/http/config";
import { useConfigInfoStore } from "../core/store";
import { ITheme, darkTheme, lightTheme } from "../core/style/defaultStyleConfig";
import i18n from "../i18n";
import { defaultHeadTitleHeight } from "../main";
import { defaultHeadTitleHeight } from "../main/Main";
import { RequestBuilder } from "./RequestBuilder";

type TargetKey = React.MouseEvent | React.KeyboardEvent | string;
Expand Down
2 changes: 1 addition & 1 deletion src/postman/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { lazy } from "react";

const Postman = lazy(() => import("./index"));
const Postman = lazy(() => import("./Postman"));
export const postmanModuleName = "/postman";

export const postmanRoutes = {
Expand Down
5 changes: 5 additions & 0 deletions vite.package.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ export default defineConfig({
entryFileNames: () => {
return "openapi-ui.js";
},
chunkFileNames: () => {
return "[name].js";
},
dir: resolve(__dirname, "es"),
// sourcemap: true,
},
{
name: "umd build",
Expand All @@ -64,6 +68,7 @@ export default defineConfig({
return "openapi-ui.umd.js";
},
dir: resolve(__dirname, "lib"),
// sourcemap: true,
},
],
},
Expand Down

0 comments on commit b195e8f

Please sign in to comment.