Add support for `repl.node`.

Review Request #2766 - Created Sept. 4, 2015 and submitted

Information
John Sirois
pants
jsirois/issues/2110/node_repl
2110, 2134
2765
ed16d9d...
Reviewers
pants-reviews
kwlzn, patricklaw, stuhood, zundel

This builds off of the new ReplTaskMixin and NodeRepl itself is a small
task.

To support NodeRepl well, a few adjustments are made:

  1. MutexTaskMixin is given better failure output when identifying
    mutually incompatible targets.
  2. NpmResolve is updated to support resolving remote modules directly.
  3. The NodePaths product if broken out of NpmResolve to present a more
    neutral data type and not explicitly couple NpmResolve to NodeRepl.

An example node 3rdparty dep is added to support some integration tests
and the existing NodeTask and NpmResolve tests are expanded to cover the
new functionality added to the respective classes.

contrib/node/examples/3rdparty/node/BUILD | 7 ++++
contrib/node/src/python/pants/contrib/node/register.py | 2 ++
contrib/node/src/python/pants/contrib/node/tasks/BUILD | 18 ++++++++++
contrib/node/src/python/pants/contrib/node/tasks/node_paths.py | 34 ++++++++++++++++++
contrib/node/src/python/pants/contrib/node/tasks/node_repl.py | 44 ++++++++++++++++++++++++
contrib/node/src/python/pants/contrib/node/tasks/node_task.py | 10 ++++--
contrib/node/src/python/pants/contrib/node/tasks/npm_resolve.py | 93 ++++++++++++++++++++------------------------------
contrib/node/tests/python/pants_test/contrib/node/tasks/BUILD | 9 +++++
contrib/node/tests/python/pants_test/contrib/node/tasks/test_node_repl_integration.py | 34 ++++++++++++++++++
contrib/node/tests/python/pants_test/contrib/node/tasks/test_node_task.py | 5 +++
contrib/node/tests/python/pants_test/contrib/node/tasks/test_npm_resolve.py | 21 ++++++++++--
src/python/pants/backend/core/tasks/mutex_task_mixin.py | 6 ++--
12 files changed, 221 insertions(+), 62 deletions(-)

Played with the repl: piping scripts to it, passing scripts via
-- --eval ... and just dropping into the repl and using it - all
using the contrib/node/examples/3rdparty/node:typ target.

Added integration tests cover this.

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/78782743

Issues

  • 0
  • 3
  • 0
  • 3
Description From Last Updated
Eric Ayers
Eric Ayers
John Sirois
John Sirois
John Sirois
John Sirois
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Stu Hood

Excellent. Thanks John!

Interesting... has it always been the case that objects were supported?

  1. Yes!  I'm glad someone noticed.  A small RB is coming to slightly encourage this style.
  2. +1

Loading...