23 lines
1.4 KiB
JavaScript
23 lines
1.4 KiB
JavaScript
import { readFileSync, writeFileSync } from 'node:fs'
|
|
const API='https://git.qyhhh.top/api/v1'
|
|
const repo='dsh-better-chat'
|
|
const br=await (await fetch(API+'/repos/DeepsSeekHarness/'+repo+'/branches/main')).json()
|
|
const commit=br.commit.id
|
|
const ts=Math.floor(Date.parse(br.commit.timestamp)/1000)
|
|
const pkg=JSON.parse(Buffer.from((await (await fetch(API+'/repos/DeepsSeekHarness/'+repo+'/contents/package.json?ref=main')).json()).content,'base64').toString('utf8'))
|
|
console.log('live',pkg.version,commit.slice(0,8),ts)
|
|
const idx=JSON.parse(readFileSync('index.json','utf8'))
|
|
const p=idx.plugins.find(x=>x.name===repo)
|
|
p.title='dsh-better-chat · 聊天增强'
|
|
p.description='审批卡快捷键(可自定义)、权限界面移除「完全权限」、插件商店更新按钮。'
|
|
p.metadata = p.metadata||{}
|
|
p.metadata.keywords=['chat','approval','permission']
|
|
p.versions=[{version:pkg.version,publishTimestamp:ts,source:{type:'git',url:'https://git.qyhhh.top/DeepsSeekHarness/'+repo,commit},engines:{}}]
|
|
writeFileSync('index.json',JSON.stringify(idx,null,2)+'\n')
|
|
const mf=JSON.parse(readFileSync('release-manifest.json','utf8'))
|
|
const c=mf.components.find(x=>x.repo===repo)
|
|
c.version=pkg.version;c.sourceCommit=commit;c.publishTimestamp=ts;c.branch='main'
|
|
mf.generatedAt=new Date().toISOString().replace(/\.\d+Z$/,'.000Z')
|
|
writeFileSync('release-manifest.json',JSON.stringify(mf,null,2)+'\n')
|
|
console.log('done',p.versions[0].version,c.version,c.sourceCommit.slice(0,8))
|