版本号生成策略
All checks were successful
Build and Deploy / build (push) Successful in 1m4s

This commit is contained in:
cheney 2026-04-17 10:26:51 +08:00
parent 044e4680f9
commit 826419fdbc
5 changed files with 13 additions and 4 deletions

View File

@ -5,11 +5,10 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build": "node scripts/generate-version.js && tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"test": "jest",
"public": "tsc && vite build && surge dist seckit.surge.sh"
"test": "jest"
},
"dependencies": {
"gm-crypto": "*",

View File

@ -0,0 +1,7 @@
// 生成版本号文件
import fs from 'fs';
const version = 'V1.0-' + new Date().toISOString().slice(0, 19).replace(/[-:T]/g, '');
const content = `export const VERSION = "${version}";`;
fs.writeFileSync('src/version.js', content);
console.log(`Generated version file with version: ${version}`);

View File

@ -1,4 +1,5 @@
import { useState } from 'react'
import { VERSION } from './version'
import { sm3Digest, sm3Hmac } from './utils/algorithm/sm3'
import { sm4Encrypt, sm4Decrypt } from './utils/algorithm/sm4'
@ -288,7 +289,7 @@ function App() {
{/* 页脚 */}
<footer style={{ marginTop: '2rem', padding: '1rem', borderTop: '1px solid #ccc', textAlign: 'center' }}>
<p>© 2026 </p>
<p>版本号: V1.0-{new Date().toISOString().slice(0, 19).replace(/[-:T]/g, '')}</p>
<p>: {VERSION}</p>
</footer>
</div>
)

1
src/version.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare const VERSION: string;

1
src/version.js Normal file
View File

@ -0,0 +1 @@
export const VERSION = "V1.0-20260417022550";