版本号生成策略
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
+2 -3
View File
@@ -5,11 +5,10 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "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", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview", "preview": "vite preview",
"test": "jest", "test": "jest"
"public": "tsc && vite build && surge dist seckit.surge.sh"
}, },
"dependencies": { "dependencies": {
"gm-crypto": "*", "gm-crypto": "*",
+7
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}`);
+2 -1
View File
@@ -1,4 +1,5 @@
import { useState } from 'react' import { useState } from 'react'
import { VERSION } from './version'
import { sm3Digest, sm3Hmac } from './utils/algorithm/sm3' import { sm3Digest, sm3Hmac } from './utils/algorithm/sm3'
import { sm4Encrypt, sm4Decrypt } from './utils/algorithm/sm4' 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' }}> <footer style={{ marginTop: '2rem', padding: '1rem', borderTop: '1px solid #ccc', textAlign: 'center' }}>
<p>© 2026 安全算法计算工具</p> <p>© 2026 安全算法计算工具</p>
<p>版本号: V1.0-{new Date().toISOString().slice(0, 19).replace(/[-:T]/g, '')}</p> <p>版本号: {VERSION}</p>
</footer> </footer>
</div> </div>
) )
+1
View File
@@ -0,0 +1 @@
export declare const VERSION: string;
+1
View File
@@ -0,0 +1 @@
export const VERSION = "V1.0-20260417022550";