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: fix findUp for Windows #640

Merged
merged 4 commits into from
Nov 25, 2023
Merged

fix: fix findUp for Windows #640

merged 4 commits into from
Nov 25, 2023

Conversation

Mobyrr
Copy link
Contributor

@Mobyrr Mobyrr commented Nov 23, 2023

Description

Fix histoire not starting on Windows because of a infinite loop in findUp function.

in find-up.ts, on Windows on the drive C:, root is equal to "C:" but dir can't be equal to "C:", it can be "C:/" or "/" or something else, so the condition of the loop will always be true, causing an infinite loop.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • If it's a new feature, provide a convincing reason to add it. Ideally, you should open a suggestion issue first and have it approved before working on it.
  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

Copy link

codesandbox bot commented Nov 23, 2023

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

stackblitz bot commented Nov 23, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

netlify bot commented Nov 23, 2023

Deploy Preview for histoire-examples-svelte3 ready!

Name Link
🔨 Latest commit 83a871f
🔍 Latest deploy log https://app.netlify.com/sites/histoire-examples-svelte3/deploys/6561f91b0bf1200008a64d0a
😎 Deploy Preview https://deploy-preview-640--histoire-examples-svelte3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 23, 2023

Deploy Preview for histoire-controls ready!

Name Link
🔨 Latest commit 83a871f
🔍 Latest deploy log https://app.netlify.com/sites/histoire-controls/deploys/6561f91b9bd8820008bf39ac
😎 Deploy Preview https://deploy-preview-640--histoire-controls.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 23, 2023

Deploy Preview for histoire-examples-vue3 ready!

Name Link
🔨 Latest commit 83a871f
🔍 Latest deploy log https://app.netlify.com/sites/histoire-examples-vue3/deploys/6561f91be79613000870b497
😎 Deploy Preview https://deploy-preview-640--histoire-examples-vue3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 23, 2023

Deploy Preview for histoire-site ready!

Name Link
🔨 Latest commit 83a871f
🔍 Latest deploy log https://app.netlify.com/sites/histoire-site/deploys/6561f91bca4ad00008857405
😎 Deploy Preview https://deploy-preview-640--histoire-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Mobyrr Mobyrr changed the title fix findUp for Windows fix: fix findUp for Windows Nov 23, 2023
@peterbud
Copy link
Contributor

Hi @Mobyrr , I think this is not a solution. The previous version (0.2.0) of pathe lib had this issue on Windows, but the latest version 1.1.1 is working fine, and there is no such trick is needed anymore:
unjs/pathe#5

However I believe the problem might be that pathe has been updated only in the histoire package, but not in the other packages - I'd start by updating the dependencies there first, and check whether it is working on Windows.

@Mobyrr
Copy link
Contributor Author

Mobyrr commented Nov 24, 2023

Hi @Mobyrr , I think this is not a solution. The previous version (0.2.0) of pathe lib had this issue on Windows, but the latest version 1.1.1 is working fine, and there is no such trick is needed anymore: unjs/pathe#5

However I believe the problem might be that pathe has been updated only in the histoire package, but not in the other packages - I'd start by updating the dependencies there first, and check whether it is working on Windows.

It's not the same issue
If you read the code, with the version 0.2.0, the root was equal to a empty string, now it's "C:" thanks to 1.1.1, but path.dirname can't return "C:", it returns "C:/" when we get at the root, it's all about a missing slash

My fix simply adds the missing slash when root corresponds to a windows root

Also I don't think it's a problem with non-updated dependencies in other packages, I observed with a debugger that it's only this file that causes the problem on Windows

@peterbud
Copy link
Contributor

OK, I see !

@Akryum Akryum merged commit ec40fec into histoire-dev:main Nov 25, 2023
13 checks passed
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.

None yet

3 participants