feat: migrated packages to ts

This commit is contained in:
Haoyu Xu
2025-05-02 02:27:42 +08:00
parent 0af0c785d4
commit 8f6f537c81
111 changed files with 3166 additions and 1155 deletions

View File

@@ -1,9 +1,9 @@
import path from 'node:path'
import { file } from '@aklive2d/libs'
import config from '@aklive2d/config'
import { DIST_DIR } from '../index.js'
import { DIST_DIR } from '../index.ts'
export default async (packageDir) => {
export default async (packageDir: string) => {
const copyQueue = [
{
fn: file.symlink,

View File

@@ -1,22 +1,23 @@
import path from 'node:path'
import { file } from '@aklive2d/libs'
import { unzipDownload } from '@aklive2d/downloader'
import { unzipDownload, type UnzipDownloadItem } from '@aklive2d/downloader'
import { getOperatorId, getOperatorAlternativeId } from '@aklive2d/operator'
import { mapping } from '@aklive2d/music'
import config from '../index.js'
import config from '../index.ts'
import type { UpdateList, ItemToDownload, AbInfosItem } from '../types.ts'
export default async (dataDir) => {
const pidSet = new Set()
const versionRes = await fetch(
export default async (dataDir: string) => {
const pidSet: Set<string> = new Set()
const versionRes: Response = await fetch(
'https://ak-conf.hypergryph.com/config/prod/official/Android/version'
)
const version = (await versionRes.json()).resVersion
const lpacksRes = await fetch(
const version: string = (await versionRes.json()).resVersion
const lpacksRes: Response = await fetch(
`https://ak.hycdn.cn/assetbundle/official/Android/assets/${version}/hot_update_list.json`
)
const updateList = await lpacksRes.json()
const itemToDownload = new Set(config.item_to_download)
updateList.abInfos.map((item) => {
const updateList: UpdateList = await lpacksRes.json()
const itemToDownload: Set<ItemToDownload> = new Set(config.item_to_download)
updateList.abInfos.map((item: AbInfosItem) => {
if (item.name.includes(config.dynchars)) {
const id = getOperatorId(item.name).replace('.ab', '')
itemToDownload.add(id)
@@ -32,12 +33,12 @@ export default async (dataDir) => {
const itemToDownloadRegExp = new RegExp(
`(.*)(${Array.from(itemToDownload).join('|')})(.*)`
)
updateList.abInfos.map((item) => {
updateList.abInfos.map((item: AbInfosItem) => {
if (itemToDownloadRegExp.test(item.name)) {
item.pid && pidSet.add(item.pid)
if (item.pid) pidSet.add(item.pid)
}
})
const lpacksToDownload = []
const lpacksToDownload: UnzipDownloadItem[] = []
pidSet.forEach((item) => {
lpacksToDownload.push({
name: item,