124
124
* @typedef RawProject
125
125
* @property {string | undefined } default
126
126
* @property {string } description
127
+ * @property {boolean } hasPackages
127
128
* @property {number } issueClosed
128
129
* @property {number } issueOpen
129
130
* @property {Array<string> } manifests
@@ -225,6 +226,10 @@ await fs.writeFile(
225
226
226
227
const projects = results . map ( ( d ) => d . project )
227
228
229
+ const packages = await findPackages ( projects )
230
+
231
+ const projectsWithPackages = projects . filter ( ( d ) => d . hasPackages )
232
+
228
233
await fs . writeFile (
229
234
new URL ( '../data/projects.js' , import . meta. url ) ,
230
235
[
@@ -245,7 +250,7 @@ await fs.writeFile(
245
250
'/** @type {ReadonlyArray<Project>} */' ,
246
251
'export const projects = ' +
247
252
JSON . stringify (
248
- projects . map ( function ( d ) {
253
+ projectsWithPackages . map ( function ( d ) {
249
254
return {
250
255
description : d . description ,
251
256
repo : d . repo ,
@@ -261,12 +266,12 @@ await fs.writeFile(
261
266
] . join ( '\n' )
262
267
)
263
268
264
- console . info ( '✓ done (%d projects)' , projects . length )
269
+ console . info ( '✓ done (%d projects)' , projectsWithPackages . length )
265
270
266
271
const meta = { size : 0 , issueOpen : 0 , issueClosed : 0 , prOpen : 0 , prClosed : 0 }
267
272
const metaKeys = /** @type {Array<keyof typeof meta> } */ ( Object . keys ( meta ) )
268
273
269
- for ( const d of projects ) {
274
+ for ( const d of projectsWithPackages ) {
270
275
const [ owner ] = d . repo . split ( '/' )
271
276
272
277
if ( constantCollective . includes ( owner ) ) {
@@ -282,8 +287,6 @@ await fs.writeFile(
282
287
'export const meta = ' + JSON . stringify ( meta , undefined , 2 ) + '\n'
283
288
)
284
289
285
- const packages = await findPackages ( projects )
286
-
287
290
await fs . writeFile (
288
291
new URL ( '../data/packages.js' , import . meta. url ) ,
289
292
[
@@ -339,6 +342,7 @@ async function findPackages(projects) {
339
342
getSize ( packageInfo . name )
340
343
] )
341
344
if ( ! readme ) return
345
+ project . hasPackages = true
342
346
343
347
const readmeName =
344
348
packageInfo . name . replace ( / ^ @ / g, '' ) . replace ( / \/ / g, '-' ) + '.md'
@@ -620,6 +624,7 @@ async function crawlRepo(repo) {
620
624
project : {
621
625
default : defaultBranch ,
622
626
description : repository . description || '' ,
627
+ hasPackages : false ,
623
628
issueClosed : repository . issueClosed ?. totalCount || 0 ,
624
629
issueOpen : repository . issueOpen ?. totalCount || 0 ,
625
630
manifests : ( repository . dependencyGraphManifests ?. nodes || [ ] )
0 commit comments