doxla 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doxla",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "Improve documentation discoverability within repos",
5
5
  "type": "module",
6
6
  "bin": {
@@ -103,9 +103,17 @@ function TreeItem({
103
103
  export function FileTree({ docs }: { docs: DocFile[] }) {
104
104
  const tree = buildTree(docs);
105
105
 
106
+ const sortedRoots = Array.from(tree.children.values()).sort((a, b) => {
107
+ const aIsFolder = a.children.size > 0 && !a.doc;
108
+ const bIsFolder = b.children.size > 0 && !b.doc;
109
+ if (aIsFolder && !bIsFolder) return -1;
110
+ if (!aIsFolder && bIsFolder) return 1;
111
+ return a.name.localeCompare(b.name);
112
+ });
113
+
106
114
  return (
107
115
  <nav className="space-y-0.5">
108
- {Array.from(tree.children.values()).map((node) => (
116
+ {sortedRoots.map((node) => (
109
117
  <TreeItem key={node.path} node={node} depth={0} />
110
118
  ))}
111
119
  </nav>