import { tgz, zip } from 'compressing';
import dayjs from 'dayjs';

import packageJson from '../package.json';

const now = dayjs();

const fileName = `${packageJson.name}_v${packageJson.version}_${now.format('YYMMDD-HHmmss')}`;

try {
  await zip.compressDir('./dist', `${fileName}.zip`);
  await tgz.compressDir('./dist', `${fileName}.tar`);
  await tgz.compressDir('./dist', `${fileName}.tar.gz`);
} catch (error) {
  console.error('压缩失败:', error);
}
