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

Manager: Escape single quotes in dynamic import paths in wrapManagerEntries function #30137

Merged

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Dec 24, 2024

Closes #29701

What I did

Escaped single quotes in dynamic import paths in wrapManagerEntries function

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!

  1. Run a sandbox for template, e.g. yarn task --task sandbox --start-from auto --template react-vite/default-ts
  2. Change the parent folder to contain an apostrophe (')
  3. Run Storybook

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 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.8 MB 77.8 MB 0 B 1.33 0%
initSize 143 MB 143 MB 48 B 1.18 0%
diffSize 65.6 MB 65.6 MB 48 B 1.18 0%
buildSize 7.19 MB 7.19 MB 0 B -0.88 0%
buildSbAddonsSize 1.85 MB 1.85 MB 0 B -0.72 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.87 MB 1.87 MB 0 B 0.23 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.92 MB 3.92 MB 0 B -0.73 0%
buildPreviewSize 3.28 MB 3.28 MB 0 B -0.9 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 7.2s 24.4s 17.2s 1.85 🔺70.5%
generateTime 21.1s 21.3s 183ms 0.14 0.9%
initTime 14.6s 16.5s 1.8s 1.04 11%
buildTime 11.5s 8.9s -2s -547ms -0.51 -28.4%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.5s 5.2s -375ms -0.16 -7.2%
devManagerResponsive 4.1s 3.8s -275ms -0.23 -7.2%
devManagerHeaderVisible 755ms 663ms -92ms 0.07 -13.9%
devManagerIndexVisible 799ms 702ms -97ms 0.14 -13.8%
devStoryVisibleUncached 2s 1.9s -104ms 0.08 -5.2%
devStoryVisible 800ms 703ms -97ms 0.1 -13.8%
devAutodocsVisible 711ms 600ms -111ms 0.16 -18.5%
devMDXVisible 577ms 570ms -7ms -0.1 -1.2%
buildManagerHeaderVisible 595ms 669ms 74ms 0.19 11.1%
buildManagerIndexVisible 682ms 762ms 80ms 0.14 10.5%
buildStoryVisible 575ms 650ms 75ms 0.29 11.5%
buildAutodocsVisible 562ms 554ms -8ms 0.35 -1.4%
buildMDXVisible 545ms 495ms -50ms -0.09 -10.1%

Greptile Summary

Based on the provided information, I'll create a concise summary of the pull request:

Fixes an issue where single quotes in file paths cause syntax errors in dynamic imports for Storybook manager entries.

  • Modified code/core/src/builder-manager/utils/managerEntries.ts to escape single quotes in import paths
  • Addresses issue [Bug]: Not escaping ' character in cache file paths. #29701 where paths containing apostrophes (e.g. in usernames) break manager imports
  • Critical fix for Windows users who have single quotes in their file paths or usernames
  • Simple implementation using replaceAll to properly escape quotes with backslashes

@valentinpalkovic valentinpalkovic self-assigned this Dec 24, 2024
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 | Greptile

Copy link

nx-cloud bot commented Dec 24, 2024

View your CI Pipeline Execution ↗ for commit d65dcd0.

Command Status Duration Result
nx affected -t check -c production --parallel=7 ✅ Succeeded 46s View ↗
nx run-many -t build -c production --parallel=3 ✅ Succeeded 2m 53s View ↗

☁️ Nx Cloud last updated this comment at 2024-12-24 12:24:55 UTC

@valentinpalkovic valentinpalkovic changed the base branch from next to next-8.5 December 24, 2024 13:54
@valentinpalkovic valentinpalkovic merged commit 2c40552 into next-8.5 Dec 24, 2024
64 of 72 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/escape-apostrophe-in-manager-import branch December 24, 2024 13:54
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]: Not escaping ' character in cache file paths.
2 participants