Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible regression in 0.16: formats is now mandatory #98

Closed
5 of 7 tasks
julien-deramond opened this issue Nov 8, 2024 · 1 comment · Fixed by #99
Closed
5 of 7 tasks

Possible regression in 0.16: formats is now mandatory #98

julien-deramond opened this issue Nov 8, 2024 · 1 comment · Fixed by #99

Comments

@julien-deramond
Copy link
Contributor

Describe the bug

Hello there!

I've spotted a regression while bumping sponsorkit from 0.15.5 to 0.16.0 (and so, 0.16.1).
It's a regression from my point of view, but I can perfectly understand if you don't consider it is a regression. In that case, you can close this issue right away :)

The working version with 0.15.5 is the main branch of https://github.com/julien-deramond/static.
The issue happens within this PR julien-deramond/static#7.

In order to execute it locally, you can:

pnpm i
SPONSORKIT_GITHUB_TOKEN=ghp_xxxxxxx SPONSORKIT_GITHUB_LOGIN=your_login pnpm build
# `SPONSORKIT_GITHUB_TOKEN=ghp_xxxxxx SPONSORKIT_GITHUB_LOGIN=julien-deramond pnpm build` for me

This will run https://github.com/julien-deramond/static/blob/main/build.sh which are basic commands, and here is the configuration: https://github.com/julien-deramond/static/blob/main/sponsorkit.config.ts.

The error is for each image:

Node.js v20.12.2
                                                                                                                                  7:20:46 AM
SponsorKit v0.16.1

✔ Loaded from cache ./.cache.json                                                                                                7:20:46 AM
✔ [sponsors.wide] Wrote to ./sponsors.wide.json                                                                                  7:20:46 AM
ℹ [sponsors.wide] Composing SVG...                                                                                               7:20:46 AM
node:internal/fs/promises:1049
    validateStringAfterArrayBufferView(data, 'data');
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at Object.writeFile (node:internal/fs/promises:1049:5)
    at file:///Users/ju/static/node_modules/.pnpm/[email protected]/node_modules/sponsorkit/dist/cli.mjs:359:19
    at Array.map (<anonymous>)
    at applyRenderer (file:///Users/ju/static/node_modules/.pnpm/[email protected]/node_modules/sponsorkit/dist/cli.mjs:337:29)
    at async run (file:///Users/ju/static/node_modules/.pnpm/[email protected]/node_modules/sponsorkit/dist/cli.mjs:300:5)
    at async Object.handler (file:///Users/ju/static/node_modules/.pnpm/[email protected]/node_modules/sponsorkit/dist/cli.mjs:406:5) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Analysis

It appears that now, the formats parameter is mandatory. If I add the following, the script works again:

diff --git a/sponsorkit.config.ts b/sponsorkit.config.ts
index 9028a7f..ec96179 100644
--- a/sponsorkit.config.ts
+++ b/sponsorkit.config.ts
@@ -12,6 +12,7 @@ const past: BadgePreset = {
 }
 
 export default defineConfig({
+  formats: ['svg', 'png'],
   tiers: [
     {
       title: 'Past Sponsors',

So, it's not an issue on my side, I'll update my project to make it work with the mandatory option, but I just wanted you to know that formats is now mandatory, wasn't before, in case it's an unwanted side effect :)

Reproduction

julien-deramond/static#7

System Info

System:
    OS: macOS 15.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 30.34 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
    pnpm: 9.4.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 130.0.6723.117
    Safari: 18.1

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Contributions

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)
@privatenumber
Copy link
Member

Thanks for the issue! If you're interested, please feel free to open a PR for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants