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

remove parallel #94

Merged
merged 1 commit into from
Feb 9, 2017
Merged

remove parallel #94

merged 1 commit into from
Feb 9, 2017

Conversation

kentcdodds
Copy link
Collaborator

What: Removes parallel

Why: Reduces complexity of the tool and its implementation.

How: It's still a work in progres...

This will be a breaking change... Still evaluating.

@tleunen
Copy link
Collaborator

tleunen commented Feb 6, 2017

😢

Why removing it? Would be great to keep it but use concurrently under the hood instead?

@kentcdodds
Copy link
Collaborator Author

I'm looking the reduced complexity from both an API standpoint as well as an implementation standpoint. It's altogether simpler and more focused. And we get even more features and functionality by deferring to another package for this. Still considering it.

@kentcdodds
Copy link
Collaborator Author

kentcdodds commented Feb 7, 2017

I'd like to put this to a vote. For clarity, here's what's happening here:

This removes the --parallel feature from p-s and instead recommends usage of concurrently to have scripts that run at the same time.

Arguments for:

  • Reduces the tool's API surface area. Less for people to learn about the tool.
  • Simplifies the implementation (considerably) and pushes things off to another tool which can have more uses and is well tested.
  • Follows the DOTADIW philosophy. Allows composability of existing tools that each "do one thing and do it well" which can be really nice and flexible.

Arguments against:

  • Users have to install another dependency to get the parallel functionality.

Please use GitHub emoji reactions on this comment to vote.

  • 👍 means "Yes, let's remove --parallel in favor of recommending concurrently"
  • 👎 means "No, let's not remove --parallel"
  • 😕 means "I'm unsure"
  • 😄 means "I don't really care either way"

I'll check back in ~24 hours. I'll try to reach out to as many people as use the tool as possible. Here's a start:

cc/ @DavidWells, @abhishekisnot, @rowanoulton, @giladgo, @tim-mcgee, @nkbt, @tleunen, @Hypercubed, @jisaacks, @boneskull, @RobinMalfait, @edm00se, @SamVerschueren, @sxn, @gunnx, @martellaj, @msegado, @beeman, @elijahmanor

Feel free to comment if you have additional input/thoughts.

src/index.js Outdated
} else {
return runSeries()
}
return runSeries()
Copy link
Collaborator

Choose a reason for hiding this comment

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

if we do end up removing it we should probably open a refactoring issue to clean this type of things up :)

@@ -75,7 +77,7 @@ scripts:
build:
default: webpack
prod: webpack -p
validate: nps --parallel lint,test,build
validate: concurrently "nps lint" "nps test" "nps build"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Concurrently might prove an extra headache for Cygwin users, I guess. I'll try to see if there's any way to fix that though instead of using that as a basis for the decision at hand.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for finding that. Seems like it wouldn't be too terrible to fix.

@sxn
Copy link
Collaborator

sxn commented Feb 7, 2017

I'd go with a 😕 for now. Reducing the surface area's great (as well as having less code to maintain :D) but I'm wondering if in the long run it won't complicate things for users more than it simplifies them.

default: 'webpack',
prod: 'webpack -p',
},
validate: 'nps --parallel lint,test,build',
// learn more about concurrently here: https://npm.im/concurrently
validate: 'concurrently "nps lint" "nps test" "nps build"',
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is quite verbose.
If this is not possible yet, could we support this syntax?

concurrently "nps lint test build"

Copy link
Contributor

Choose a reason for hiding this comment

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

@tleunen the issue is that we now have to rely on how concurrently works, and it expects complete commands, not just the parameters like you would with nps -p

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think that we could support that syntax unfortunately. Because concurrently will spawn a process with the command nps lint test build. If you look at the additions in EXAMPLES.md you'll see that a function can be used to simplify things further. Perhaps we could use that example in the README instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You can also check out the changes to package-scripts.js in this PR. I think it's pretty clean.

@gunnx
Copy link
Collaborator

gunnx commented Feb 7, 2017 via email

@kentcdodds
Copy link
Collaborator Author

Any reason for concurrently over npm-run-all?

Unless I'm mistaken, npm-run-all will only run npm scripts. Because we don't actually put our scripts in package.json it's incompatibile.

When I use raw npm scripts, npm-run-all is one of my favorite packages :)

@kentcdodds
Copy link
Collaborator Author

Sorry everyone, I had a copy/paste issue. I'm pretty sure the intent is still the same, but I updated the emoji voting option descriptions to make sure things were more clear.

@kentcdodds
Copy link
Collaborator Author

Just updated this PR. Here's a little backstory:

  • concurrency has this cool feature where it will allow you to label the output from each script (because normally the output is jumbled together and you have to kinda guess where the output is coming from).
  • However, enabling this functionality caused the colors from the output to be removed :-( This made the output even harder to read than before.
  • concurrency allows you to pass --raw and we're basically back to where we were with the --parallel flag where the output of the scripts is jumbled together. Status quo.
  • I dug into it a bit and found out that colors (the module we were using to color our output) wont color the output if it detects that you're in an environment that doesn't support color.
  • I dug more and found out that chalk (the de-facto standard for coloring output for the terminal these days) also attempts to detect whether to actually color the strings you give it. However, it also exposes some ways to override the behavior. Specifically, adding FORCE_COLOR=true will force chalk to color the text.
  • So I'm going to see if we can add this capability to concurrency.
  • Until that time, if you simply add a process.env.FORCE_COLOR = true to your package-scripts.js it will force chalk colors to show.
  • However, we were using colors to color the output from nps (like nps executing: script string). So this PR replaces colors with the more popular (and widely supported) chalk module. Was pretty much just a find/replace operation.

Fun stuff!

@codecov-io
Copy link

codecov-io commented Feb 7, 2017

Codecov Report

Merging #94 into next will not change coverage.

@@         Coverage Diff         @@
##           next    #94   +/-   ##
===================================
  Coverage   100%   100%           
===================================
  Files        11     11           
  Lines       260    237   -23     
===================================
- Hits        260    237   -23
Impacted Files Coverage Δ
src/index.js 100% <100%> (ø)
src/bin-utils/index.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3566a15...79b8518. Read the comment docs.

@kentcdodds
Copy link
Collaborator Author

I should probably also mention that all the trouble I went through in the previous comment was so we could have even more functionality with concurrently than we currently have now with --parallel. We don't have to do anything special to get parody functionality with concurrently.

@kentcdodds kentcdodds changed the base branch from master to next February 8, 2017 16:06
@kentcdodds kentcdodds changed the base branch from next to master February 8, 2017 16:08
@kentcdodds kentcdodds changed the base branch from master to next February 8, 2017 16:09
@kentcdodds
Copy link
Collaborator Author

Ok, based on the voting, I think we're going to make this happen. Regardless of whether you're in favor, I appreciate any input on how we can make this change as successful as possible. What can I change about this PR to improve things? Here are a few ideas:

  1. Add the concurrent function (from EXAMPLES.md to the README.md) to inspire people to use JavaScript to make their scripts file cleaner and demonstrate that using concurrently doesn't have to be verbose.
  2. Add a few helper functions people can require into their package-scripts.js to make doing this easier? Maybe? I'm not 100% sure I'm in favor of this.

Any other ideas?

Also, because this is a breaking change, I've set the base branch to next which is where I'll put any breaking changes we want to have go out at the same time. If anyone can think of any other improvements that would result in a breaking change, let me know! I want to avoid doing these major version bumps where possible. The plan is to merge things into next and when we're good and ready, we'll make a PR from next to master, merge it, and it'll get automatically released ✨

@kentcdodds
Copy link
Collaborator Author

kentcdodds commented Feb 8, 2017

Just had an idea. If we see the --parallel flag, we should log a warning indicating that this was changed and linking to ERRORS_AND_WARNINGS.md which will describe how to get parallel capabilities. Then we can remove this warning in the next major version bump.

**What**: This removes the `--parallel` capabities from `p-s` in favor
of encouraging the use of the `concurrently` module.

**Why**: DOTADIW. We want `p-s` to stay as small and focused as possible

**How**: Refactoring and documenting

BREAKING CHANGE: you must now use `concurrently` to have scripts run in parallel. Check the docs for an example of how to do this.
@kentcdodds
Copy link
Collaborator Author

With all the changes I'm making for #70, I'm going to do the --parallel warning later. I'll merge this into next now and keep working on #70 and #100.

@kentcdodds kentcdodds merged commit 296bfac into next Feb 9, 2017
@kentcdodds kentcdodds deleted the pr/remove-parallel branch February 9, 2017 18:37
kentcdodds pushed a commit that referenced this pull request Feb 18, 2017
**What**: This removes the `--parallel` capabities from `p-s` in favor
of encouraging the use of the `concurrently` module.

**Why**: DOTADIW. We want `p-s` to stay as small and focused as possible

**How**: Refactoring and documenting

BREAKING CHANGE: you must now use `concurrently` to have scripts run in parallel. Check the docs for an example of how to do this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants