midouest / vscode-playdate-debug

Unofficial Playdate debug extension for Visual Studio Code on macOS, Windows and Ubuntu
https://marketplace.visualstudio.com/items?itemName=midouest.playdate-debug
MIT License
34 stars 4 forks source link

IncrementBuildNumber can write undefined keys to PDXInfo file #16

Closed ncocchiaro closed 1 year ago

ncocchiaro commented 1 year ago

When using the incrementBuildNumber option, all PDXInfo keys are output to the PDXInfo file, including optional ones that may have originally not been included. In my case, I don't have the ContentWarning fields in the file, but they get added anyway when my project builds, as follows:

contentWarning=undefined
contentWarning2=undefined

Perhaps this could be fixed by replacing this line with something like this:

  const lines = [];
  for (const key of keyOrder) {
    const value = pdxInfo[key];
    if (value !== undefined) {
      lines.push(`${key}=${value}`);
    }
  }

or with a schema change. However due to my limited familiarity with the TypeScript ecosystem I ran into issues running tests for the extension as well as getting around an error from a pre-commit hook, so I couldn't quite get to verifying and/or PRing in any of those options. I'm happy to leave it to the experts if this is deemed a valid issue :)

midouest commented 1 year ago

Thanks for reporting this! That does seem like the right fix. I’ll look into this