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:
DrSmoothl committed 2026-05-13 16:51:44 +08:00
1 parent c9fa119a50
commit 61e3867197
13 files changed
+79 -10

No files matched your search

+1 -1
View File
@@ -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",
+1
View File
@@ -1 +1,2 @@
declare const __BUILD_WEBUI__: boolean;
declare const __APP_VERSION__: string;
+4 -1
View File
@@ -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',
});
});
+7 -1
View File
@@ -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)
}
});
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@snowluma/runtime",
"version": "0.1.0",
"version": "1.7.8",
"private": true,
"type": "module",
"main": "index.mjs",
+1 -1
View File
@@ -4,7 +4,7 @@
"name": "MotricSeven",
"email": "[email protected]"
},
"version": "0.1.0",
"version": "1.7.8",
"description": "TypeScript SDK for SnowLuma OneBot HTTP and WebSocket transports",
"keywords": [
"snowluma",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@snowluma/websocket",
"version": "0.1.0",
"version": "1.7.8",
"private": true,
"type": "module",
"main": "./src/index.ts",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "webui",
"private": true,
"version": "0.0.0",
"version": "1.7.8",
"type": "module",
"scripts": {
"dev": "vite",
+1
View File
@@ -0,0 +1 @@
declare const __APP_VERSION__: string;
+2 -1
View File
@@ -1,5 +1,6 @@
export const APP_NAME = 'SnowLuma';
export const APP_VERSION = '0.1.0';
// Injected at build time by Vite from the monorepo root package.json.
export const APP_VERSION = __APP_VERSION__;
export interface QQInfo {
uin: string;
+9
View File
@@ -1,3 +1,4 @@
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';
@@ -6,6 +7,11 @@ import tailwindcss from '@tailwindcss/vite';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// Single source of truth for the user-facing app version: monorepo root package.json.
const rootPkg = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '../../package.json'), 'utf-8'),
) as { version: string };
export default defineConfig({
plugins: [tailwindcss(), react()],
resolve: {
@@ -13,6 +19,9 @@ export default defineConfig({
'@': path.resolve(__dirname, 'src'),
},
},
define: {
__APP_VERSION__: JSON.stringify(rootPkg.version),
},
server: {
port: 5178,
strictPort: false,