Skip to content

Commit d10ea5a

Browse files
authored
fix: remove unnecessary config property in init script (#2915)
From what I can see, `fsRoutes` uses the `FreshConfig.root` option by default, so this property does not need to be specified. I also added some JSDoc for the `dir` option in `fsRoutes()` as I understood it's purpose.
1 parent a235961 commit d10ea5a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

init/src/init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ ${GRADIENT_CSS}`;
403403
import { define, type State } from "./utils.ts";
404404
405405
export const app = new App<State>();
406+
406407
app.use(staticFiles());
407408
408409
// this is the same as the /api/:name route defined via a file. feel free to delete this!
@@ -421,7 +422,6 @@ const exampleLoggerMiddleware = define.middleware((ctx) => {
421422
app.use(exampleLoggerMiddleware);
422423
423424
await fsRoutes(app, {
424-
dir: "./",
425425
loadIsland: (path) => import(\`./islands/\${path}\`),
426426
loadRoute: (path) => import(\`./routes/\${path}\`),
427427
});

src/plugins/fs_routes/mod.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ function isFreshFile<State>(mod: any): mod is FreshFsItem<State> {
4747
}
4848

4949
export interface FsRoutesOptions {
50+
/**
51+
* Parent directory for the `/routes` and `/islands` folders.
52+
*
53+
* By default, the `root` config option of the provided app is used.
54+
* @default app.config.root
55+
*/
5056
dir?: string;
5157
ignoreFilePattern?: RegExp[];
5258
loadRoute: (path: string) => Promise<unknown>;

0 commit comments

Comments
 (0)