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 the creation of Hydrogen projects on Windows #478

Merged
merged 2 commits into from
Feb 9, 2023

Conversation

pepicrft
Copy link
Contributor

@pepicrft pepicrft commented Feb 9, 2023

Resolves: #476

The approach following approach to obtain the absolute path where the templates should be downloaded leads to Windows paths (i.e. C://) prefixed with a forward slash:

new URL('../starter-templates', import.meta.url).pathname

I've adjusted the implementation to use fileURLToPath and I've taken the opportunity to use the asynchronous IO APIs instead. Going forward, I recommend using the modules provided by @shopify/cli-kit when working with the file-system and paths. Node's standard library is known for its inconsistencies across OSs and hence why libraries like pathe, which @shopify/cli-kit uses internally. I'd also recommend using the asynchronous version of the APIs. It leads to more scattered awaits but allows to execute the logic concurrently with other promises.

@pepicrft pepicrft requested review from blittle and frandiox February 9, 2023 17:49
@pepicrft pepicrft self-assigned this Feb 9, 2023
@github-actions

This comment has been minimized.

Copy link
Contributor

@lordofthecactus lordofthecactus left a comment

Choose a reason for hiding this comment

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

@blittle blittle merged commit 79820be into 2023-01 Feb 9, 2023
@blittle blittle deleted the fix-init-on-windows branch February 9, 2023 18:11
@github-actions github-actions bot mentioned this pull request Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Starter template error
3 participants