Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSplit core functionality from CLI #14
Conversation
kachkaev
referenced this pull request
May 8, 2018
Merged
Add full stops to some error messages for consistency #15
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jfairbank
May 8, 2018
Owner
This seems like a good change to make. I'll wait for you to rebase before I review. Thanks!
|
This seems like a good change to make. I'll wait for you to rebase before I review. Thanks! |
kachkaev
added some commits
Apr 26, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kachkaev
May 8, 2018
Contributor
Despite that all tests pass, I'm still not sure this PR is worth merging as is. The issue that I see is that we're calling node-elm-compiler synchronously, because otherwise we'll get early exit due to rtfeldman/node-elm-compiler#68. Therefore, the main Node.js thread will get blocked and performance will suffer (this only applies when Node API is used). There is no regression in CLI use, just a non-optimality in the new execution mode.
What are your thoughts on this @jfairbank? How is the PR in general?
|
Despite that all tests pass, I'm still not sure this PR is worth merging as is. The issue that I see is that we're calling What are your thoughts on this @jfairbank? How is the PR in general? |
kachkaev
changed the title from
[WIP] Split core functionality from CLI
to
Split core functionality from CLI
May 8, 2018
kachkaev
added some commits
May 8, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kachkaev
May 14, 2018
Contributor
I also noticed today that Elm's Debug.log is being incorrectly reported in the API mode. Will add a fix to this soon, please don't merge.
|
I also noticed today that Elm's |
kachkaev
added some commits
May 14, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kachkaev
May 15, 2018
Contributor
I also managed to fix a few things so that they work on Windows:
https://ci.appveyor.com/project/kachkaev/run-elm/build/27
Things to note:
-
stderr / stdout never contain
\r(even when it's Windows) to make sure there are no unwanted parsing issues in the downstream projects. If someone asks for a nice-looking output forcmd, we can look into adding a CLI option for that. -
I had to rename
Aux.elmintoHelper.elmin one of the tests, because you can't useAUXfor file names on Windows😱 This was giving a pretty strange exception.
@jfairbank feel free to integrate AppVeyor to the repo just as I did in my fork.
One last thing I'd like to look into is to make a call to elm compiler async despite rtfeldman/node-elm-compiler#68.
|
I also managed to fix a few things so that they work on Windows: Things to note:
@jfairbank feel free to integrate AppVeyor to the repo just as I did in my fork. One last thing I'd like to look into is to make a call to elm compiler async despite rtfeldman/node-elm-compiler#68. |
| }, | ||
| "scripts": { | ||
| "test:clean": "cd test/integration && git clean -d -f -X", | ||
| "clean:test": "git clean -d -f -X test/integration", |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kachkaev
May 15, 2018
Contributor
&& are not allowed in npm scripts on Windows; also renamed test:clean into clean:test for a better clarity
kachkaev
May 15, 2018
•
Contributor
&& are not allowed in npm scripts on Windows; also renamed test:clean into clean:test for a better clarity
| "lint": "eslint src test --ignore-pattern elm-stuff", | ||
| "prebuild": "rimraf lib", | ||
| "build": "babel src --out-dir lib", | ||
| "postbuild": "cpx \"src/*.elm.template\" lib", |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kachkaev
May 15, 2018
Contributor
&& are not allowed in npm scripts on Windows, so I had to split command into three
kachkaev
May 15, 2018
Contributor
&& are not allowed in npm scripts on Windows, so I had to split command into three
| @@ -70,10 +37,10 @@ import sh from 'shelljs'; | ||
| // ensure --output-name is specified adequately | ||
| if (!outputName.match(/^[a-z_]\w*$/)) { | ||
| throw new Error(`Provided --output-name \`${outputName}\` is not a valid constant or function name in elm.`); | ||
| throw new Error(`Provided output name \`${outputName}\` is not a valid constant or function name in elm.`); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kachkaev
May 15, 2018
Contributor
not using --output-name to avoid confusion in non-CLI usage. Same applies to other args
kachkaev
May 15, 2018
•
Contributor
not using --output-name to avoid confusion in non-CLI usage. Same applies to other args
src/index.js
| await Promise.all([ | ||
| close(elmCompileStdoutFd).catch(() => {}), | ||
| close(elmCompileStderrFd).catch(() => {}), | ||
| ]); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kachkaev
May 15, 2018
Contributor
Had to do this to support Windows, otherwise the files were left unclosed and could not be deleted
kachkaev
May 15, 2018
Contributor
Had to do this to support Windows, otherwise the files were left unclosed and could not be deleted
referenced
this pull request
in rtfeldman/node-elm-compiler
May 15, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kachkaev
May 15, 2018
Contributor
The PR should be ready for your review @jfairbank elm-compile are async now and both Travis and AppVeyor#28 (Windows) pass!
|
The PR should be ready for your review @jfairbank |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
ping @jfairbank |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jfairbank
May 23, 2018
Owner
Hey, @kachkaev. I've been at a conference this week and am traveling the rest of the week, so I won't be able to check this PR more thoroughly until next week. Sorry for the delay, but I didn't want to keep you in the dark at least.
|
Hey, @kachkaev. I've been at a conference this week and am traveling the rest of the week, so I won't be able to check this PR more thoroughly until next week. Sorry for the delay, but I didn't want to keep you in the dark at least. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kachkaev
Jun 7, 2018
Contributor
@jfairbank when about could you have a look at this? No rush, just curious.
|
@jfairbank when about could you have a look at this? No rush, just curious. |
jfairbank
merged commit 8fa0acc
into
jfairbank:master
Jun 8, 2018
1 check passed
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jfairbank
Jun 8, 2018
Owner
Sorry again; I've just been super busy with other priorities. I finally looked this over, and it seems reasonable. I'll get a release out later tonight. Thanks!
|
Sorry again; I've just been super busy with other priorities. I finally looked this over, and it seems reasonable. I'll get a release out later tonight. Thanks! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
v2.3.0 is now out! |
kachkaev commentedApr 28, 2018
•
edited
Edited 9 times
-
kachkaev
edited May 8, 2018 (most recent)
-
kachkaev
edited May 8, 2018
-
kachkaev
edited Apr 28, 2018
-
kachkaev
edited Apr 28, 2018
-
kachkaev
edited Apr 28, 2018
-
kachkaev
edited Apr 28, 2018
-
kachkaev
edited Apr 28, 2018
-
kachkaev
edited Apr 28, 2018
-
kachkaev
edited Apr 28, 2018
I recently needed to use
run-elmviarequire()rather than by spawning a sub-process and came up with a refactoring that involved splitting core functionality from CLI. At the moment this change is included into a fork called @kachkaev/run-elm, but I hope to deprecate that package once we updaterun-elm.I have marked this PR as work-in-progress because it includes commits from #13, has some fork-specific commits and also lacks usage instructions forrequire()in README. The tests have been done though, all works!One thing that bugs me is that I'm using
compileSyncinstead ofcompile(they both replacecompileToStringand save one cycle of file write/read). The reason is in rtfeldman/node-elm-compiler#68 (async version callsprocess.exit()on error, so it can't be used when werequire('run-elm')).WDYT @jfairbank?
I'm happy to rebase and refactor after merging #13 and getting your general approval.