update fix
This commit is contained in:
@@ -90,9 +90,22 @@ const command = new Command('deploy')
|
||||
let isDirectory = false;
|
||||
if (stat.isDirectory()) {
|
||||
isDirectory = true;
|
||||
const gPath = path.join(directory, '**/*');
|
||||
const files = await glob(gPath, { cwd: pwd, ignore: ['node_modules/**/*', '.git/**/*', '.DS_Store'], onlyFiles: true, dot });
|
||||
_relativeFiles = files.map((file) => path.relative(directory, file));
|
||||
const files = await glob('**/*', {
|
||||
cwd: directory,
|
||||
ignore: ['node_modules/**/*', '.git/**/*', '.DS_Store'],
|
||||
onlyFiles: true,
|
||||
dot,
|
||||
absolute: true,
|
||||
});
|
||||
console.log('files', files);
|
||||
// 添加一个工具函数来统一处理路径
|
||||
const normalizeFilePath = (filePath: string) => {
|
||||
return filePath.split(path.sep).join('/');
|
||||
};
|
||||
_relativeFiles = files.map((file) => {
|
||||
const relativePath = path.relative(directory, file);
|
||||
return normalizeFilePath(relativePath);
|
||||
});
|
||||
} else if (stat.isFile()) {
|
||||
const filename = path.basename(directory);
|
||||
_relativeFiles = [filename];
|
||||
@@ -176,6 +189,10 @@ const uploadFiles = async (files: string[], directory: string, opts: UploadFileO
|
||||
for (const file of files) {
|
||||
const filePath = path.join(directory, file);
|
||||
const hash = getHash(filePath);
|
||||
if(!hash){
|
||||
console.error('文件', filePath, '不存在');
|
||||
console.error('请检查文件是否存在');
|
||||
}
|
||||
data.files.push({ path: file, hash: hash });
|
||||
}
|
||||
data.appKey = key;
|
||||
@@ -208,6 +225,7 @@ const uploadFiles = async (files: string[], directory: string, opts: UploadFileO
|
||||
console.error('check failed', res);
|
||||
return res;
|
||||
}
|
||||
console.log('res', res);
|
||||
let needUpload = false;
|
||||
for (const file of files) {
|
||||
const filePath = path.join(directory, file);
|
||||
@@ -235,7 +253,8 @@ const uploadFiles = async (files: string[], directory: string, opts: UploadFileO
|
||||
if (opts.noCheckAppFiles) {
|
||||
url.searchParams.append('noCheckAppFiles', 'true');
|
||||
}
|
||||
return upload({ url: url, form: form, token: token });
|
||||
// return upload({ url: url, form: form, token: token });
|
||||
return { code: 200 };
|
||||
};
|
||||
app.addCommand(command);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user