Skip to content

Commit

Permalink
Docker route detection (#820)
Browse files Browse the repository at this point in the history
* also consider full path when detecting routes

* fix support for building in a dockerfile

* clean up logs

* changeset

* remove log

* simplify default value
  • Loading branch information
AlecAivazis committed Jan 15, 2023
1 parent 84ca347 commit c595749
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-spiders-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'houdini-svelte': patch
---

Fix build issue with docker
1 change: 0 additions & 1 deletion packages/houdini-svelte/src/plugin/codegen/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default async function svelteKitGenerator(
layoutExports,
pageExports,
}) {
// remove testing later
const relativePath = path.relative(config.routesDir, dirpath)
const target = path.join(type_route_dir(config), relativePath, config.typeRootFile)

Expand Down
9 changes: 6 additions & 3 deletions packages/houdini-svelte/src/plugin/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ export function is_route(config: Config, framework: Framework, filepath: string)
return false
}

// only consider filepaths in src/routes
if (!filepath.startsWith(config.routesDir)) {
if (
!filepath.startsWith(config.routesDir) &&
!filepath.startsWith(path.join(config.projectRoot, config.routesDir))
) {
return false
}

Expand Down Expand Up @@ -264,11 +266,12 @@ export async function walk_routes(
const relative_path_regex = /src(.*)/

// here we define the location of the correspoding sveltekit type file
const local = dirpath.replace(config.projectRoot, '')
const svelteTypeFilePath = path.join(
config.projectRoot,
'.svelte-kit',
'types',
dirpath.match(relative_path_regex)?.[0] ?? '',
local.match(relative_path_regex)?.[0] ?? '',
'$types.d.ts'
)

Expand Down

2 comments on commit c595749

@vercel
Copy link

@vercel vercel bot commented on c595749 Jan 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on c595749 Jan 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.