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

Enhance windows support #30148

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

mrginglymus
Copy link

@mrginglymus mrginglymus commented Dec 27, 2024

What I did

Type mapping stubs used in the build process were injecting file-system relative paths. This change ensures they are module relative paths by replacing path.sep with /

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 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 0.88 0%
initSize 133 MB 133 MB 0 B -1.22 0%
diffSize 55.3 MB 55.3 MB 0 B -1.22 0%
buildSize 7.19 MB 7.19 MB 0 B -2.25 0%
buildSbAddonsSize 1.85 MB 1.85 MB 0 B -2.26 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.87 MB 1.87 MB 0 B 1.36 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.91 MB 3.91 MB 0 B -2.25 0%
buildPreviewSize 3.28 MB 3.28 MB 0 B - 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 22.8s 6.9s -15s -868ms -0.8 -228.2%
generateTime 20.8s 18.9s -1s -943ms -0.84 -10.3%
initTime 13.8s 13.4s -374ms -0.66 -2.8%
buildTime 8.5s 9.5s 1s 0.22 10.5%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.2s 5s -154ms -0.36 -3.1%
devManagerResponsive 3.7s 3.7s 79ms -0.23 2.1%
devManagerHeaderVisible 601ms 674ms 73ms 0.07 10.8%
devManagerIndexVisible 644ms 701ms 57ms 0.03 8.1%
devStoryVisibleUncached 2s 2s 7ms 0.29 0.3%
devStoryVisible 643ms 700ms 57ms -0.02 8.1%
devAutodocsVisible 542ms 602ms 60ms 0.18 10%
devMDXVisible 590ms 777ms 187ms 1.24 🔺24.1%
buildManagerHeaderVisible 675ms 569ms -106ms -0.46 -18.6%
buildManagerIndexVisible 803ms 670ms -133ms -0.33 -19.9%
buildStoryVisible 657ms 553ms -104ms -0.49 -18.8%
buildAutodocsVisible 546ms 485ms -61ms -0.29 -12.6%
buildMDXVisible 549ms 479ms -70ms -0.29 -14.6%

Greptile Summary

This PR modifies the type mapper file generation to ensure cross-platform compatibility by normalizing path separators in TypeScript declaration files, particularly important for Windows builds.

  • Modified code/core/scripts/helpers/generateTypesMapperFiles.ts to replace system-specific path separators with forward slashes using replaceAll(sep, '/')
  • Ensures consistent module paths across different operating systems in generated .d.ts files
  • Improves build reliability on Windows systems by standardizing path formats

💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!

Type mapping stubs used in the build process were injecting file-system
relative paths. This change ensures they are module relative paths by
replacing path.sep with /
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

Comment on lines +16 to +17
export * from '${join(upwards, downwards).replaceAll(sep, '/')}';
export type * from '${join(upwards, downwards).replaceAll(sep, '/')}';
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider using path.posix.join() instead of join().replaceAll(sep, '/') for more idiomatic path normalization in module specifiers

Copy link
Author

Choose a reason for hiding this comment

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

bad greptile - that only works if both paths are already posix paths. otherwise you end up with

export * from '../src\index.ts';

@mrginglymus
Copy link
Author

mrginglymus commented Dec 27, 2024

Sigh. This having worked, once, I'm now getting the exceedingly unhelpful error:

> npx nx run-many -t build --parallel=15

 NX   Failed to convert JavaScript value `Null` into rust type `String`


An error occurred while executing: `npx nx run-many -t build --parallel=15`
❌ Failed to bootstrap

Error running task compile for undefined:
{
  "shortMessage": "Command failed with exit code 1: npx nx run-many -t build --parallel=15",
  "command": "npx nx run-many -t build --parallel=15",
  "escapedCommand": "\"npx nx run-many -t build --parallel=15\"",
  "exitCode": 1,
  "failed": true,
  "timedOut": false,
  "isCanceled": false,
  "killed": false
}

edit: ah, good, a known nx issue: nrwl/nx#29429

Updating to 20.3 seemed to fix it

This is a much more portable solution than referencing a shell script
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