-
Notifications
You must be signed in to change notification settings - Fork 8
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
Split core functionality from CLI #14
Conversation
This seems like a good change to make. I'll wait for you to rebase before I review. Thanks! |
3414b82
to
deeb2c4
Compare
deeb2c4
to
d7ff3b5
Compare
…te both via Node API and CLI
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? |
1f67b47
to
7a8879c
Compare
I also noticed today that Elm's |
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", |
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.
&& 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", |
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.
&& 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.`); |
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.
not using --output-name
to avoid confusion in non-CLI usage. Same applies to other args
src/index.js
Outdated
await Promise.all([ | ||
close(elmCompileStdoutFd).catch(() => {}), | ||
close(elmCompileStderrFd).catch(() => {}), | ||
]); |
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.
Had to do this to support Windows, otherwise the files were left unclosed and could not be deleted
The PR should be ready for your review @jfairbank 🎉 Calls to |
ping @jfairbank 🏓 🙂 |
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. |
@jfairbank when about could you have a look at this? No rush, just curious. |
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! |
v2.3.0 is now out! |
👋
I recently needed to use
run-elm
viarequire()
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
.