@@ -16,6 +16,7 @@ import { parse as parseJsonc } from 'jsonc-parser';
1616
1717const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
1818const OUTPUT = resolve ( __dirname , '../src/lib/themes/bundled.json' ) ;
19+ const OUTPUT_EXTENSIONS = resolve ( __dirname , '../src/lib/themes/bundled-extensions.json' ) ;
1920
2021/** Extensions to download from OpenVSX. */
2122const EXTENSIONS = [
@@ -124,15 +125,26 @@ async function fetchExtensionThemes(namespace, name) {
124125 }
125126
126127 console . log ( ` Found ${ themes . length } theme(s).` ) ;
127- return themes ;
128+ return {
129+ themes,
130+ extension : {
131+ name : meta . displayName ?? `${ namespace } /${ name } ` ,
132+ version : meta . version ,
133+ license : meta . license ?? null ,
134+ author : meta . publishedBy ?. loginName ?? null ,
135+ homepage : meta . homepage ?? meta . repository ?? null ,
136+ } ,
137+ } ;
128138}
129139
130140async function main ( ) {
131141 const allThemes = [ ] ;
142+ const allExtensions = [ ] ;
132143
133144 for ( const ext of EXTENSIONS ) {
134- const themes = await fetchExtensionThemes ( ext . namespace , ext . name ) ;
145+ const { themes, extension } = await fetchExtensionThemes ( ext . namespace , ext . name ) ;
135146 allThemes . push ( ...themes ) ;
147+ allExtensions . push ( extension ) ;
136148 }
137149 allThemes . sort ( ( a , b ) => {
138150 const aIndex = PREFERRED_THEME_ORDER . indexOf ( a . id ) ;
@@ -145,6 +157,9 @@ async function main() {
145157
146158 console . log ( `\nWriting ${ allThemes . length } themes to ${ OUTPUT } ` ) ;
147159 writeFileSync ( OUTPUT , JSON . stringify ( allThemes , null , 2 ) + '\n' ) ;
160+
161+ console . log ( `Writing ${ allExtensions . length } extensions to ${ OUTPUT_EXTENSIONS } ` ) ;
162+ writeFileSync ( OUTPUT_EXTENSIONS , JSON . stringify ( allExtensions , null , 2 ) + '\n' ) ;
148163 console . log ( 'Done.' ) ;
149164}
150165
0 commit comments