braintree / restricted-input

Restrict <input>s to certain valid characters (e.g. formatting phone or card numbers)
https://braintree.github.io/restricted-input/
MIT License
68 stars 25 forks source link

Published artefact includes erroneous code. #43

Closed koddsson closed 7 years ago

koddsson commented 7 years ago

General information

Issue description

The built artifact in the npm registry contains this piece of code:

new RestrictedInput({
  element: document.querySelector('#credit-card'),
  pattern: '{{9999}} {{9999}} {{9999}} {{9999}}'
});

module.exports = RestrictedInput;

This ends up raising a run time exception when the library is imported and the page doesn't include a element with the id credit-card.

Interestingly this piece of code doesn't exist in the actual codebase but rather just the built artefact leading me to believe that it's some sort of publishing slip-up where the latest version wasn't built correctly before being pushed to npm.

If someone could republish with the correctly built artefact that would be 💯.

crookedneighbor commented 7 years ago

I don't think we were intending to send the dist folder to npm, but since we're doing it anyway, we can ensure that the file is built before we do it. 1.2.6 now includes the latest built file.

https://github.com/braintree/restricted-input/commit/0dfdc1c2af2d1683e8e8332972473319a9f706a7

koddsson commented 7 years ago

Thanks!