-
Notifications
You must be signed in to change notification settings - Fork 106
INSTUI-3823 Get InstUI build on Windows #1241
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
Conversation
also remove concurrently dependency. This simplifies our script execution a lot. Some scripts are a bit more colorful, some output a bit more log
let result = { status: 1 } | ||
|
||
try { | ||
result = runCommandSync(`${resolveBin('concurrently')}`, args) |
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.
This was the biggest issue. This is an ugly hack to allow synchronous parallel execution in node (= execute multiple scripts simultaneously synchronously). This was accomplished by running concurrently
(a lib to execute multiple scripts at the same time) synchronously. This had multiple issues:
- we needed to pass arguments and env variables in a huge string like
concurrently "ENV_VAR1=A, ENV_VAR2=B scriptA --arg1 abc --arg2 bcd" ENV_VAR3=3 scriptB --arg1=123
that is very hard to read and is not Windows compatible. - We were running
concurrently
not with native code but with a lib calledexeca
. Dontknow why - All these scripts executing scripts made IDE debuggers get lost unable to place breakpoints
- some of them also mess with
stdout
causing formatting like colors to be lost.
This solution is pure native code, easy to read, crossplatform with a price that runCommandsConcurrently
became async (we never made use of its synchronous nature)
Preview URL: https://1241--preview-instui.netlify.app |
@@ -36,7 +36,7 @@ | |||
"generate:component": "yarn workspace @instructure/instui-cli instui create component", | |||
"generate:package": "yarn workspace @instructure/instui-cli instui create package", | |||
"commit": "ui-scripts commit", | |||
"bootstrap": "time yarn node scripts/bootstrap.js", |
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.
time
does not exist on Windows, we should use a node API in a later PR
It seems that |
react-docgen 6 upgrade required that the docs build scripts use ESM imports. It also has a bug with some function definitions (see react-docgen issue 827 on Github) that required the rewrite of some types. Also made doc build scripts a bit more Windows friendly
@@ -22,7 +22,7 @@ | |||
* SOFTWARE. | |||
*/ | |||
|
|||
import type { LibraryOptions, ParsedDoc, ProcessedFile } from '../DataTypes' | |||
import type { LibraryOptions, ParsedDoc, ProcessedFile } from '../DataTypes.mjs' |
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.
This rewrite was needed because I thought that an issue would be fixed by upgrading react-docgen... it was not, and it required that our TS files are emitted with ESM imports. This needed a change in the extension otherwise they'd be treated as commonJS files.
if (process.platform === 'win32' && module.description) { | ||
// JSDoc bug https://github.com/jsdoc/jsdoc/issues/2067 | ||
module.description = module.description.replace(/\r/g, "\r\n") |
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.
ugly hack that is the actual fix
onUpdate?: ({ visibleItemsCount }: { visibleItemsCount: number }) => void | ||
onUpdate?: (visibleItemsCount: { visibleItemsCount: number }) => void |
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.
this was needed because react-docgen was failing with the old code, see reactjs/react-docgen#827
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.
This was fixed in [email protected].
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.
Yaaay, it works! Fantastic work, thanks a lot!
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.
works fine on mac as well (bootstrap
, dev
, test
, build
)
This PR gets
yarn bootstrap
andyarn dev
working on windows.yarn test
also runs, but its quite flaky -- some tests fail, some others just throw an error.This is accomplished by using
cross-spawn
via its API to spawnbabel
,karma
andwebpack
instead ofconcurrently
andexeca
via command line.On OSX nothing should change except
babel
being a bit more verbose.To test:
On OSX run our usual build/test commands, especially with parameters (e.g.
yarn test --scope..
).On Windows run
bootstrap
,dev
. If you get tons of popups change the default program to runjs
files tonode.exe