[RRFC] Topological Sort
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 777
- Forks
- 267
- PR merge metrics
- No merged PRs in 30d
Description
Motivation ("The Why")
I got this idea from a github issue.
Example
I am proposing that we add a sorting algorithm for ordering the graph traversal of npm commands that operate on the dependency graph express by a workspace.
A fully configured example in package.json might be as follows
{
"workspaces": [
"workspaces/transitive-dependency",
"workspaces/dependency",
"workspaces/dependent"
],
"workspaces-sort": {
"algorithm": "topological-parallel",
"include": [
"dependencies",
"bundleDependencies",
"devDependencies",
"optionalDependencies",
"peerDependencies"
]
}
}
And a user might use it at the command-line as follows
npm rn test --workspaces --workspaces-sort-algorithm=topological-parallel --workspaces-sort-include=dev,bundle,optional,peeru
How
Current Behaviour
Currently, developers maintain a valid sort order manually in package.json, in the form of an ordered array in the workspaces key.
Desired Behaviour
Developers could list workspaces in any order, while still operating on packages in the order required for correctness.
References
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked early draft at accepted/0000-topological-sort.md and compare it with the issue's package.json and command-line examples. Clarify the proposed sorting algorithm, dependency categories, and command behavior; done means the RFC has an agreed, implementable specification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100