Skip to content

IndexGenerator output order depends on OS locale (cs vs en) #111

Closed

Description

@patrik-2000

Package version

8.5.x

Describe the bug

IndexGenerator sorts scanned files with naturalSort from @poppinss/utils (see: virtual_file_system.ts ). That helper creates Intl.Collator without a locale (see: poppinss natural_sort ), so Node uses the OS/ICU default locale.

Generated files such as:

  • .adonisjs/server/controllers.ts
  • .adonisjs/server/pages.d.ts

therefore get a different key/path order depending on the developer's system language.

Slice of the pages.d.ts file on system with Czech (cs) language:

    'admin/auth/login': ExtractProps<(typeof import('../../inertia/pages/admin/auth/login.tsx'))['default']>
    'admin/groups/index': ExtractProps<(typeof import('../../inertia/pages/admin/groups/index.tsx'))['default']>
    'admin/groups/show': ExtractProps<(typeof import('../../inertia/pages/admin/groups/show.tsx'))['default']>
    'admin/children/index': ExtractProps<(typeof import('../../inertia/pages/admin/children/index.tsx'))['default']>
    'admin/children/show': ExtractProps<(typeof import('../../inertia/pages/admin/children/show.tsx'))['default']>
    'admin/users/index': ExtractProps<(typeof import('../../inertia/pages/admin/users/index.tsx'))['default']>
    'admin/users/show': ExtractProps<(typeof import('../../inertia/pages/admin/users/show.tsx'))['default']>

Slice of the pages.d.ts file on system with English (en) language:

    'admin/auth/login': ExtractProps<(typeof import('../../inertia/pages/admin/auth/login.tsx'))['default']>
    'admin/children/index': ExtractProps<(typeof import('../../inertia/pages/admin/children/index.tsx'))['default']>
    'admin/children/show': ExtractProps<(typeof import('../../inertia/pages/admin/children/show.tsx'))['default']>
    'admin/groups/index': ExtractProps<(typeof import('../../inertia/pages/admin/groups/index.tsx'))['default']>
    'admin/groups/show': ExtractProps<(typeof import('../../inertia/pages/admin/groups/show.tsx'))['default']>
    'admin/users/index': ExtractProps<(typeof import('../../inertia/pages/admin/users/index.tsx'))['default']>
    'admin/users/show': ExtractProps<(typeof import('../../inertia/pages/admin/users/show.tsx'))['default']>

Adonis docs recommend committing these generated files. In a team where one developer uses cs and another en, regenerating the files produces noisy git diffs even though nothing in the app changed.

Suggested fix

Generated artifacts should be sorted with an explicit, stable locale (e.g. 'en'), for example:

const collator = new Intl.Collator('en', {
    numeric: true,
    sensitivity: 'base',
});
const sortedFiles = filesList.sort(collator.compare)

Alternatively, @poppinss/utils naturalSort could default to 'en' (or accept a locale argument).

Either way, assembler-generated files that are meant to be committed should not depend on Intl default locale.

Reproduction repo

No response

Activity

  1. added theissue type on Sep 23, 2026
  2. added
    Status: AcceptedThe proposal or the feature has been accepted for the future versions
    Priority: MediumTry to fix the issue for the next patch/minor release
    on Sep 23, 2026
  3. RomainLanz commented on Sep 23, 2026

    @RomainLanz
    Member

    Hey @patrik-2000! 👋🏻

    Good catch! Once the PR poppinss/utils#55 land, it should fix your issue.

  4. RomainLanz commented on Sep 23, 2026

    @RomainLanz
    Member

    If you update your sub-dependencies it should be fixed! Can you please confirm @patrik-2000?

  5. patrik-2000 commented on Sep 23, 2026

    @patrik-2000
    Author

    Hey @RomainLanz !

    I updated the sub-dependencies and can confirm the fix. Sorting now behaves the same on both cs and en — it orders correctly on both systems. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: MediumTry to fix the issue for the next patch/minor releaseStatus: AcceptedThe proposal or the feature has been accepted for the future versions

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions