Skip to content

Conversation

@ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Jul 11, 2025

Closes #31959

What I did

Replaced fs.rename(from, to) with fs.copyFile(from, to).then(() => fs.rm(from)) in order to circumvent Windows' restriction on renaming across two drives.
Updated getProjectRoot to avoid npm-cache directory and search for lockfiles first.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This pull request has been released as version 0.0.0-pr-32020-sha-ee8b2677. Try it out in a new sandbox by running npx [email protected] sandbox or in an existing project with npx [email protected] upgrade.

More information
Published version 0.0.0-pr-32020-sha-ee8b2677
Triggered by @ghengeveld
Repository storybookjs/storybook
Branch fix-rename-across-disks
Commit ee8b2677
Datetime Tue Jul 22 12:59:41 UTC 2025 (1753189181)
Workflow run 16445026462

To request a new release of this pull request, mention the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=32020

Greptile Summary

Fixed Windows-specific file system issue where moving log files across different drives fails by replacing fs.rename() with fs.copyFile() + fs.rm() sequence.

  • Modified code/core/src/common/utils/cli.ts to handle cross-filesystem file moves on Windows
  • Implemented a two-step process of copying then deleting to circumvent EXDEV error
  • Added proper error handling through Promise chain for file operations

@ghengeveld ghengeveld added bug patch:yes Bugfix & documentation PR that need to be picked to main branch ci:normal labels Jul 11, 2025
@ghengeveld ghengeveld self-assigned this Jul 11, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

@nx-cloud
Copy link

nx-cloud bot commented Jul 11, 2025

View your CI Pipeline Execution ↗ for commit ee8b267

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 1m 19s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-22 13:25:48 UTC

@storybook-app-bot
Copy link

storybook-app-bot bot commented Jul 11, 2025

Package Benchmarks

Commit: ee8b267, ran on 22 July 2025 at 13:12:23 UTC

The following packages have significant changes to their size or dependencies:

storybook

Before After Difference
Dependency count 56 56 0
Self size 41.35 MB 41.36 MB 🚨 +16 KB 🚨
Dependency size 18.22 MB 18.22 MB 0 B
Bundle Size Analyzer Link Link

sb

Before After Difference
Dependency count 57 57 0
Self size 1 KB 1 KB 0 B
Dependency size 59.57 MB 59.59 MB 🚨 +16 KB 🚨
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 221 221 0
Self size 584 KB 584 KB 0 B
Dependency size 103.97 MB 103.99 MB 🚨 +17 KB 🚨
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 190 190 0
Self size 31 KB 31 KB 0 B
Dependency size 88.06 MB 88.08 MB 🚨 +16 KB 🚨
Bundle Size Analyzer Link Link

@ghengeveld ghengeveld changed the title Core: Fix moving log file across drives on Windows Core: Fix moving log file across drives and projectRoot detection on Windows Jul 22, 2025
@ghengeveld ghengeveld merged commit 4a5d3f5 into next Jul 22, 2025
57 checks passed
@ghengeveld ghengeveld deleted the fix-rename-across-disks branch July 22, 2025 15:46
@yannbf yannbf removed the patch:yes Bugfix & documentation PR that need to be picked to main branch label Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Freezes on 'Detecting project type' when installing storybook

4 participants