DiUS / pact-consumer-js-dsl

*DEPRECATED* A Javascript DSL for creating pacts, superceded by Pact JS
https://github.com/pact-foundation/pact-js
Other
56 stars 26 forks source link

Convert to CommonJS via Browserify #20

Open markdalgleish opened 9 years ago

markdalgleish commented 9 years ago

This pull request serves more as a conversation starter. The goal of this change is to allow this module to be used with different module systems and (eventually) to be used for Node projects too.

This commit converts the project to CommonJS, with a UMD build provided in dist.

What are your thoughts? :)

bethesque commented 9 years ago

We just pulled all the Require code out because it was causing us grief as we were using a project without require js. Is there a way this could be a separate artefact?

markdalgleish commented 9 years ago

I've passed the standalone: 'Pact' option to Browserify, which means that if you're not using a module system, a Pact global variable is created just like the code in master. In fact, the tests in master still pass if you point them at the dist version in my fork.

markdalgleish commented 9 years ago

What I'm thinking is that, by moving to Browserify with UMD builds and using an HTTP client for browser+Node (e.g. axios), this project should be able to work in all environments without any special branching logic.

bethesque commented 9 years ago

A worthy goal! I'm not much of a javascript developer, so I'm going to have to defer to the opinions of someone more experienced than me to review it. @BenSayers, @tarciosaraiva or @redbeard - can you put a second pair of eyes on this and see if it looks like the approach we want?

airmanx86 commented 9 years ago

I am one of the developer from a team previously wanted to add node support to this project, back then about one month ago. We Identified require.js and HTTP client were the issues. Therefore, I completely agree with using UMD. As this project does not need to have dependency on any browser related objects. Regarding using Browserify & axios, it's just a choice of the tool. I believe the goal is 100% valid.

bethesque commented 9 years ago

Cool. Will look at it tomorrow.

bethesque commented 9 years ago

This looks good, will be accepting, just working out what to do about @BenSayers PR.