Skip to content
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

package.json: use npm-run-all in scripts #375

Merged
merged 2 commits into from Jun 7, 2016

Conversation

williamboman
Copy link
Member

  • Proper exit codes
  • Runs all the specified npm scripts sequentially (continues on error)

@xPaw
Copy link
Member

xPaw commented Jun 3, 2016

As I pointed out in #361 (comment) we should switch to a proper build script

@maxpoulin64
Copy link
Member

That is one massively overengineered library, ouch. But it does appear to solve our initial problem of preserving the exit code while running all tests, and it supports parallel execution as well.

@@ -16,9 +16,9 @@
"build": "npm run build:grunt && npm run build:handlebars",
Copy link
Member

Choose a reason for hiding this comment

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

For the sake of uniformity, npm-run-all should be used for build as well.

@williamboman
Copy link
Member Author

As I pointed out in #361 (comment) we should switch to a proper build script

Why?

That is one massively overengineered library, ouch.

Could do echo lint:js lint:css | xargs -n1 npm run as well 😄

@astorije
Copy link
Member

astorije commented Jun 4, 2016

That is one massively overengineered library, ouch.

Yeah, I wanted to look if it was one of these one-liner packages you can find out there, I got the same feeling than @maxpoulin64! I guess that's where the "java" in "javascript" lies :-)

Still, I'm 👍, it does the job, and we can easily switch to something else as there is no other addition on our side.

@astorije astorije self-assigned this Jun 4, 2016
@astorije astorije added Type: Feature Tickets that describe a desired feature or PRs that add them to the project. second review needed labels Jun 4, 2016
@@ -13,12 +13,12 @@
"homepage": "https://thelounge.github.io/",
"scripts": {
"start": "node index",
"build": "npm run build:grunt && npm run build:handlebars",
"build": "npm-run-all build:grunt build:handlebars",
Copy link
Member

Choose a reason for hiding this comment

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

Actually, no need for npm-run-all here. The only benefit I see in this file is to have correct exit code and run everything when you test. For building, && is fine as we need everything. Unless I missed something :-)

Copy link
Member

@xPaw xPaw Jun 5, 2016

Choose a reason for hiding this comment

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

I would agree that using && is fine here. However using npm-run-all results in a shorter line (but -c is needed to fail builds).

Copy link
Member Author

Choose a reason for hiding this comment

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

npm-run-all without -c will abort as soon as a script fails (with a non-0 exit code). -c will run all scripts no matter what, but in the end exit with a non-0 code if one or more scripts failed.

Copy link
Member

Choose a reason for hiding this comment

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

I was thinking in regards to CIs, we would want to print all the errors at once (as we do with tests).

@xPaw
Copy link
Member

xPaw commented Jun 5, 2016

OK, I'll be fine with this. I think appveyor and travis configs need to be updated to just run the npm test command, instead of each individual one.

Travis: remove script section completely, travis will run npm test on its own
Appveyor: Remove npm run xxx lines

@williamboman williamboman force-pushed the chore/npm-scripts branch 2 times, most recently from 7300da2 to ee55313 Compare June 5, 2016 11:17
@xPaw
Copy link
Member

xPaw commented Jun 5, 2016

👍 Looks good. Will wait for @maxpoulin64 or @astorije to review the latest changes before merging.

@@ -13,13 +13,13 @@
"homepage": "https://thelounge.github.io/",
"scripts": {
"start": "node index",
"build": "npm run build:font-awesome && npm run build:grunt && npm run build:handlebars",
"build": "npm-run-all build:font-awesome build:grunt build:handlebars",
Copy link
Member

@astorije astorije Jun 5, 2016

Choose a reason for hiding this comment

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

Sorry to be that guy, but I'd really be more comfortable keeping && here. Reason is that the build script (and associated prepublish) is the most critical script of all as it is run by Travis CI when we publish, and releases cannot be modified or removed once published.

I'm OK with keeping test and lint short and clean because it's just a matter of convenience in dev, but we've all been surprised by the over-engineering of the npm-run-all package, and if building works perfectly fine with &&, we should stick to that. Adding a dependency for this step is another point of failure we loosely control.

Does this make sense?

@astorije
Copy link
Member

astorije commented Jun 5, 2016

I would have been fine keeping the individual statements for CIs in order to limit the tie-ins with this package, but it's no big deal, not like it changes a lot of things nor like it's completely immutable if things go wrong.

I however added a comment about build that I think is worth pushing for the given reason. Unnecessary risk here.

@astorije
Copy link
Member

astorije commented Jun 7, 2016

All good, until the next round of improvements :-)
👍

@astorije astorije merged commit 8f9da57 into thelounge:master Jun 7, 2016
@williamboman williamboman deleted the chore/npm-scripts branch June 10, 2016 13:22
@xPaw xPaw added this to the 2.0.0 milestone Jun 12, 2016
matburnham pushed a commit to matburnham/lounge that referenced this pull request Sep 6, 2017
package.json: use `npm-run-all` in scripts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Tickets that describe a desired feature or PRs that add them to the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants