Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed export from default to named #701

Closed
pawel-id opened this issue Oct 3, 2023 · 6 comments · Fixed by #702 or #706
Closed

Changed export from default to named #701

pawel-id opened this issue Oct 3, 2023 · 6 comments · Fixed by #702 or #706
Assignees
Labels
bug Something isn't working

Comments

@pawel-id
Copy link
Contributor

pawel-id commented Oct 3, 2023

We are using this tool as an imported module in our deployment tool. It works perfectly. Unfortunately we noticed that along with the latest v5.26.0 some breaking change has been introduced. Previously (i.e. v5.25.2 and older) the main function was exported as a default export. Then in order to consume the following code was required:

const sgd = require('sfdx-git-delta')
await sgd({params})

That way is still in readme, however the behaviour has changed to named export, and now it requires:

const { sgd } = require('sfdx-git-delta')
await sgd({params})

It would be great to follow semantic versioning rules and not to introduce breaking changes with minor changes. In other words please keep default export when doing minor version bumps.

@pawel-id pawel-id added the bug Something isn't working label Oct 3, 2023
@scolladon
Copy link
Owner

Hi @pawel-id !

Thanks for raising this issue and thanks for contributing in making this project better!

Yep you're right, it is a breaking change in a minor version without communication.
It is breaking the semantic versioning rules and is a regression.
This bug is not wanted from our side, it comes from our migration to typescript big refactoring.

Here are how we suggest to deal with that:

  1. keep it this way, update the readme and the release note for v.5.26.0
  2. come back to the previous behavior (wich would be a breaking change introduced into a minor version but maybe it is ok as it fixes the bug)

What would be your preferred solution? 1 or 2?
image

@pawel-id
Copy link
Contributor Author

pawel-id commented Oct 4, 2023

It happens. I would treat it as a bug and restore previous behavior, then release v5.26.1. From semantic versioning point of view this is proper way to fix.

@scolladon
Copy link
Owner

Option 2 it is !
Welcome to the matrix

@github-actions
Copy link

github-actions bot commented Oct 4, 2023

Shipped in release v5.26.1.
You can install the new version using the version number or the latest-rc channel

$ sfdx plugins:install sfdx-git-delta@latest-rc
$ sfdx plugins:install [email protected]

Happy incremental deployment!

@pawel-id
Copy link
Contributor Author

pawel-id commented Oct 5, 2023

It seems typescript clause export default sgd is translated into exports.default = sgd which is somehow different that expected module.exports = sgd. Then having this approach in order to import this we need to do some extra work:

const sgd = require('module').default

or

import sgdDefault from 'module'
const sgd = sgdDefault.default

@github-actions
Copy link

github-actions bot commented Oct 9, 2023

Shipped in release v5.26.2.
You can install the new version using the version number or the latest-rc channel

$ sfdx plugins:install sfdx-git-delta@latest-rc
$ sfdx plugins:install [email protected]

Happy incremental deployment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants