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

CLI: Update spawn options in proxy.ts to support Windows #28990

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Aug 28, 2024

Closes N/A

What I did

Fixing an issue on Windows where spawning a child process executing an npx command fails with an Error: spawn npx ENOENT error. This error occurred during the upgrade to `8.3.0-alpha.4 or higher.

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

Run npx storybook@<canary> upgrade on Windows in a Storybook project. The above mentioned error shouldn't appear.

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/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 PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

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

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 76.4 MB 76.4 MB 0 B 0.5 0%
initSize 161 MB 161 MB 58.4 kB -0.88 0%
diffSize 84.8 MB 84.8 MB 58.4 kB -0.89 0.1%
buildSize 7.48 MB 7.48 MB 0 B 3 0%
buildSbAddonsSize 1.62 MB 1.62 MB 0 B 0.72 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 2.31 MB 2.31 MB 0 B 3 0%
buildSbPreviewSize 352 kB 352 kB 0 B 0.73 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 4.47 MB 4.47 MB 0 B 3 0%
buildPreviewSize 3.01 MB 3.01 MB 0 B 2.99 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 7s 25.6s 18.5s 1.24 🔺72.6%
generateTime 19.7s 21.3s 1.5s 0.01 7.4%
initTime 16s 17.5s 1.4s 0.24 8.4%
buildTime 11.5s 12.9s 1.3s 0.77 10.6%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6.9s 7s 63ms -0.46 0.9%
devManagerResponsive 4.5s 4.5s -72ms -0.65 -1.6%
devManagerHeaderVisible 793ms 718ms -75ms -1.07 -10.4%
devManagerIndexVisible 830ms 759ms -71ms -1.01 -9.4%
devStoryVisibleUncached 1.4s 1.3s -47ms -0.03 -3.5%
devStoryVisible 829ms 758ms -71ms -1.01 -9.4%
devAutodocsVisible 745ms 722ms -23ms 0.04 -3.2%
devMDXVisible 677ms 644ms -33ms -0.81 -5.1%
buildManagerHeaderVisible 791ms 683ms -108ms -0.91 -15.8%
buildManagerIndexVisible 793ms 690ms -103ms -0.89 -14.9%
buildStoryVisible 868ms 723ms -145ms -1.11 -20.1%
buildAutodocsVisible 760ms 710ms -50ms 0.22 -7%
buildMDXVisible 952ms 628ms -324ms -0.69 -51.6%

Greptile Summary

This pull request updates the spawn options in the CLI's proxy.ts file to support Windows environments.

  • Modified code/lib/cli/src/proxy.ts to add shell: true option to spawn function call
  • Addresses Error: spawn npx ENOENT issue when executing npx commands on Windows
  • Ensures child processes are executed in a shell environment, resolving compatibility problems
  • Improves cross-platform support for Storybook CLI operations

Copy link

nx-cloud bot commented Aug 28, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 3416d19. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@valentinpalkovic valentinpalkovic marked this pull request as ready for review August 28, 2024 11:29
@valentinpalkovic valentinpalkovic merged commit a400b02 into next Aug 28, 2024
60 of 68 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/windows-fix-enoent-npx-spawn branch August 28, 2024 11:29
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.

LGTM

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

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.

3 participants