vn7n24fzkq / github-profile-summary-cards

A tool to generate your github summary card for profile README
https://github-profile-summary-cards.vercel.app/demo
MIT License
2.6k stars 313 forks source link

fix: Donwgrade d3 to v6 for v7 breaking changes 🔽 #124

Closed yamashush closed 1 year ago

yamashush commented 1 year ago

May not be working after merged #109 😢

$ npm run build

> github-profile-summary-cards@0.5.2 build
> tsc

$ npm run run yamashush 9

> github-profile-summary-cards@0.5.2 run
> node -r dotenv/config lib/app.js yamashush 9

/Users/yamashu/dev/github-profile-summary-cards/lib/templates/card.js:23
const d3 = __importStar(require("d3"));
                        ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/yamashu/dev/github-profile-summary-cards/node_modules/d3/src/index.js from /Users/yamashu/dev/github-profile-summary-cards/lib/templates/card.js not supported.
Instead change the require of index.js in /Users/yamashu/dev/github-profile-summary-cards/lib/templates/card.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/yamashu/dev/github-profile-summary-cards/lib/templates/card.js:23:25)
    at Object.<anonymous> (/Users/yamashu/dev/github-profile-summary-cards/lib/templates/profile-details-card.js:26:16)
    at Object.<anonymous> (/Users/yamashu/dev/github-profile-summary-cards/lib/cards/profile-details-card.js:18:32)
    at Object.<anonymous> (/Users/yamashu/dev/github-profile-summary-cards/lib/app.js:32:32) {
  code: 'ERR_REQUIRE_ESM'
}

d3 v7.0.0 have several breaking changes. https://github.com/d3/d3/releases/tag/v7.0.0

I just checked that it worked when I switched back to v6.

yamashush commented 1 year ago

@vn7n24fzkq I hope you will take a look when you are free 😄

vn7n24fzkq commented 1 year ago

Oh, thanks! Can we modify the code to suit the new d3? I will check it later.

yamashush commented 1 year ago

We could have solved this problem. I'll make a PR :)

vn7n24fzkq commented 1 year ago

Great!

yamashush commented 1 year ago

If #125 is merged, I will close this PR. We'll leave this until then.