sindresorhus/ora

'ora-classic' legacy package (pre-ESM)

tjohnston-softdev opened this issue · 3 comments

For those of you who ended up breaking their projects by accident after upgrading 'ora' to version 6.x.x, I have published a separate package mirroring version 5.4.1, which was the last version to use the classic CommonJS syntax.

I installed 'ora' for one of my projects the other day and I was shocked that I couldn't get it to work like I normally would. Since this was a new project, I made the decision to just go with the flow and learn the new ESM syntax. However, if I had installed it later on, I would have had to either find a new library, use ESM, or downgrade to a previous version. I took a quick look at some of the closed issues and it is obvious I wasn't the only one annoyed by this. Imagine updating your dependencies for a complex Node JS application only to break it because this one package decided to migrate syntaxes.

If you're not quite ready to make the move to ESM or are maintaining existing code, consider downloading ora-classic instead. I have forked the original repository for this publication so I am not trying to steal nor contradict Sindre's work. I am only offering a simple, convenient option for those who prefer or need to use CommonJS instead of ESM,

npm install ora-classic

I don't really see the point. Switching to ora-classic is exactly the same as just staying on v5.4.1. Ora is quite stable, so staying on v5.4.1 is not missing out on much anyway.

Ora is also often used in async context, and then you could use ESM Ora from CommonJS with dynamic import await import('ore'). More details here.

Imagine updating your dependencies for a complex Node JS application only to break it because this one package decided to migrate syntaxes.

If the user reads the release notes when upgrading a major version (like they should), they would see the upgrade note: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

Thanks @tjohnston-softdev, ora-classic saved me. I was fast prototyping a cli app with esbuild -> vercel/pkg -> windows-executable. Duhh! vercel/pkg only supports cjs. I tried everything possible but ora won't bundle even after rollup or babel transpilation.