mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-22 19:01:02 +01:00
feat(ops): implement natural sorting for uncommitted operation files
This commit is contained in:
@@ -34,6 +34,14 @@ async function parseOperationMetadata(filepath: string): Promise<Partial<Operati
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract leading number from filename for natural sorting
|
||||
*/
|
||||
function extractOpNumber(filename: string): number {
|
||||
const match = filename.match(/^(\d+)\./);
|
||||
return match ? parseInt(match[1], 10) : Infinity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get uncommitted operation files from ops/ directory
|
||||
*/
|
||||
@@ -65,6 +73,9 @@ export async function getUncommittedOps(repoPath: string): Promise<OperationFile
|
||||
}
|
||||
}
|
||||
|
||||
// Sort by operation number (natural sort)
|
||||
files.sort((a, b) => extractOpNumber(a.filename) - extractOpNumber(b.filename));
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user