htmlhost-cli 2.2.0 → 2.2.1

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": "htmlhost-cli",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Deploy HTML files from the terminal — htmlhost.co CLI",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.mjs CHANGED
@@ -4,7 +4,7 @@
4
4
  import { bold, dim, cyan, err } from "./ui.mjs";
5
5
  import { ApiError } from "./api.mjs";
6
6
 
7
- const VERSION = "2.2.0";
7
+ const VERSION = "2.2.1";
8
8
 
9
9
  const HELP = `
10
10
  ${bold("htmlhost")} ${dim(`v${VERSION}`)} — deploy HTML from the terminal
@@ -609,12 +609,17 @@ function findAllFiles(baseDir, currentDir) {
609
609
  }
610
610
  }
611
611
 
612
- // Sort: index.html first, then HTML files, then others alphabetically
612
+ // Sort: root index.html first, then any nested index.html, then HTML files, then others alphabetically
613
613
  results.sort((a, b) => {
614
- const aIsIndex = a.relativePath === "index.html";
615
- const bIsIndex = b.relativePath === "index.html";
616
- if (aIsIndex) return -1;
617
- if (bIsIndex) return 1;
614
+ const aIsRootIndex = a.relativePath === "index.html";
615
+ const bIsRootIndex = b.relativePath === "index.html";
616
+ if (aIsRootIndex) return -1;
617
+ if (bIsRootIndex) return 1;
618
+
619
+ const aIsIndex = basename(a.relativePath) === "index.html";
620
+ const bIsIndex = basename(b.relativePath) === "index.html";
621
+ if (aIsIndex && !bIsIndex) return -1;
622
+ if (!aIsIndex && bIsIndex) return 1;
618
623
 
619
624
  const aIsHtml = a.relativePath.endsWith(".html");
620
625
  const bIsHtml = b.relativePath.endsWith(".html");