Adding Node examples

Review Request #2900 - Created Sept. 28, 2015 and submitted

Information
Chris Pesto
pants
2168
48b8e70...
Reviewers
pants-reviews
jsirois, stuhood

I'm adding a pretty complete and complex set of modules representing different things:

  • A server project transpiled using Babel in its prepublish step
  • A web build tool encapsulating Webpack and a set of loaders
  • A web component (button) using React and CSS in a separate file, built with the web build tool, containing its own test file
  • A web project using React, built with the web build tool, depending on the server project and button component, and containing its own test file

This works now that https://github.com/pantsbuild/pants/pull/2267 is merged to master.

This also modifies npm_resolve.py to work with an existing package.json rather than simply write out a simple package.json with only name/version/dependencies fields. Currently this works by dropping dependency fields in the existing package.json and replacing them with whatever is in the BUILD target dependencies. This lets it work with an existing valid package.json that can be installed via "npm install" without Pants, but it isn't the best long-term experience as I describe in the README. Support should improve over time to let Pants simply get its dependencies from a package.json.

Note - using an existing package.json means that any "prepublish" script in the scripts field of package.json will be executed as part of the "npm install" done for target resolution (npm runs prepublish if you do an "npm install" inside the folder - https://docs.npmjs.com/misc/scripts). This is necessary if you have a source dependency that needs transpilation, but it is an arbitrary script that gets run inside the resolve.

  • Unit test in test_npm_resolve.py tests the integration with source package.json
  • Integration tests in test_npm_resolve_integration.py install two of the examples: server-project and web-project. web-project has (transitive) dependencies on all the examples and 3rd party modules. server-project is nice on its own as it only depends on 3rd party modules and it includes a prepublish transpilation step.

Passing CI run: https://travis-ci.org/pantsbuild/pants/builds/83805985

Issues

  • 0
  • 0
  • 1
  • 1
Description From Last Updated
Stu Hood
Stu Hood
Eric Ayers
Chris Pesto
Chris Pesto
Stu Hood
Chris Pesto
Review request changed

Status: Closed (submitted)

Change Summary:

Merged as 92a018ad10c2d80857f99f384e1c88bd54de14d1

Loading...