Build-fix: update snapshotting code to generate a predictable (A-Z) ordering of the snapshotted files
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-05-20 21:57:36 +02:00
parent 52c104f781
commit a784abc1b0
7 changed files with 51 additions and 48 deletions

View File

@@ -10,7 +10,10 @@ export const getCode = async (bundle, outputOptions, allFiles = false) => {
const { output } = await bundle.generate(outputOptions || { format: 'cjs', exports: 'auto' });
if (allFiles) {
return output.map(({ code, fileName, source, map }) => {
return output.sort((a,b)=> {
if(a.fileName === b.fileName && a.source !== b.source){ return a.source<b.source?-1:1}
return a.fileName < b.fileName ? -1 : (a.fileName > b.fileName? 1 : 0);
}).map(({ code, fileName, source, map }) => {
return {
code,
fileName,