feat: clear rollup

This commit is contained in:
2025-04-24 12:42:02 +08:00
parent c2e8818975
commit 6827945446
13 changed files with 285 additions and 361 deletions

View File

@@ -1,6 +1,7 @@
import path from 'path';
import fs from 'fs';
import { storage } from '../query.ts';
import { chalk } from '../chalk.ts';
type DownloadTask = {
downloadPath: string;
@@ -69,8 +70,17 @@ export const installApp = async (app: Package, opts: InstallAppOpts = {}) => {
if (token) {
fetchURL.searchParams.set('token', token);
}
fetchURL.searchParams.set('download', 'true');
const res = await fetch(fetchURL.toString());
const blob = await res.blob();
const type = blob.type;
if (type.includes('text/html')) {
const html = await blob.text();
if (html === 'fetchRes is error') {
console.log(chalk.red('fetchRes is error'));
break;
}
}
fs.writeFileSync(downloadPath, Buffer.from(await blob.arrayBuffer()));
}
let indexHtml = files.find((file: any) => file.name === 'index.html');