feat: integrate StarLight updates and improve font settings and skin editor loading
Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
This commit is contained in:
70
scripts/axolotl/create-update-manifest.test.mjs
Normal file
70
scripts/axolotl/create-update-manifest.test.mjs
Normal file
@ -0,0 +1,70 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import crypto from 'node:crypto'
|
||||
import fs from 'node:fs'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
import { spawnSync } from 'node:child_process'
|
||||
|
||||
const root = path.resolve(import.meta.dirname, '..', '..')
|
||||
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'starlight-update-manifest-'))
|
||||
const releasePath = path.join(directory, 'release.json')
|
||||
const signaturesPath = path.join(directory, 'signatures')
|
||||
const outputPath = path.join(directory, 'latest.json')
|
||||
const tag = 'v1.9.7'
|
||||
const updaterAssets = [
|
||||
'Axolotl_Launcher_universal.app.tar.gz',
|
||||
'Axolotl_Launcher_1.9.7_aarch64.AppImage.tar.gz',
|
||||
'Axolotl_Launcher_1.9.7_amd64.AppImage.tar.gz',
|
||||
'Axolotl_Launcher_1.9.7_x64-setup.nsis.zip',
|
||||
]
|
||||
const debAssets = [
|
||||
'Axolotl_Launcher_1.9.7_amd64.deb',
|
||||
'Axolotl_Launcher_1.9.7_arm64.deb',
|
||||
]
|
||||
|
||||
try {
|
||||
fs.mkdirSync(signaturesPath)
|
||||
for (const name of updaterAssets) {
|
||||
fs.writeFileSync(path.join(signaturesPath, `${name}.sig`), 'signature'.repeat(8))
|
||||
}
|
||||
fs.writeFileSync(
|
||||
releasePath,
|
||||
JSON.stringify({
|
||||
body: '测试版本',
|
||||
assets: [...updaterAssets, ...debAssets].map((name, index) => ({
|
||||
name,
|
||||
size: index + 1024,
|
||||
digest: `sha256:${crypto.createHash('sha256').update(name).digest('hex')}`,
|
||||
browser_download_url: `https://github.com/Mystic-Stars/Axolotl/releases/download/${tag}/${name}`,
|
||||
})),
|
||||
}),
|
||||
)
|
||||
|
||||
const create = spawnSync(
|
||||
process.execPath,
|
||||
[
|
||||
'scripts/axolotl/create-update-manifest.mjs',
|
||||
releasePath,
|
||||
signaturesPath,
|
||||
tag,
|
||||
outputPath,
|
||||
],
|
||||
{ cwd: root, encoding: 'utf8' },
|
||||
)
|
||||
assert.equal(create.status, 0, create.stderr)
|
||||
|
||||
const manifest = JSON.parse(fs.readFileSync(outputPath, 'utf8'))
|
||||
assert.equal(manifest.version, '1.9.7')
|
||||
assert.deepEqual(Object.keys(manifest.apt).sort(), ['linux-aarch64', 'linux-x86_64'])
|
||||
assert.equal(manifest.apt['linux-x86_64'].size, 1028)
|
||||
assert.match(manifest.apt['linux-aarch64'].sha256, /^[0-9a-f]{64}$/)
|
||||
|
||||
const verify = spawnSync(
|
||||
process.execPath,
|
||||
['scripts/axolotl/verify-update-manifest.mjs', outputPath, tag],
|
||||
{ cwd: root, encoding: 'utf8' },
|
||||
)
|
||||
assert.equal(verify.status, 0, verify.stderr)
|
||||
} finally {
|
||||
fs.rmSync(directory, { recursive: true, force: true })
|
||||
}
|
||||
Reference in New Issue
Block a user