Skip to content

Commit 7de22d4

Browse files
authored
small code tweaks and cleanups spotted when working on experiment (#2167)
1 parent 476d219 commit 7de22d4

5 files changed

Lines changed: 4 additions & 14 deletions

File tree

components/Library/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export default function Library({
3333
const { github } = library;
3434
const { isSmallScreen, isBelowMaxWidth } = useLayout();
3535

36-
const libName = library.npmPkg ?? github.name;
37-
const bookmarkId = library.npmPkg ?? library.github.fullName;
36+
const libName = library.npmPkg ?? github.fullName;
3837

3938
const hasSecondaryMetadata =
4039
github.license ||
@@ -54,7 +53,7 @@ export default function Library({
5453
library.unmaintained && tw`opacity-85`,
5554
]}>
5655
<BookmarkButton
57-
bookmarkId={bookmarkId}
56+
bookmarkId={libName}
5857
style={tw`absolute right-2.5 top-2.5 z-10 rounded border border-palette-gray2 p-1.5 dark:border-palette-gray6`}
5958
/>
6059
<View

pages/api/libraries/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
9191
configPlugin: parsedQuery.configPlugin,
9292
isMaintained: parsedQuery.isMaintained,
9393
isPopular: parsedQuery.isPopular,
94-
isRecommended: parsedQuery.isRecommended,
9594
wasRecentlyUpdated: parsedQuery.wasRecentlyUpdated,
9695
minPopularity: parsedQuery.minPopularity,
9796
minMonthlyDownloads: parsedQuery.minMonthlyDownloads,

scripts/build-and-score-data.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,10 @@ async function buildAndScoreData() {
9898
const fetchList: string[] = [];
9999

100100
// Filter out template entries, prepare npm-stat API chunks
101-
data = data.map(project => {
101+
data.forEach(project => {
102102
if (!project.template) {
103103
fetchList.push(project.npmPkg);
104-
return project;
105104
}
106-
return project;
107105
});
108106

109107
// Assemble and fetch packages data in bulk queries
@@ -439,7 +437,7 @@ async function fetchNpmStatDataSequentially(bulkList: string[][]) {
439437
async function fetchNpmRegistryDataSequentially(list: LibraryType[]) {
440438
const total = list.length;
441439

442-
for (let i = 0; i < list.length; i++) {
440+
for (let i = 0; i < total; i++) {
443441
const entry = list[i];
444442

445443
if (!entry || entry.template) {

types/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export type Query = {
4343
configPlugin?: string;
4444
isMaintained?: string;
4545
isPopular?: string;
46-
isRecommended?: string;
4746
wasRecentlyUpdated?: string;
4847
minPopularity?: string;
4948
minMonthlyDownloads?: string;

util/search.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export function handleFilterLibraries({
8989
configPlugin,
9090
isMaintained,
9191
isPopular,
92-
isRecommended,
9392
wasRecentlyUpdated,
9493
minPopularity,
9594
minMonthlyDownloads,
@@ -252,10 +251,6 @@ export function handleFilterLibraries({
252251
return false;
253252
}
254253

255-
if (isRecommended && !library.matchingScoreModifiers.includes('Recommended')) {
256-
return false;
257-
}
258-
259254
if (wasRecentlyUpdated && !library.matchingScoreModifiers.includes('Recently updated')) {
260255
return false;
261256
}

0 commit comments

Comments
 (0)