11import { readdir , readFile , writeFile } from "node:fs/promises" ;
22import { join } from "node:path" ;
33import type { Command , CommandContext } from "ucmd" ;
4- import type { PackageJson } from "@npm/types" ;
4+ import type { PackageJSON } from "@npm/types" ;
55
66export const mdtableCommandOptions = {
77 name : "mdtable" ,
@@ -25,6 +25,7 @@ type Row = {
2525
2626type Table = Row [ ] ;
2727
28+ // biome-ignore lint/suspicious/noExplicitAny: this is required to satisfy the type
2829const html = ( strings : TemplateStringsArray , ...values : any [ ] ) => {
2930 return (
3031 strings
@@ -80,19 +81,25 @@ const createTable = (table: Table) => {
8081const notEmpty = < TValue > ( value : TValue | null | undefined ) : value is TValue =>
8182 value !== null && value !== undefined ;
8283
83- export const mdtableCommand = async ( { args } : CommandContext < typeof mdtableCommandOptions > ) => {
84+ export const mdtableCommand = async ( {
85+ args,
86+ } : CommandContext < typeof mdtableCommandOptions > ) => {
8487 const packages = await readdir ( join ( process . cwd ( ) , "packages" ) ) ;
8588 const table : Table = (
8689 await Promise . all (
8790 packages . map ( async ( pkg ) => {
88- const pkgJson : PackageJson = JSON . parse (
89- await readFile ( join ( process . cwd ( ) , "packages" , pkg , "package.json" ) , "utf8" ) ,
91+ const pkgJson : PackageJSON = JSON . parse (
92+ await readFile (
93+ join ( process . cwd ( ) , "packages" , pkg , "package.json" ) ,
94+ "utf8" ,
95+ ) ,
9096 ) ;
9197
9298 if ( pkgJson . private ) return null ;
9399
94100 let support : Row [ "support" ] = "stable" ;
95101
102+ // biome-ignore lint/suspicious/noExplicitAny: needed to access the support field
96103 const supportOverride = ( pkgJson as any ) . support as Row [ "support" ] ;
97104 if ( supportOverride ) {
98105 support = supportOverride ;
@@ -120,18 +127,18 @@ export const mdtableCommand = async ({ args }: CommandContext<typeof mdtableComm
120127 a . support === b . support
121128 ? a . name . localeCompare ( b . name )
122129 : a . support === "stable"
123- ? - 1
124- : b . support === "stable"
125- ? 1
126- : a . support === "unstable"
127- ? - 1
128- : b . support === "unstable"
129- ? 1
130- : a . support === "preview"
131- ? - 1
132- : b . support === "preview"
133- ? 1
134- : 0 ,
130+ ? - 1
131+ : b . support === "stable"
132+ ? 1
133+ : a . support === "unstable"
134+ ? - 1
135+ : b . support === "unstable"
136+ ? 1
137+ : a . support === "preview"
138+ ? - 1
139+ : b . support === "preview"
140+ ? 1
141+ : 0 ,
135142 ) ;
136143
137144 const code = createTable ( table ) ;
0 commit comments