chore(release): single-source app version + add pnpm bump
- WebUI sidebar/login display and OneBot get_version_info now read the root package.json version via Vite `define`, removing hardcoded literals in webui/src/types.ts and core/onebot/actions/info.ts. - tools/bump-version.mjs (exposed as `pnpm bump <ver>`) syncs the version field across the root and all five workspace packages. - Bump everything to 1.7.8.
This commit is contained in:
13 files changed
+79
-10
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@snowluma/core",
|
||||
"version": "0.1.0",
|
||||
"version": "1.7.8",
|
||||
"description": "SnowLuma core - NTQQ packet sniffer with Node.js native addon",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
Vendored
+1
@@ -1 +1,2 @@
|
||||
declare const __BUILD_WEBUI__: boolean;
|
||||
declare const __APP_VERSION__: string;
|
||||
@@ -12,10 +12,13 @@ export function register(h: ApiHandler, ctx: ApiActionContext): void {
|
||||
return okResponse({ online, good: online });
|
||||
});
|
||||
|
||||
// __APP_VERSION__ is injected by Vite from the monorepo root package.json;
|
||||
// it's undefined under vitest (no define plugin), so fall back to 'dev'.
|
||||
const appVersion = typeof __APP_VERSION__ !== 'undefined' ? __APP_VERSION__ : 'dev';
|
||||
h.registerAction('get_version_info', async () => {
|
||||
return okResponse({
|
||||
app_name: 'SnowLuma',
|
||||
app_version: '0.1.0-node',
|
||||
app_version: `${appVersion}-node`,
|
||||
protocol_version: 'v11',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,6 +11,11 @@ const distDir = path.resolve(repoRoot, 'dist');
|
||||
const runtimeDir = path.resolve(repoRoot, 'packages', 'runtime');
|
||||
const nativeDir = path.resolve(runtimeDir, 'native');
|
||||
|
||||
// Single source of truth for the user-facing app version: monorepo root package.json.
|
||||
const rootPkg = JSON.parse(
|
||||
fs.readFileSync(path.resolve(repoRoot, 'package.json'), 'utf-8'),
|
||||
) as { version: string };
|
||||
|
||||
// vite-plugin-cp consumes globs through globby; on Windows we must use POSIX-style separators.
|
||||
const toPosix = (p: string) => p.replace(/\\/g, '/');
|
||||
|
||||
@@ -119,7 +124,8 @@ const BaseConfig = (source_map: boolean = false) => defineConfig({
|
||||
emptyOutDir: true
|
||||
},
|
||||
define: {
|
||||
__BUILD_WEBUI__: process.env.BUILD_WEBUI === 'true'
|
||||
__BUILD_WEBUI__: process.env.BUILD_WEBUI === 'true',
|
||||
__APP_VERSION__: JSON.stringify(rootPkg.version)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user