question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add option to disable sort on `nx format:write` and/or group by type

See original GitHub issue

Description

#2607 and #5945 introduced the feature that nx format:write automatically sorts all project config files alphabetically. This might not be wanted in all situation and you should have the ability to disable it.

In addition I think that the sort feature should be extended to be able to “group” the configs together by type. E.g. Apps + E2E should still be at the beginning of the file (but sorted) and only after that the libs should be sorted.

Motivation

The current behavior might not be desired for everyone and can make it harder to find certain configurations if you had a system in place how you sort them (maybe shared libs at the start and then everything sorted by app dependency)

Suggested Implementation

Add a parameter to the command name --sort which accepts the following values false (disables it all together), alpha (default and current behavior) and then alphaByType (as described above group by type and then sorted within that type)

Alternate Implementations

The least thing should be an option like --disable-sort

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

1reaction
TapaiBalazscommented, Aug 6, 2021

I have a project, which uses NX, but I want to open the demoapp in Stackblitz. For that, I needed to create a “phantom” project configuration which is the same as serving the demoapp, but its “root” property is empty, so it can start up in Stackblitz, while I can use the original configuration to run it locally when I do development on the project.

I recently updated NX in that project, and this not opt-in alphabetical sorting caused issues with nx commands (they were throwing errors that the angular.json and the nx.json were out of sync.

It was caused by that “phantom” project config, because that needs to be the first in the projects in order to work. It also broke our stackblitz integration.

I was able to make a workaround by renaming our phantom project config to start with “a” and make everything work again, but I think that an option for disabling sorting would be helpful in such cases.

1reaction
raphzandradecommented, Jul 22, 2021

Sorting should not be the default behavior. When working on huge repos were lots of projects are being added or removed all the time, it becomes a nightmare of huge and imprecise diffs.

While I would appreciate the functionality for house keeping, adding it to the generators itself is not the way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disabling sort by fields on lists - ServiceNow Community
Hi Luke, You can add 'no_sort=true' to the Attributes field in the column's Dictionary record, that'll disable sorting for that one column.
Read more >
How to disable sorting Group order in Datagrid, but keep ...
Sorting event to sort data based on desired order. Assuming Category is the property which grouping is based on, we have something like...
Read more >
DataSource - How to remove sorting when we use the group ...
I am implementing a dx select box, which needs to have grouping and be searchable. The data for the select comes from a...
Read more >
[ADDED] Option to disable sorting by game on friends list
I had my friends list sorted in a decent structure, having the games bit overwrite that made it completely redundant.
Read more >
Enable or Disable Sort for Search Results - Salesforce Help
Sorting is enabled for search and category pages by default. However, you can control whether customers can see the sorting menu that appears...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found