Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 FIX: windows path #585

Merged
merged 2 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/curvy-adults-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'houdini': patch
---

fix - windows paths correctly import things now
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"tests": "vitest",
"build": "concurrently \"npm run build:runtime\" \"npm run build:cmd\" \"npm run build:preprocess\" \"npm run build:vite\" -n \"run,cmd,pre,vit\" -c \"blue.bold,green.bold,yellow.bold,cyan.bold\" && npm run build:typeModule",
"build:runtime": "concurrently \"npm run build:runtime:esm\" \"npm run build:runtime:cjs\" -n \"esm,cjs\" -c \"green,yellow\"",
"build:runtime:cjs": "tsc --p tsconfig.runtime.cjs.json && WHICH=cjs node ./runtimeMeta",
"build:runtime:esm": "tsc --p tsconfig.runtime.esm.json && WHICH=esm node ./runtimeMeta",
"build:runtime:cjs": "tsc --p tsconfig.runtime.cjs.json && cross-env WHICH=cjs node ./runtimeMeta",
"build:runtime:esm": "tsc --p tsconfig.runtime.esm.json && cross-env WHICH=esm node ./runtimeMeta",
"build:preprocess": "concurrently \"npm run build:preprocess:esm\" \"npm run build:preprocess:cjs\" -n \"esm,cjs\" -c \"green,yellow\"",
"build:preprocess:cjs": "cross-env TARGET=cjs WHICH=preprocess rollup --config rollup.config.js",
"build:preprocess:esm": "cross-env TARGET=esm WHICH=preprocess rollup --config rollup.config.js",
Expand Down
5 changes: 4 additions & 1 deletion src/cmd/generators/kit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export default async function svelteKitGenerator(config: Config, docs: Collected
const target = path.join(config.typeRouteDir, relativePath, config.typeRootFile)

// we can't import from $houdini so we need to compute the relative path from the import
const houdiniRelative = path.relative(target, config.typeRootDir)
const houdiniRelative = path
.relative(target, config.typeRootDir)
// Windows management
.replaceAll('\\', '/')

// the unique set of query names
const queryNames: string[] = []
Expand Down
13 changes: 8 additions & 5 deletions src/cmd/generators/runtime/copyRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ async function addClientImport(config: Config) {
// the path to the network file
const networkFilePath = path.join(config.runtimeDirectory, 'lib', 'network.js')
// the relative path
const relativePath = path.relative(
path.dirname(networkFilePath),
path.join(config.projectRoot, config.client)
)
const relativePath = path
.relative(path.dirname(networkFilePath), path.join(config.projectRoot, config.client))
// Windows management
.replaceAll('\\', '/')

// read the file, replace the string, update the file
const contents = await fs.readFile(networkFilePath)
Expand All @@ -90,7 +90,10 @@ async function addConfigImport(config: Config) {
// the path to the config file
const configFilePath = path.join(config.runtimeDirectory, 'lib', 'config.js')
// the relative path
const relativePath = path.relative(path.dirname(configFilePath), config.filepath)
const relativePath = path
.relative(path.dirname(configFilePath), config.filepath)
// Windows management
.replaceAll('\\', '/')

// read the file, replace the string, update the file
const contents = await fs.readFile(configFilePath)
Expand Down
2 changes: 2 additions & 0 deletions src/cmd/generators/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ export default async function typescriptGenerator(
'./' +
path
.relative(path.resolve(config.typeIndexPath, '..'), typePath)
// Windows management
.replaceAll('\\', '/')
// remove the .d.ts from the end of the path
.replace(/\.[^/.]+\.[^/.]+$/, '')
),
Expand Down