chore: init project

This commit is contained in:
vben
2024-05-19 21:20:42 +08:00
commit 399334ac57
630 changed files with 45623 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import path from 'node:path';
import { $ } from 'zx';
export * from '@changesets/git';
/**
* 获取暂存区文件
*/
async function getStagedFiles() {
try {
$.verbose = false;
const { stdout: lines } =
await $`git -c submodule.recurse=false diff --staged --diff-filter=ACMR --name-only --ignore-submodules -z`;
let changedList = lines ? lines.replace(/\0$/, '').split('\0') : [];
changedList = changedList.map((item) => path.resolve(process.cwd(), item));
const changedSet = new Set(changedList);
changedSet.delete('');
return [...changedSet];
} catch {
return [];
}
}
export { getStagedFiles };