forked from conwnet/github1s
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollections.ts
More file actions
51 lines (47 loc) · 1.12 KB
/
Copy pathcollections.ts
File metadata and controls
51 lines (47 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import type { DiscoveryCollection } from './types.ts';
export const REPOSITORIES_PER_COLLECTION = 100;
// Curated coverage for the homepage, rather than a ranking of topic popularity.
export const TOPICS = [
'developer-tools',
'machine-learning',
'llm',
'web-development',
'database',
'devops',
'security',
'cli',
'compiler',
'game-development',
];
export type CollectionDefinition = Pick<DiscoveryCollection, 'id' | 'kind' | 'query' | 'sort'>;
export const getCollections = (now: Date): CollectionDefinition[] => {
const dateBefore = (days: number) => new Date(now.getTime() - days * 86400000).toISOString().slice(0, 10);
return [
{
id: 'new-projects',
kind: 'curated',
query: `created:>=${dateBefore(30)} stars:>=20`,
sort: 'stars',
},
{
id: 'hidden-gems',
kind: 'curated',
query: `stars:50..999 pushed:>=${dateBefore(90)}`,
sort: 'updated',
},
{
id: 'most-starred',
kind: 'curated',
query: 'stars:>=10000',
sort: 'stars',
},
...TOPICS.map(
(id): CollectionDefinition => ({
id,
kind: 'topic',
query: `topic:${id} stars:>=100`,
sort: 'stars',
}),
),
];
};