Jieiku / abridge

Fast & Lightweight Zola Theme
https://abridge.pages.dev/
MIT License
141 stars 41 forks source link

Fix bug in package_abridge.js #176

Closed Hysterelius closed 1 week ago

Hysterelius commented 1 week ago

There was a bug in the expression for the args in the abridge npm (package_abridge.js) script, which was causing the variable to be undefined.

Due to the string expression always containing ' ', it would always evaluate to true, resulting in undefined behavior. I have fixed it by using a ternary operator to correctly evaluate if it is true.

This created errors like this:

> abridge-bundle@2.0.0 abridge /.../abridge
> node -e "if ( require('fs').existsSync('./themes/abridge/package_abridge.js')) {require('fs').copyFileSync('./themes/abridge/package_abridge.js', './package_abridge.js')}" && node package_abridge.js

args:  undefined, process.argv: /usr/bin/node-20,/.../abridge/package_abridge.js
Zola Build to generate files for minification:
node:internal/errors:984
  const err = new Error(message);
              ^

Error: Command failed: zola build undefined
error: unexpected argument 'undefined' found

Usage: zola build [OPTIONS]

For more information, try '--help'.

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:518:28)
    at Pipe.<anonymous> (node:net:337:12) {
  code: 2,
  killed: false,
  signal: null,
  cmd: 'zola build undefined',
  stdout: '',
  stderr: "error: unexpected argument 'undefined' found\n" +
    '\n' +
    'Usage: zola build [OPTIONS]\n' +
    '\n' +
    "For more information, try '--help'.\n"
}

Node.js v20.12.2
 ELIFECYCLE  Command failed with exit code 1.
netlify[bot] commented 1 week ago

Deploy Preview for abridge ready!

Name Link
Latest commit b5f911cae8ffdba91aa9be1db8e3466abdb0f30c
Latest deploy log https://app.netlify.com/sites/abridge/deploys/667fbd13c2f9740008a814d6
Deploy Preview https://deploy-preview-176--abridge.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Jieiku commented 1 week ago

DOH! surprised I missed that! Thank you very much!

Hysterelius commented 1 week ago

I am not sure where to ask this, but I was wondering why you chose to use elasticlunr in abridge?

I was considering adding flexsearch to abridge, but you might have already evaluated that option. I wanted to check before trying to add it.

Jieiku commented 1 week ago

I opened an issue here https://github.com/Jieiku/abridge/issues/178