diff --git a/src/generator/template-generation.ts b/src/generator/template-generation.ts index ed79f15..8d20504 100644 --- a/src/generator/template-generation.ts +++ b/src/generator/template-generation.ts @@ -71,9 +71,11 @@ function copyTemplateTree( variables: Readonly>, ): void { const sourceDirectory = resolve(templateRoot, relativeDirectory); - const entries = readdirSync(sourceDirectory, { withFileTypes: true }).sort( - (a, b) => a.name.localeCompare(b.name), - ); + const entries = readdirSync(sourceDirectory, { withFileTypes: true }).sort((a, b) => { + if (a.name < b.name) return -1; + if (a.name > b.name) return 1; + return 0; + }); for (const entry of entries) { assertSafeEntryName(entry.name);