Skip to content

[build-script]: use / as the path separator for glob.sync#15140

Merged
joshuaellis merged 2 commits intomainfrom
fix/window-build-errors
Dec 12, 2022
Merged

[build-script]: use / as the path separator for glob.sync#15140
joshuaellis merged 2 commits intomainfrom
fix/window-build-errors

Conversation

@joshuaellis
Copy link
Contributor

What does it do?

  • if windows is the platform, split the path and rejoin with linux path separator.

Why is it needed?

  • glob does not support the windows separator as documented here and you can see the recommended fix here. This seemed to be a big thing for v8.

How to test it?

  • run the build on a windows device (not WSL)

Related issue(s)/PR(s)

@joshuaellis joshuaellis added source: tooling Source is GitHub tooling/tests/ect pr: fix This PR is fixing a bug labels Dec 9, 2022
@codecov
Copy link

codecov bot commented Dec 9, 2022

Codecov Report

Base: 59.88% // Head: 59.88% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (f5916dc) compared to base (e62a89e).
Patch coverage: 66.66% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15140      +/-   ##
==========================================
- Coverage   59.88%   59.88%   -0.01%     
==========================================
  Files        1348     1348              
  Lines       32800    32803       +3     
  Branches     6255     6256       +1     
==========================================
+ Hits        19642    19643       +1     
- Misses      11303    11305       +2     
  Partials     1855     1855              
Flag Coverage Δ
back 50.08% <66.66%> (-0.01%) ⬇️
front 64.33% <ø> (ø)
unit_back 50.08% <66.66%> (-0.01%) ⬇️
unit_front 64.33% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/core/admin/utils/get-plugins-path.js 89.47% <66.66%> (-10.53%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@innerdvations innerdvations left a comment

Choose a reason for hiding this comment

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

Looks good to me!

I have one question I'm not sure about and can't test myself right now. Does process.platform under WSL report "win32" or does it report the subsystem's platform? I don't think it should matter here, but I just want to be sure we don't accidentally break something on WSL to fix vanilla Windows.

Comment on lines +22 to +25
if (process.platform === 'win32') {
corePath = corePath.split(sep).join(posix.sep);
pluginsPath = pluginsPath.split(sep).join(posix.sep);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a test for this branch (by mocking process.platform), because I imagine this will easily be forgotten about ...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can try, have you checked the tests for this? They're a bit odd. They rely on actually using path and we only run tests in a macOS env, so I'm not sure the best way? Any ideas?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suppose I could mock path for the test?

Copy link
Contributor

@gu-stav gu-stav Dec 9, 2022

Choose a reason for hiding this comment

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

I haven't looked, but can try to suggest something if you want next week? Shouldn't prevent you from merging this PR ...

@joshuaellis joshuaellis merged commit 45831f3 into main Dec 12, 2022
@joshuaellis joshuaellis deleted the fix/window-build-errors branch December 12, 2022 08:35
@joshuaellis joshuaellis added this to the 4.5.4 milestone Dec 12, 2022
@oDinZu
Copy link

oDinZu commented Jan 1, 2023

@joshuaellis Was this tested on a Linux OS like Ubuntu 22.04? I ask because I am having trouble building my Strapi workspace with yarn build on Ubuntu 22.04 LTS.

My bug report: #15311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: fix This PR is fixing a bug source: tooling Source is GitHub tooling/tests/ect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lerna failed task: @strapi/admin:build Document breaking changes for glob@8

4 participants