Skip to content

Commit 3ac01f8

Browse files
ci: apply automated fixes
1 parent 93a63f5 commit 3ac01f8

33 files changed

Lines changed: 330 additions & 265 deletions

netlify/functions/scheduled/refresh-stats-cache.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ export const handler: Handler = async (
2929
// Invoke the background function
3030
const functionUrl = `${process.env.URL}/.netlify/functions/refresh-stats-cache-background`
3131

32-
console.log('[refresh-stats-cache] Invoking background function:', functionUrl)
32+
console.log(
33+
'[refresh-stats-cache] Invoking background function:',
34+
functionUrl
35+
)
3336

3437
// Fire and forget - background function will run independently
3538
const response = await fetch(functionUrl, {
3639
method: 'POST',
3740
headers: {
3841
'Content-Type': 'application/json',
39-
'Authorization': `Bearer ${cronSecret}`,
42+
Authorization: `Bearer ${cronSecret}`,
4043
},
4144
body: JSON.stringify({
4245
source: 'scheduled-function',
@@ -46,10 +49,14 @@ export const handler: Handler = async (
4649

4750
if (!response.ok) {
4851
const errorText = await response.text()
49-
throw new Error(`Background function invocation failed: ${response.status} - ${errorText}`)
52+
throw new Error(
53+
`Background function invocation failed: ${response.status} - ${errorText}`
54+
)
5055
}
5156

52-
console.log('[refresh-stats-cache] Background function invoked successfully')
57+
console.log(
58+
'[refresh-stats-cache] Background function invoked successfully'
59+
)
5360

5461
return {
5562
statusCode: 202, // Accepted - processing in background

netlify/functions/scheduled/sync-github-releases.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export const handler: Handler = async (
1818
event: HandlerEvent,
1919
context: HandlerContext
2020
) => {
21-
console.log('[sync-github-releases] Triggering background GitHub release sync...')
21+
console.log(
22+
'[sync-github-releases] Triggering background GitHub release sync...'
23+
)
2224

2325
try {
2426
const cronSecret = process.env.CRON_SECRET
@@ -29,14 +31,17 @@ export const handler: Handler = async (
2931
// Invoke the background function
3032
const functionUrl = `${process.env.URL}/.netlify/functions/sync-github-releases-background`
3133

32-
console.log('[sync-github-releases] Invoking background function:', functionUrl)
34+
console.log(
35+
'[sync-github-releases] Invoking background function:',
36+
functionUrl
37+
)
3338

3439
// Fire and forget - background function will run independently
3540
const response = await fetch(functionUrl, {
3641
method: 'POST',
3742
headers: {
3843
'Content-Type': 'application/json',
39-
'Authorization': `Bearer ${cronSecret}`,
44+
Authorization: `Bearer ${cronSecret}`,
4045
},
4146
body: JSON.stringify({
4247
source: 'scheduled-function',
@@ -46,10 +51,14 @@ export const handler: Handler = async (
4651

4752
if (!response.ok) {
4853
const errorText = await response.text()
49-
throw new Error(`Background function invocation failed: ${response.status} - ${errorText}`)
54+
throw new Error(
55+
`Background function invocation failed: ${response.status} - ${errorText}`
56+
)
5057
}
5158

52-
console.log('[sync-github-releases] Background function invoked successfully')
59+
console.log(
60+
'[sync-github-releases] Background function invoked successfully'
61+
)
5362

5463
return {
5564
statusCode: 202, // Accepted - processing in background

netlify/functions/sync-github-releases-background.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ export const handler: Handler = async (
2424
event: HandlerEvent,
2525
context: HandlerContext
2626
) => {
27-
console.log('[sync-github-releases-background] Starting GitHub release sync...')
27+
console.log(
28+
'[sync-github-releases-background] Starting GitHub release sync...'
29+
)
2830

2931
// Check authentication
3032
const cronSecret = process.env.CRON_SECRET
3133
const authHeader = event.headers.authorization || event.headers.Authorization
3234

3335
if (!cronSecret) {
34-
console.error('[sync-github-releases-background] CRON_SECRET not configured')
36+
console.error(
37+
'[sync-github-releases-background] CRON_SECRET not configured'
38+
)
3539
return {
3640
statusCode: 500,
3741
body: JSON.stringify({

scripts/migrate-data.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This guide covers migrating data from Convex to PostgreSQL (Neon DB).
77
## Prerequisites
88

99
1. **Export Convex Data**
10+
1011
- Use Convex dashboard or CLI to export all tables
1112
- Export format: JSON or CSV
1213
- Tables to export:
@@ -31,15 +32,18 @@ This guide covers migrating data from Convex to PostgreSQL (Neon DB).
3132
Create a transformation script that:
3233

3334
1. **Convert Convex IDs to UUIDs**
35+
3436
- Generate new UUIDs for each record
3537
- Maintain mapping for foreign key relationships
3638

3739
2. **Transform Timestamps**
40+
3841
- Convex: milliseconds (number)
3942
- PostgreSQL: `timestamp with time zone` (Date object)
4043
- Convert: `new Date(timestamp)` for milliseconds
4144

4245
3. **Transform Arrays**
46+
4347
- Convex: stored as arrays
4448
- PostgreSQL: array columns (already compatible)
4549
- Ensure proper formatting
@@ -101,17 +105,19 @@ WHERE u.id IS NULL;
101105
### Step 4: Post-Migration Tasks
102106

103107
1. **Set up indexes** (if not created by Drizzle):
108+
104109
```sql
105110
-- GIN indexes for array columns
106-
CREATE INDEX IF NOT EXISTS feed_entries_library_ids_gin_idx
111+
CREATE INDEX IF NOT EXISTS feed_entries_library_ids_gin_idx
107112
ON feed_entries USING GIN (library_ids);
108-
CREATE INDEX IF NOT EXISTS feed_entries_tags_gin_idx
113+
CREATE INDEX IF NOT EXISTS feed_entries_tags_gin_idx
109114
ON feed_entries USING GIN (tags);
110-
115+
111116
-- Full-text search (see drizzle/migrations/README.md)
112117
```
113118

114119
2. **Verify functionality**:
120+
115121
- Test authentication flow
116122
- Test feed queries
117123
- Test admin interfaces
@@ -138,4 +144,3 @@ If migration fails:
138144
- **entryId field**: The `feed_entries` table uses `entryId` (string) as the unique identifier, not `id` (UUID). Make sure to map Convex feed entry IDs to `entryId` field.
139145
- **Metadata**: JSONB fields should be preserved as-is from Convex
140146
- **Capabilities**: Array fields should be preserved as arrays
141-

scripts/test-db-connection.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,15 @@ async function testConnection() {
3333

3434
// Test 3: Count records
3535
console.log('3. Counting records...')
36-
const userCount = await db.select({ count: sql<number>`count(*)` }).from(users)
37-
const roleCount = await db.select({ count: sql<number>`count(*)` }).from(roles)
38-
const feedCount = await db.select({ count: sql<number>`count(*)` }).from(feedEntries)
36+
const userCount = await db
37+
.select({ count: sql<number>`count(*)` })
38+
.from(users)
39+
const roleCount = await db
40+
.select({ count: sql<number>`count(*)` })
41+
.from(roles)
42+
const feedCount = await db
43+
.select({ count: sql<number>`count(*)` })
44+
.from(feedEntries)
3945

4046
console.log(`✓ Users: ${userCount[0]?.count ?? 0}`)
4147
console.log(`✓ Roles: ${roleCount[0]?.count ?? 0}`)
@@ -57,4 +63,3 @@ async function testConnection() {
5763
}
5864

5965
testConnection()
60-

src/components/FeedEntry.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export function FeedEntry({
253253
className="text-xs font-semibold text-gray-900 dark:text-gray-100 truncate hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
254254
>
255255
{entry.title}
256-
</Link>
256+
</Link>
257257
</TableCell>
258258

259259
{/* Excerpt */}

src/components/FeedFilters.tsx

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ export function FeedFilters({
206206
releaseLevelsDiffer ||
207207
(includePrerelease !== undefined && includePrerelease !== true)
208208

209-
210209
// Render filter content (shared between mobile and desktop)
211210
const renderFilterContent = () => (
212211
<>
@@ -216,9 +215,7 @@ export function FeedFilters({
216215
<FilterCheckbox
217216
label="Featured"
218217
checked={featured ?? false}
219-
onChange={() =>
220-
handleFeaturedChange(featured ? undefined : true)
221-
}
218+
onChange={() => handleFeaturedChange(featured ? undefined : true)}
222219
count={facetCounts?.featured}
223220
/>
224221
</div>
@@ -234,9 +231,7 @@ export function FeedFilters({
234231
onSelectNone={() => {
235232
onFiltersChange({ releaseLevels: undefined })
236233
}}
237-
isAllSelected={
238-
selectedReleaseLevels?.length === RELEASE_LEVELS.length
239-
}
234+
isAllSelected={selectedReleaseLevels?.length === RELEASE_LEVELS.length}
240235
isSomeSelected={
241236
selectedReleaseLevels !== undefined &&
242237
selectedReleaseLevels.length > 0 &&
@@ -452,10 +447,7 @@ export function FeedFilters({
452447
compact
453448
/>
454449
)}
455-
<div
456-
onClick={(e) => e.stopPropagation()}
457-
className="flex-shrink-0"
458-
>
450+
<div onClick={(e) => e.stopPropagation()} className="flex-shrink-0">
459451
<FilterSearch
460452
value={searchInput}
461453
onChange={handleSearchChange}
@@ -482,10 +474,7 @@ export function FeedFilters({
482474
>
483475
<LuHelpCircle className="w-4 h-4 text-gray-400 dark:text-gray-500 cursor-help" />
484476
</Tooltip>
485-
<ViewModeToggle
486-
viewMode={viewMode}
487-
onViewModeChange={onViewModeChange}
488-
/>
477+
<ViewModeToggle viewMode={viewMode} onViewModeChange={onViewModeChange} />
489478
</div>
490479
)
491480

@@ -498,8 +487,16 @@ export function FeedFilters({
498487
desktopHeader={desktopHeader}
499488
>
500489
{/* Search - Desktop */}
501-
<div className={`mb-2 lg:block hidden ${viewMode === 'table' ? 'max-w-xs lg:max-w-none lg:w-full' : 'w-full'}`}>
502-
<FilterSearch value={searchInput} onChange={handleSearchChange} className="w-full" />
490+
<div
491+
className={`mb-2 lg:block hidden ${
492+
viewMode === 'table' ? 'max-w-xs lg:max-w-none lg:w-full' : 'w-full'
493+
}`}
494+
>
495+
<FilterSearch
496+
value={searchInput}
497+
onChange={handleSearchChange}
498+
className="w-full"
499+
/>
503500
</div>
504501

505502
{renderFilterContent()}

src/components/FrameworkSelect.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ import * as React from 'react'
22
import { create } from 'zustand'
33
import { useNavigate, useParams } from '@tanstack/react-router'
44
import { Select } from './Select'
5-
import {
6-
Framework,
7-
getLibrary,
8-
LibraryId,
9-
} from '~/libraries'
5+
import { Framework, getLibrary, LibraryId } from '~/libraries'
106
import { getFrameworkOptions } from '~/libraries/frameworks'
117

128
export function FrameworkSelect({ libraryId }: { libraryId: LibraryId }) {

src/components/OpenSourceStats.tsx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ function OssStatsContent({ library }: { library?: Library }) {
9090
const hasContributorCount = isValidMetric(contributorCount)
9191
const hasDependentCount = isValidMetric(dependentCount)
9292

93-
const hasAnyData = hasNpmDownloads || hasStarCount || hasContributorCount || hasDependentCount
93+
const hasAnyData =
94+
hasNpmDownloads || hasStarCount || hasContributorCount || hasDependentCount
9495

9596
return (
9697
<div>
@@ -104,8 +105,9 @@ function OssStatsContent({ library }: { library?: Library }) {
104105
<div className="inline-flex items-center gap-2 px-4 py-2 rounded-full bg-gradient-to-r from-pink-500/10 to-purple-500/10 border border-pink-500/20 dark:border-pink-500/30 backdrop-blur-sm pointer-events-auto">
105106
<span className="text-2xl">🚀</span>
106107
<p className="text-sm font-medium text-pink-600 dark:text-pink-400">
107-
<span className="font-bold">Fresh out of the oven!</span> This library just launched.
108-
Be among the first to star, download, and contribute!
108+
<span className="font-bold">Fresh out of the oven!</span> This
109+
library just launched. Be among the first to star, download, and
110+
contribute!
109111
</p>
110112
</div>
111113
</div>
@@ -114,7 +116,9 @@ function OssStatsContent({ library }: { library?: Library }) {
114116
href="https://www.npmjs.com/org/tanstack"
115117
target="_blank"
116118
rel="noreferrer"
117-
className={`group flex gap-4 items-center ${!hasNpmDownloads ? 'opacity-50' : ''} ${!hasAnyData ? 'blur-sm' : ''}`}
119+
className={`group flex gap-4 items-center ${
120+
!hasNpmDownloads ? 'opacity-50' : ''
121+
} ${!hasAnyData ? 'blur-sm' : ''}`}
118122
>
119123
<FaDownload className="text-2xl group-hover:text-emerald-500 transition-colors duration-200" />
120124
<div>
@@ -138,17 +142,15 @@ function OssStatsContent({ library }: { library?: Library }) {
138142
}
139143
target="_blank"
140144
rel="noreferrer"
141-
className={`group flex gap-4 items-center ${!hasStarCount ? 'opacity-50' : ''} ${!hasAnyData ? 'blur-sm' : ''}`}
145+
className={`group flex gap-4 items-center ${
146+
!hasStarCount ? 'opacity-50' : ''
147+
} ${!hasAnyData ? 'blur-sm' : ''}`}
142148
>
143149
<FaStar className="group-hover:text-yellow-500 text-2xl transition-colors duration-200" />
144150
<div>
145151
<div className="text-2xl font-bold opacity-80 leading-none group-hover:text-yellow-500 transition-colors duration-200 relative">
146152
{hasStarCount ? (
147-
<NumberFlow
148-
value={starCount}
149-
continuous
150-
willChange
151-
/>
153+
<NumberFlow value={starCount} continuous willChange />
152154
) : (
153155
<span>0</span>
154156
)}
@@ -158,16 +160,16 @@ function OssStatsContent({ library }: { library?: Library }) {
158160
</div>
159161
</div>
160162
</a>
161-
<div className={`flex gap-4 items-center ${!hasContributorCount ? 'opacity-50' : ''} ${!hasAnyData ? 'blur-sm' : ''}`}>
163+
<div
164+
className={`flex gap-4 items-center ${
165+
!hasContributorCount ? 'opacity-50' : ''
166+
} ${!hasAnyData ? 'blur-sm' : ''}`}
167+
>
162168
<FaUsers className="text-2xl" />
163169
<div className="">
164170
<div className="text-2xl font-bold opacity-80 relative">
165171
{hasContributorCount ? (
166-
<NumberFlow
167-
value={contributorCount}
168-
continuous
169-
willChange
170-
/>
172+
<NumberFlow value={contributorCount} continuous willChange />
171173
) : (
172174
<span>0</span>
173175
)}
@@ -177,16 +179,16 @@ function OssStatsContent({ library }: { library?: Library }) {
177179
</div>
178180
</div>
179181
</div>
180-
<div className={`flex gap-4 items-center ${!hasDependentCount ? 'opacity-50' : ''} ${!hasAnyData ? 'blur-sm' : ''}`}>
182+
<div
183+
className={`flex gap-4 items-center ${
184+
!hasDependentCount ? 'opacity-50' : ''
185+
} ${!hasAnyData ? 'blur-sm' : ''}`}
186+
>
181187
<FaCube className="text-2xl" />
182188
<div className="">
183189
<div className="text-2xl font-bold opacity-80 relative">
184190
{hasDependentCount ? (
185-
<NumberFlow
186-
value={dependentCount}
187-
continuous
188-
willChange
189-
/>
191+
<NumberFlow value={dependentCount} continuous willChange />
190192
) : (
191193
<span>0</span>
192194
)}

0 commit comments

Comments
 (0)