-
Notifications
You must be signed in to change notification settings - Fork 356
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
fix(build): Support running npm scripts under Windows #1251
fix(build): Support running npm scripts under Windows #1251
Conversation
@@ -25,7 +25,7 @@ | |||
"homepage": "https://github.com/patternfly/patternfly-react#readme", | |||
"scripts": { | |||
"prebuild": "node ./build/generateIcons.js", | |||
"build": "yarn build:babel; yarn build:ts", | |||
"build": "yarn build:babel && yarn build:ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&&
has slightly different semantics than ;
here: with this change, yarn build:ts
will only be executed if yarn build:babel
succeeds, while it used to be always executed, independently of the return code of yarn build:babel
.
However, &&
is supported cross-platform, while the ;
syntax is not.
Considering that stopping the command is probably a sensible thing to do if the babel build fails, I believe that is an acceptable change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch! thanks for your diligent work on this PR @timosta and giving us Windows support 👍
PatternFly-React preview: https://1251-pr-patternfly-react-patternfly.surge.sh |
Pull Request Test Coverage Report for Build 4233
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What:
With the current setup, Patternfly's npm scripts cannot be executed in a Windows environment.
The changes proposed by this PR should make all npm scripts platform independent and runnable on both Windows and Linux/OS X environments.
How:
shx
to make Unix specific commands platform independent: Commands likerm
,cp
etc. that are used in PF's npm scripts are not supported by Windows command lines. Theshx
command line tool provides a layer of abstraction that makes basic unix commands work cross-platform with the established Unix syntax.cross-var
to make Unix specific command line variable syntax platform independent: The PF3 packages use Unix style variables$variableName
to refer to environment variables in their npm scripts to build SASS style sheets. Under Windows, a different syntax must be used to make those variables work. Thecross-var
command line tool provides a layer of abstraction that makes Unix style variables work cross-platform.Open Points/Concerns:
ThePowerShell supports Unix style pipe operationscoveralls
script in the root package.json: It uses a pipe operator, which isn't supported on Windows as-is.|
, only cmd does not. Go Powershell! 💪Performance: The additional layer of abstraction for some scripts might cause some additional runtime overhead during the build process. Compare avg. Jenkins build runtimes before and after the change to get an idea of the impact?Comparing the Travis build time including the changes with similar recent PR builds (one, and another one) shows no significant preformance degradations. All are around the 25 to 30 minute mark.Executing Test suite under Windows environment: While the build works fine, running the Jest test suite under Windows currently produces a whole bunch of errors that do not show up on the Travis build. Investigating and resolving this should probably be done in a separate PR.Resolved with fix(build): Support running the test suite under Windows #1255.