leinelissen / embedded-postgres

🐘 A Node package that allows you to spawn a Postgresql cluster programatically.
MIT License
55 stars 11 forks source link

add __dirname also in the windows-x64 version #14

Closed Miggianox94 closed 2 weeks ago

Miggianox94 commented 2 weeks ago

This is needed to make it work on windows. If not this is the error thrown at runtime:

(node:7164) UnhandledPromiseRejectionWarning: ReferenceError: __dirname is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and 'C:\Users\miggianox\Desktop\p1\desktop\node_modules\@embedded-postgres\windows-x64\package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
  at file:///C:/Users/miggianox/Desktop/p1/desktop/node_modules/@embedded-postgres/windows-x64/dist/index.js:2:36
  at ModuleJob.run (node:internal/modules/esm/module_job:234:25)
  at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
leinelissen commented 2 weeks ago

Hey @Miggianox94, thanks for contributing this! This is actually an issue with importing the package from an ES Module and applies to all modules, not just the one on Windows. Could you apply the change to all packages?

Miggianox94 commented 2 weeks ago

Hey @Miggianox94, thanks for contributing this! This is actually an issue with importing the package from an ES Module and applies to all modules, not just the one on Windows. Could you apply the change to all packages?

Hi @leinelissen , I checked all the other packages and it seems already managed there from what I can see. Could you specify what I should check precisely?

Thank you

leinelissen commented 2 weeks ago

🤦‍♂️

I'm really sorry about this, should've caught this when making the ESM changes. Thanks for pointing it out and submitting the fix!

leinelissen commented 2 weeks ago

All of this is released now, let me know if you run into any other issues!

Miggianox94 commented 1 week ago

Hi @leinelissen , it seems the released package doesn't have the change: could you have a look please? Thank you

https://registry.npmjs.org/@embedded-postgres/windows-x64/-/windows-x64-17.0.0-beta.13.tgz

leinelissen commented 1 week ago

You're absolutely right 🤦‍♂️

The compilation step wasn't properly integrated in my release pipeline, so it skipped over compiling the TypeScript code. I'm making another round of releases right now. They should be available in ~5 minutes. If you would be so kind as to try them out and get back to me, I'd massively appreciate it.

Miggianox94 commented 1 week ago

seems working fine now, thank you! :)