ForkbombEu / ncr

no‧code‧room: No code REST API server based on zencode natural language smart contracts
4 stars 2 forks source link

fix: install pg-hstore, but kept it as external packege in the rollup configuration file #176

Closed matteo-cristino closed 5 months ago

matteo-cristino commented 5 months ago

@puria this resolves the issue #175, but I'm not so familiar with rollup and I tried to make the pg-hstore an external dependency (since I do not know if it will be use and I didn't want to increase the size of the executable). Do you think this is good or should I incorporate it with all the other dependencies?

puria commented 5 months ago

Hmm, so the thing is, we perform some unique steps to create a single binary executable (Single Executable Application). I guess no one else has tried our approach before! This is very much in the Dyne style, but let me explain what happens:

We transpile all our code.
We transpile all the dependencies (no tree shaking).
We include all the external native modules (like uWs).
Then, we wrap everything inside a bundle with a JavaScript interpreter to create an executable.

This allows machines without any specific tools to run the NCR binary on the correct architecture without needing to install anything. Making the dependencies external means that on the machines where you install NCR, you need to have the JavaScript toolkit. But if you need a JavaScript toolkit, there's no need for all this complexity; you don't need a single binary, right?

Is PostgreSQL necessary for NCR? How much bigger does it make the binary? These are the questions you need to consider, to make a wise decision! I'll leave the last word to you 🥰

matteo-cristino commented 5 months ago

Thank you for the explanation, the package size is 22kB (https://www.npmjs.com/package/pg-hstore), do not know if it is big or not for a npm package... The total dimension of te executable indeed seems not to change, is always around 168 MB. At this point I would proceed to include it anyway to leave the possiblity to use PostgreSQL since it does not come with a high cost.