ActiveCampaign / activecampaign-api-nodejs

Node.js wrapper for the ActiveCampaign API
MIT License
39 stars 36 forks source link

Use Rollup.js to create UMD package so that this can be used in the browser #47

Closed bartboy011 closed 6 years ago

bartboy011 commented 6 years ago

Currently this package can only be used in Node.js projects, even with a build pack (due to the dynamic require statements). It would be much more useful if this package could be used in all JS environments. This PR introduces Rollup.js as a buildpack to create a UMD package that can be used in all environments, including the browser as a drop-in file.

Additionally, I've added Babel to the build system so that ES6 can be used without concern.

Finally, I've removed the examples folder as it was redundant and added unnecessary weight to installs.

@ActiveCampaign/integration

bartboy011 commented 6 years ago

After doing some browser testing I discovered that there were some issues in the build. I retooled the build and that exposed issues with the request library. I replaced request with axios, this finally got everything working, at which point I discovered that we don't set CORS headers... This package is now in great shape, but without those headers in our API it is still unusable in the browser.

See this for clarity: http://screen.ac/3S460k071A2l

bartboy011 commented 6 years ago

@cristiangrama This is ready for a review + merge!

bartboy011 commented 6 years ago

@cristiangrama Updated!