Skip to content

Commit

Permalink
fix: 优化版本比对逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
hacxy committed Mar 26, 2024
1 parent 78a7c19 commit 005d368
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 23 deletions.
3 changes: 2 additions & 1 deletion packages/oh-my-live2d/package.json
Expand Up @@ -40,6 +40,7 @@
"pixi-live2d-display": "0.4.0",
"pixi.js": "6.5.10",
"vite": "5.1.4",
"vite-plugin-cp": "^4.0.8"
"vite-plugin-cp": "^4.0.8",
"compare-versions": "^6.1.0"
}
}
3 changes: 2 additions & 1 deletion packages/oh-my-live2d/src/utils/index.ts
@@ -1,3 +1,4 @@
import { compare } from 'compare-versions';
import { isNumber, mergeDeep } from 'tianjie';

import { WindowSizeType } from '../constants/index.js';
Expand Down Expand Up @@ -97,7 +98,7 @@ export const checkVersion = async (): Promise<void> => {
const result = await fetch('https://unpkg.com/oh-my-live2d@latest/package.json');
const { version } = <{ version: string }>await result.json();

if (version !== __VERSION__) {
if (compare(version, __VERSION__, '>')) {
console.warn('[oml2d] 检查到 oh-my-live2d 存在最新版:', `v${version}`, '请前往: https://oml2d.com 以获得最新版详细信息, 并及时更新.');
}
};
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions tests/vite-app/index.html
Expand Up @@ -5,30 +5,30 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<script src="index.min.js"></script>
<!-- <script src="index.min.js"></script> -->
<!-- <script src="https://unpkg.com/oh-my-live2d@latest"></script> -->
</head>
<body>
<div id="app"></div>
<script>
<script src="./src/main.ts" type="module"></script>

<!-- <script>
const divEl = document.createElement('div');
// document.body.append(divEl);
OML2D.loadOml2d({
// parentElement: divEl,
models: [
{
path: 'https://cdn.jsdelivr.net/gh/Eikanya/Live2d-model/Live2D/Senko_Normals/senko.model3.json',
scale: 0.12,
position: [-50, 50],
stageStyle: {
width: 320
}
}
{
path: 'https://model.oml2d.com/HK416-1-normal/model.json',
position: [0, 60],
scale: 0.08,
stageStyle: {
height: 450
}
}
]
});
</script>

<!-- <script src="./src/main.ts" type="module"></script> -->
</script> -->

<!-- <script>
Expand Down

0 comments on commit 005d368

Please sign in to comment.