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: Fix yarn detection #29448

Merged
merged 4 commits into from
Oct 28, 2024
Merged

CLI: Fix yarn detection #29448

merged 4 commits into from
Oct 28, 2024

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Oct 25, 2024

What I did

  • ensure that spawning yarn works, by adding back all default env variables (like PATH)

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/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 77.6 MB 77.6 MB 0 B -1 0%
initSize 146 MB 146 MB 132 B -0.98 0%
diffSize 68.5 MB 68.5 MB 132 B 1.04 0%
buildSize 6.82 MB 6.82 MB 0 B -0.53 0%
buildSbAddonsSize 1.5 MB 1.5 MB 0 B -0.64 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.85 MB 1.85 MB 0 B 0.99 0%
buildSbPreviewSize 271 kB 271 kB 0 B 0.99 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.82 MB 3.82 MB 0 B -0.54 0%
buildPreviewSize 3 MB 3 MB 0 B 0.74 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 5.8s 24.9s 19s 1.66 🔺76.5%
generateTime 20.9s 23.3s 2.3s 0.79 10.3%
initTime 14.6s 17.1s 2.4s 1.73 🔺14.2%
buildTime 8s 9.7s 1.7s 0.4 17.6%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6.5s 6.6s 85ms 0.17 1.3%
devManagerResponsive 4.5s 4.3s -189ms 0.02 -4.3%
devManagerHeaderVisible 550ms 680ms 130ms 1.29 🔺19.1%
devManagerIndexVisible 630ms 761ms 131ms 1.43 🔺17.2%
devStoryVisibleUncached 1.1s 1.1s 32ms 0.59 2.7%
devStoryVisible 583ms 731ms 148ms 1.41 🔺20.2%
devAutodocsVisible 498ms 387ms -111ms -1.65 🔰-28.7%
devMDXVisible 565ms 571ms 6ms 0.66 1.1%
buildManagerHeaderVisible 555ms 500ms -55ms -0.59 -11%
buildManagerIndexVisible 573ms 513ms -60ms -0.71 -11.7%
buildStoryVisible 554ms 499ms -55ms -1.2 -11%
buildAutodocsVisible 484ms 439ms -45ms -0.76 -10.3%
buildMDXVisible 436ms 464ms 28ms -0.32 6%

Greptile Summary

Improved package manager detection in Storybook CLI by making Yarn detection more reliable and fixing environment variable handling during command execution.

  • Modified JsPackageManagerFactory.ts to only use Yarn when a yarn.lock file is present
  • Added process.env to environment variables when spawning package manager version check commands
  • Removed fallback condition that would use Yarn without yarn.lock when npm/pnpm weren't found
  • Ensures PATH and other critical environment variables are properly passed through during command execution

Copy link

nx-cloud bot commented Oct 25, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit db73a58. 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.

@ndelangen ndelangen marked this pull request as ready for review October 25, 2024 19:44
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(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@ndelangen ndelangen merged commit 9fb3d98 into next Oct 28, 2024
59 checks passed
@ndelangen ndelangen deleted the norbert/fix-yarn-detection branch October 28, 2024 09:54
@github-actions github-actions bot mentioned this pull request Oct 28, 2024
11 tasks
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.

2 participants