Skip to content

Commit 746b2f9

Browse files
committed
chore: cleanup 🧹
1 parent 05dea95 commit 746b2f9

6 files changed

Lines changed: 32 additions & 24 deletions

File tree

example/epicshop/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/workshop-app/app/components/file-app-explorer.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ function SiblingEntryList({
142142
}) {
143143
if (entries.length === 0) {
144144
return (
145-
<p className="text-muted-foreground px-3 py-2 text-xs">No files available.</p>
145+
<p className="text-muted-foreground px-3 py-2 text-xs">
146+
No files available.
147+
</p>
146148
)
147149
}
148150
return (
@@ -166,7 +168,9 @@ function SiblingEntryList({
166168
name="Files"
167169
className={cn(
168170
'size-3.5 shrink-0',
169-
entry.isDirectory ? 'text-muted-foreground' : 'text-foreground/80',
171+
entry.isDirectory
172+
? 'text-muted-foreground'
173+
: 'text-foreground/80',
170174
)}
171175
aria-hidden
172176
/>
@@ -241,7 +245,9 @@ function FileContent({
241245

242246
if (errorMessage) {
243247
return (
244-
<div className="text-foreground-destructive p-4 text-sm">{errorMessage}</div>
248+
<div className="text-foreground-destructive p-4 text-sm">
249+
{errorMessage}
250+
</div>
245251
)
246252
}
247253

@@ -272,7 +278,7 @@ function FileContent({
272278
<img
273279
src={fileUrl}
274280
alt={file.path}
275-
className="max-h-full max-w-full rounded border border-border object-contain"
281+
className="border-border max-h-full max-w-full rounded border object-contain"
276282
/>
277283
</div>
278284
)
@@ -284,7 +290,7 @@ function FileContent({
284290
<video
285291
src={fileUrl}
286292
controls
287-
className="bg-background max-h-full max-w-full rounded border border-border"
293+
className="bg-background border-border max-h-full max-w-full rounded border"
288294
/>
289295
</div>
290296
)
@@ -346,7 +352,7 @@ export function FileAppExplorer({ appName }: { appName: string }) {
346352

347353
const indexes = React.useMemo(() => buildIndexes(files), [files])
348354
const selectedFile = selectedPath
349-
? indexes.filesByPath.get(selectedPath) ?? null
355+
? (indexes.filesByPath.get(selectedPath) ?? null)
350356
: null
351357
const breadcrumbs = React.useMemo(
352358
() => getBreadcrumbParts(selectedPath),
@@ -355,7 +361,9 @@ export function FileAppExplorer({ appName }: { appName: string }) {
355361
const filteredFiles = React.useMemo(() => {
356362
const normalizedQuery = fileQuery.trim().toLowerCase()
357363
if (!normalizedQuery) return files
358-
return files.filter((file) => file.path.toLowerCase().includes(normalizedQuery))
364+
return files.filter((file) =>
365+
file.path.toLowerCase().includes(normalizedQuery),
366+
)
359367
}, [fileQuery, files])
360368

361369
React.useEffect(() => {

packages/workshop-app/app/routes/_app+/app.$appName+/file-preview.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { type Route } from './+types/file-preview'
22
import path from 'node:path'
33
import { compileMarkdownString } from '@epic-web/workshop-utils/compile-mdx.server'
4-
import { makeTimings, getServerTimeHeader } from '@epic-web/workshop-utils/timing.server'
4+
import {
5+
makeTimings,
6+
getServerTimeHeader,
7+
} from '@epic-web/workshop-utils/timing.server'
58
import fsExtra from 'fs-extra'
69
import { data } from 'react-router'
710
import { z } from 'zod'
@@ -65,9 +68,8 @@ export async function loader({ request, params }: Route.LoaderArgs) {
6568
}
6669

6770
const source = await fsExtra.readFile(filePath, 'utf8')
68-
const markdown = kind === 'markdown'
69-
? source
70-
: makeFencedCodeBlock(source, language)
71+
const markdown =
72+
kind === 'markdown' ? source : makeFencedCodeBlock(source, language)
7173
const code = await compileMarkdownString(markdown)
7274

7375
return data(

packages/workshop-app/app/routes/_app+/app.$appName+/files.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { type Route } from './+types/files'
22
import path from 'node:path'
3-
import { makeTimings, getServerTimeHeader } from '@epic-web/workshop-utils/timing.server'
3+
import {
4+
makeTimings,
5+
getServerTimeHeader,
6+
} from '@epic-web/workshop-utils/timing.server'
47
import { globby } from 'globby'
58
import mimeTypes from 'mime-types'
69
import { data } from 'react-router'
@@ -157,7 +160,8 @@ export async function loader({ request, params }: Route.LoaderArgs) {
157160
const normalizedPath = file.replace(/\\/g, '/')
158161
if (path.basename(normalizedPath) === 'README.mdx') continue
159162
if (filesByPath.has(normalizedPath)) continue
160-
const mimeType = mimeTypes.lookup(normalizedPath) || 'application/octet-stream'
163+
const mimeType =
164+
mimeTypes.lookup(normalizedPath) || 'application/octet-stream'
161165
const extension = path.extname(normalizedPath).toLowerCase()
162166
filesByPath.set(normalizedPath, {
163167
path: normalizedPath,

packages/workshop-utils/src/apps-server.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ test('classifies non-index app without package.json as file dev type', async ()
6767
await using workshop = await createTempWorkshop()
6868
const fileExtraDir = path.join(workshop.root, 'extra', '01.files')
6969
await fs.mkdir(fileExtraDir, { recursive: true })
70-
await fs.writeFile(path.join(fileExtraDir, 'notes.txt'), 'hello file explorer')
70+
await fs.writeFile(
71+
path.join(fileExtraDir, 'notes.txt'),
72+
'hello file explorer',
73+
)
7174

7275
process.env.EPICSHOP_CONTEXT_CWD = workshop.root
7376
;(

0 commit comments

Comments
 (0)