Site.js breaks with npx; must not assume is in git working directory if run as node module
The current implementation assumes that if Site.js is being run as a Node module, it is being done so during development and thus from a git working directory.
This causes a crash with the following error, if, for example, you run npx @small-tech/site.js
:
npx: installed 209 in 24.976s
fatal: not a git repository (or any of the parent directories): .git
❌ ❨site.js❩ Error: Could not disable privileged ports. Cannot bind to port 80 and 443. Exiting. Error:Command failed: pushd /home/aral/.npm/_npx/9729/lib/node_modules/@small-tech/site.js > /dev/null; git log -1 --oneline
fatal: not a git repository (or any of the parent directories): .git
at checkExecSyncError (child_process.js:630:11)
at Object.execSync (child_process.js:666:15)
at Function.readAndCacheManifest (/home/aral/.npm/_npx/9729/lib/node_modules/@small-tech/site.js/index.js:92:37)
…
We must not assume that Site.js is being run from a git working directory if run from outside of a Nexe binary.
This issue has also been reported in the wild.
See: https://github.com/small-tech/site.js/issues/20#issuecomment-723048260