@@ -4,15 +4,9 @@ import { chmod, copyFile, lstat, mkdir, mkdtemp, readdir, rename, rm, writeFile
44import { tmpdir } from 'node:os' ;
55import { join , resolve } from 'node:path' ;
66import { spawnSync } from 'node:child_process' ;
7+ import { platforms , platformFor } from './platforms' ;
78
89const projectRoot = resolve ( import . meta. dir , '..' ) ;
9- const platforms = [
10- { name : 'windows-x64' , runner : 'windows-2025' , target : 'bun-windows-x64' , binary : 'java-run.exe' , label : 'Windows x64' } ,
11- { name : 'linux-x64' , runner : 'ubuntu-24.04' , target : 'bun-linux-x64' , binary : 'java-run' , label : 'Linux x64' } ,
12- { name : 'linux-arm64' , runner : 'ubuntu-24.04-arm' , target : 'bun-linux-arm64' , binary : 'java-run' , label : 'Linux ARM64' } ,
13- { name : 'darwin-arm64' , runner : 'macos-15' , target : 'bun-darwin-arm64' , binary : 'java-run' , label : 'macOS Apple Silicon' } ,
14- { name : 'darwin-x64' , runner : 'macos-15-intel' , target : 'bun-darwin-x64' , binary : 'java-run' , label : 'macOS Intel' } ,
15- ] as const ;
1610const licenseNames = [ 'LICENSE' , 'LICENSE.md' , 'LICENSE.txt' ] ;
1711const repository = 'https://github.com/Vanisper/java-run' ;
1812
@@ -38,16 +32,16 @@ export function releaseMetadata(version: string, requestedTag?: string): Release
3832 version, tag, prerelease : match [ 4 ] !== undefined ,
3933 matrix : { include : platforms . map ( platform => ( {
4034 name : platform . name , runner : platform . runner , target : platform . target ,
41- binary : platform . binary , archive : `java-run- ${ platform . name } .zip` ,
35+ binary : platform . binary , archive : platform . archive ,
4236 } ) ) } ,
4337 } ;
4438}
4539
4640/** 为当前版本生成固定下载链接、安装要求和升级说明 */
4741export function releaseNotes ( version : string ) : string {
48- const { tag, matrix } = releaseMetadata ( version ) ;
42+ const { tag } = releaseMetadata ( version ) ;
4943 const download = `${ repository } /releases/download/${ encodeURIComponent ( tag ) } ` ;
50- const rows = matrix . include . map ( ( platform , index ) => `| ${ platforms [ index ] ! . label } | [${ platform . archive } ](${ download } /${ platform . archive } ) |` ) ;
44+ const rows = platforms . map ( platform => `| ${ platform . label } | [${ platform . archive } ](${ download } /${ platform . archive } ) |` ) ;
5145 return `## 下载与安装
5246
5347下载对应系统与处理器的 ZIP 后解压,无需安装 Bun。本机需要满足 Java 项目要求的 JDK;优先使用项目的 Maven / Gradle Wrapper,没有 Wrapper 时需安装对应构建工具。
@@ -66,12 +60,6 @@ ${rows.join('\n')}
6660` ;
6761}
6862
69- function platformFor ( name : string ) {
70- const platform = platforms . find ( platform => platform . name === name ) ;
71- if ( ! platform ) throw new Error ( `不支持的发布平台:${ name } ` ) ;
72- return { ...platform , folder : `java-run-${ platform . name } ` , archive : `java-run-${ platform . name } .zip` } ;
73- }
74-
7563async function assertFile ( path : string ) : Promise < void > {
7664 const stat = await lstat ( path ) ;
7765 if ( ! stat . isFile ( ) || stat . size === 0 ) throw new Error ( `文件不是非空普通文件:${ path } ` ) ;
0 commit comments