Skip to content

Commit

Permalink
fix: sort include order so @root is always first, then semantic pac…
Browse files Browse the repository at this point in the history
…kages and then extra packages
  • Loading branch information
lowlighter committed Jul 2, 2024
1 parent f59fe85 commit 69fa7b3
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions app/build/css.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Imports
import { expandGlob } from "jsr:@std/[email protected]"
import { fromFileUrl } from "jsr:@std/[email protected]"
import { basename, dirname, fromFileUrl } from "jsr:@std/[email protected]"
import { bundle } from "jsr:@libs/bundle@5/css"
import { root as _root } from "./root.ts"
import { version } from "./version.ts"
Expand Down Expand Up @@ -38,7 +38,25 @@ export async function css({ only = [] as string[], exclude = ["@istanbul-coverag
return only.includes(name)
})
}
files.sort((a, b) => a.path.localeCompare(b.path))
files.sort((A, B) => {
const a = basename(dirname(A.path))
const b = basename(dirname(B.path))
if (a === "@root") {
return -1
}
if (b === "@root") {
return 1
}
if ((a.startsWith("@")) && (b.startsWith("@"))) {
return a.localeCompare(b)
} else if (a.startsWith("@")) {
return 1
} else if (b.startsWith("@")) {
return -1
}
return 0
})
console.log(files)
for (const { path } of files) {
css += await Deno.readTextFile(path)
}
Expand Down

0 comments on commit 69fa7b3

Please sign in to comment.