Closed otajor closed 7 years ago
@shouston3 can you help with this? (I think @otajor is right!) π€
I think this is the desired/expected behaviour in order to be able to stub easily with sinon.stub(sendemail, 'email')
- I don't think it's an unintentional bug.
But should probably have been pushed as v3.0.0 rather than v2.7.0. Maybe @shouston3 could have been clearer that this was a breaking change?
@otajor agreed. let's do that. I'm AFK right now but if anyone has time to write a quick PR we can release a v3 tonight so people aren't "hurt" by this... thanks!
Sorry, I upgraded the readme, but forgot to upgrade the package version
@shouston3 definitely not your fault. all you did was make this package bettererererer!! π It's 100% my bad for not paying closer attention when reviewing the PR. π We're just lucky @otajor is "on the ball"... βοΈ π₯
Is it possible to unpublish versions on npm? Because 2.7.0 still exists with the breaking change, it's still automatically upgrading versions 2.6.0 and below and breaking them
@Danwhy oh... dang! I don't think there is a way to unpublish anymore since the LeftPad Fiasco... What would be a good course of action here...? π€
@nelsonic It seems if the release is more than 24 hours old, you have to contact npm support
@Danwhy I have sent them an email:
This should be done shortly.
Thanks again for letting us know this was hurting you. π π
I don't know if this is now possible but it may be best to release another minor change that reverts the API back to before the major change was made. That way any users of the module with a ^
that automatically upgrades to the most recent minor change will not upgrade to the breaking change.
@roryc89 what is your NPM username? (happy for someone else
to resolve this...)
Hi @nelsonic it's roryc89
@roryc89 you can publish a new version on the 2.x.x stream https://www.npmjs.com/package/sendemail please let me know if you need help with this... π
Problem
Changes to the way the module exports its functions seem to cause breaking changes due to #56. Instead of exporting the
sendemail
function like this:It is now being exported like this:
This causes the error
TypeError: email is not a function
if your code is still expecting the old version.How to fix
The issue can be fixed by changing how you import
sendemail
to reflect the above: Replacewith
Or if you're on an older version of node:
Alternatively, change your package.json to specify a version older than 2.7.0 - maybe a better fix if you're using this in lots of different files.