This commit is contained in:
2026-01-22 17:31:26 +08:00
parent 59b3961ff9
commit a583fdc211
2 changed files with 12 additions and 19 deletions

View File

@@ -171,7 +171,7 @@ const uploadFiles = async (files: string[], directory: string, opts: UploadFileO
logger.error('请检查文件是否存在'); logger.error('请检查文件是否存在');
} }
data.files.push({ path: file, hash: hash }); data.files.push({ path: file, hash: hash });
if(filePath.includes('readme.md')) { if (filePath.includes('readme.md')) {
description = fs.readFileSync(filePath, 'utf-8'); description = fs.readFileSync(filePath, 'utf-8');
} }
} }
@@ -215,8 +215,10 @@ const uploadFiles = async (files: string[], directory: string, opts: UploadFileO
} }
const filename = path.basename(filePath); const filename = path.basename(filePath);
logger.debug('upload file', file, filename); logger.debug('upload file', file, filename);
// 解决 busbox 文件名乱码: 将 UTF-8 编码的文件名转换为 binary 字符串
const encodedFilename = Buffer.from(filename, 'utf-8').toString('binary');
form.append('file', fs.createReadStream(filePath), { form.append('file', fs.createReadStream(filePath), {
filename: filename, filename: encodedFilename,
filepath: file, filepath: file,
}); });
needUpload = true; needUpload = true;

View File

@@ -6,8 +6,9 @@ import { getConfig, query } from '@/module/index.ts';
import { fileIsExist } from '@/uitls/file.ts'; import { fileIsExist } from '@/uitls/file.ts';
import { chalk } from '@/module/chalk.ts'; import { chalk } from '@/module/chalk.ts';
import * as backServices from '@/query/services/index.ts'; import * as backServices from '@/query/services/index.ts';
import { select, input } from '@inquirer/prompts'; import { input } from '@inquirer/prompts';
import { logger } from '@/module/logger.ts'; import { logger } from '@/module/logger.ts';
// 查找文件(忽略大小写) // 查找文件(忽略大小写)
async function findFileInsensitive(targetFile: string): Promise<string | null> { async function findFileInsensitive(targetFile: string): Promise<string | null> {
const files = fs.readdirSync('.'); const files = fs.readdirSync('.');
@@ -249,14 +250,9 @@ const packCommand = new Command('pack')
let appKey: string | undefined; let appKey: string | undefined;
let version = packageInfo.version || ''; let version = packageInfo.version || '';
if (!version) { if (!version) {
const answers = await inquirer.prompt([ version = await input({
{
type: 'input',
name: 'version',
message: 'Enter your version:', message: 'Enter your version:',
}, });
]);
version = answers.version || version;
} }
if (basename) { if (basename) {
@@ -271,14 +267,9 @@ const packCommand = new Command('pack')
appKey = basenameArr[1] || ''; appKey = basenameArr[1] || '';
} }
if (!appKey) { if (!appKey) {
const answers = await inquirer.prompt([ appKey = await input({
{
type: 'input',
name: 'appKey',
message: 'Enter your appKey:', message: 'Enter your appKey:',
}, });
]);
appKey = answers.appKey || appKey;
} }
let value = await pack({ let value = await pack({
packDist, packDist,