braintree / braintree-web

A suite of tools for integrating Braintree in the browser
https://developer.paypal.com/braintree/docs/start/hello-client/javascript/v3
MIT License
444 stars 134 forks source link

Migrating from Bower - missing client.debug.js and hosting.debug.js - code is different too #668

Closed JustinGol closed 1 year ago

JustinGol commented 1 year ago

General information

Issue description

I am moving away from Bower as our package manager to NPM but theres a discrepancy in getting the packages in NPM vs Bower.

Expected

Current

In my npm package.json devDependency I tried to use the braintree-web-bower git repository 3.16.0 as the source as an alternative but it doesnt have a package.json file so that doesnt work either.

Ive resorted to running this script as a last resort but I dont get vulnerability scanning with this which is one of the goals for moving to npm.

  "scripts": {
    "prepare": "git clone -b 3.16.0 ssh://git@github.com/braintree/braintree-web-bower"
  `},
cgdibble commented 1 year ago

Hey, @JustinGol, that is actually an expectation. The same versions of the SDK are built and shipped to NPM and Bower, but historically were set up with different structures therein. The build processes are different, as the process for Bower involves building everything into a single file for, say, hosted-fields. In NPM it doesn't do that, so they aren't going to match.

While the means of interacting with them through the different package managers is unfortunately different, the functionality and integration pattern itself therein are identical.

JustinGol commented 1 year ago

Hey, @JustinGol, that is actually an expectation. The same versions of the SDK are built and shipped to NPM and Bower, but historically were set up with different structures therein. The build processes are different, as the process for Bower involves building everything into a single file for, say, hosted-fields. In NPM it doesn't do that, so they aren't going to match.

While the means of interacting with them through the different package managers is unfortunately different, the functionality and integration pattern itself therein are identical.

Thanks for your reply. We currently have a reference to a single file which is bundled braintree-web-bower/client.js. Would we technically need to bundle all the files in npm to achieve the same effect?

cgdibble commented 1 year ago

You can still import the modules within independently, so you can reference braintree-web/client. The docs on that are here as well: https://developer.paypal.com/braintree/docs/guides/client-sdk/setup/javascript/v3#npm