@@ -19,20 +19,11 @@ const getFiles = async (): Promise<{
1919 return {
2020 scripts : await Array . fromAsync (
2121 new Glob (
22- path . resolve (
23- import . meta. dirname ,
24- ".." ,
25- "src" ,
26- "userscripts" ,
27- "*" ,
28- "index.user.ts" ,
29- ) ,
22+ path . resolve ( import . meta. dirname , ".." , "src" , "userscripts" , "*" , "index.user.ts" ) ,
3023 ) . scan ( ) ,
3124 ) ,
3225 styles : await Array . fromAsync (
33- new Glob (
34- path . resolve ( import . meta. dirname , ".." , "src" , "*.user.css" ) ,
35- ) . scan ( ) ,
26+ new Glob ( path . resolve ( import . meta. dirname , ".." , "src" , "*.user.css" ) ) . scan ( ) ,
3627 ) ,
3728 } ;
3829 } catch ( err ) {
@@ -50,31 +41,21 @@ const parseUserStyleComment = async ({
5041 const file = await readFile ( filepath ) ;
5142 const lines = file . toString ( ) . split ( "\n" ) ;
5243
53- if (
54- lines . length === 0 ||
55- lines . some ( ( line ) => line . includes ( "docgen-ignore" ) )
56- )
57- return null ;
44+ if ( lines . length === 0 || lines . some ( ( line ) => line . includes ( "docgen-ignore" ) ) ) return null ;
5845
5946 const commentPrefix = {
6047 title : "@name" ,
6148 description : "@description" ,
6249 } ;
6350
64- const titleLine = lines . find ( ( line ) =>
65- line . startsWith ( commentPrefix . title ) ,
66- ) ;
67- const descriptionLine = lines . find ( ( line ) =>
68- line . startsWith ( commentPrefix . description ) ,
69- ) ;
51+ const titleLine = lines . find ( ( line ) => line . startsWith ( commentPrefix . title ) ) ;
52+ const descriptionLine = lines . find ( ( line ) => line . startsWith ( commentPrefix . description ) ) ;
7053
7154 if ( titleLine === undefined ) return null ;
7255 return {
7356 filename : path . basename ( filepath ) ,
7457 title : titleLine . slice ( commentPrefix . title . length ) . trim ( ) ,
75- description : descriptionLine
76- ?. slice ( commentPrefix . description . length )
77- . trim ( ) ,
58+ description : descriptionLine ?. slice ( commentPrefix . description . length ) . trim ( ) ,
7859 } ;
7960 } catch ( err ) {
8061 console . error ( err ) ;
@@ -89,11 +70,7 @@ const userscriptSourceSchema = v.object({
8970 } ) ,
9071} ) ;
9172
92- const getUserScriptProperties = async ( {
93- files,
94- } : {
95- files : string [ ] ;
96- } ) : Promise < FileProperties [ ] > =>
73+ const getUserScriptProperties = async ( { files } : { files : string [ ] } ) : Promise < FileProperties [ ] > =>
9774 (
9875 await Promise . all (
9976 files . map ( async ( filepath ) => {
@@ -112,11 +89,7 @@ const getUserScriptProperties = async ({
11289 . filter ( ( s ) => s !== undefined )
11390 . sort ( ( a , b ) => ( a . title . toLowerCase ( ) > b . title . toLowerCase ( ) ? 1 : - 1 ) ) ;
11491
115- const getUserStyleProperties = async ( {
116- files,
117- } : {
118- files : string [ ] ;
119- } ) : Promise < FileProperties [ ] > =>
92+ const getUserStyleProperties = async ( { files } : { files : string [ ] } ) : Promise < FileProperties [ ] > =>
12093 (
12194 await Promise . all (
12295 files . map ( async ( file ) => {
@@ -147,10 +120,7 @@ const updateReadme = async (scriptsMarkdown: string): Promise<void> => {
147120 if ( ! readme ) return ;
148121
149122 const readmeKeyword = "<!-- docgen -->" ;
150- const readmeCommonPart = readme . slice (
151- 0 ,
152- readme . indexOf ( readmeKeyword ) + readmeKeyword . length ,
153- ) ;
123+ const readmeCommonPart = readme . slice ( 0 , readme . indexOf ( readmeKeyword ) + readmeKeyword . length ) ;
154124
155125 const updatedReadme = `${ readmeCommonPart } \n\n${ scriptsMarkdown } ` ;
156126 await writeFile ( path . resolve ( "README.md" ) , updatedReadme ) ;
@@ -176,9 +146,7 @@ void (async () => {
176146 )
177147 . join ( "\n\n" ) ;
178148 const stylesMarkdown = styleFileProperties
179- . map ( ( fileProperties ) =>
180- generateMdFileEntry ( { ...fileProperties , fileKind : "style" } ) ,
181- )
149+ . map ( ( fileProperties ) => generateMdFileEntry ( { ...fileProperties , fileKind : "style" } ) )
182150 . join ( "\n\n" ) ;
183151
184152 const joinedMarkdown = [
0 commit comments