Skip to content

Commit 95e4752

Browse files
Copilothotlong
andcommitted
Optimize version loading to use constant instead of function
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent f331589 commit 95e4752

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

apps/docs/lib/homepage-i18n.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Supports: en (English), cn (Chinese/中文)
66
*/
77

8-
import { getSpecVersion } from './version';
8+
import { SPEC_VERSION } from './version';
99

1010
export interface HomepageTranslations {
1111
// Hero Section
@@ -88,7 +88,7 @@ export interface HomepageTranslations {
8888
export const en: HomepageTranslations = {
8989
badge: {
9090
status: 'Protocol Specification',
91-
version: getSpecVersion(),
91+
version: SPEC_VERSION,
9292
},
9393
hero: {
9494
title: {
@@ -159,7 +159,7 @@ export const en: HomepageTranslations = {
159159
export const cn: HomepageTranslations = {
160160
badge: {
161161
status: '协议规范',
162-
version: getSpecVersion(),
162+
version: SPEC_VERSION,
163163
},
164164
hero: {
165165
title: {

apps/docs/lib/version.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
import specPackage from '../../../packages/spec/package.json';
88

99
/**
10-
* Get the current version of @objectstack/spec
10+
* The current version of @objectstack/spec
11+
* Computed once at module initialization
1112
*/
12-
export function getSpecVersion(): string {
13-
return `v${specPackage.version}`;
14-
}
13+
export const SPEC_VERSION = `v${specPackage.version}`;

0 commit comments

Comments
 (0)