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

feat: Add script to get npm package data #499

Merged
merged 38 commits into from
Dec 17, 2023
Merged

feat: Add script to get npm package data #499

merged 38 commits into from
Dec 17, 2023

Conversation

lachlancollins
Copy link
Collaborator

@lachlancollins lachlancollins commented Nov 22, 2023

🎯 Changes

This PR adds auto-fetching package data from npm. The scripts/updateNpm.js script runs the npm CLI in parallel to get info listed here. For now, I've set it to save the latest release date, latest version (useful to show how up-to-date the info is and for other tools such as publint), and svelte peerDep (if available).

For now, the latest version and date are added to the package card (if it exists). The date is rendered as a relative date using dayjs. I've moved the repo button from the bottom-left to the top-right of the card (this was the most space-efficient arrangement of stars, repo and date I could pick).

Before:

image

After:

image

✅ Checklist

  • I have given my PR a descriptive title
  • I have run pnpm run lint locally on my changes

Copy link

netlify bot commented Nov 22, 2023

Deploy Preview for sveltesociety-preview ready!

Name Link
🔨 Latest commit 4853733
🔍 Latest deploy log https://app.netlify.com/sites/sveltesociety-preview/deploys/657f6af9d92ffc00089ea219
😎 Deploy Preview https://deploy-preview-499--sveltesociety-preview.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.

Copy link
Collaborator

@MacFJA MacFJA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about creating a file by data type 🤔

If the data were to be updated separately, it could make sens, but here everything is updated together at each run

scripts/updateNpm.js Outdated Show resolved Hide resolved
scripts/updateNpm.js Outdated Show resolved Hide resolved
@lachlancollins
Copy link
Collaborator Author

I'm not sure about creating a file by data type 🤔

If the data were to be updated separately, it could make sens, but here everything is updated together at each run

Yep for sure, definitely makes sense - I started off just with a versions.json then it grew!

Which one of these do you think would be better?

"versions": {
		"super-sitemap": "0.14.11",
		"svelte-scrollactive": "0.0.9",
		...
"super-sitemap": {
		"version": "0.14.11",
		"date": "2023-11-18T20:28:44.230Z",
		...

@lachlancollins lachlancollins changed the title Add script to get npm data feat: Add script to get npm data Dec 17, 2023
@lachlancollins lachlancollins marked this pull request as ready for review December 17, 2023 06:24
@lachlancollins lachlancollins changed the title feat: Add script to get npm data feat: Add script to get npm package data Dec 17, 2023
Copy link
Collaborator

@MacFJA MacFJA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would reduce the font size of the date.

It's a bit too "in your face" right now. It has the same font-size as the description, making it as important as the description.

Also, I don't find use <code> revelant here, it's a "none-technical" information nor a number

@lachlancollins lachlancollins merged commit 7745107 into svelte-society:main Dec 17, 2023
5 checks passed
@lachlancollins lachlancollins deleted the update-npm-data branch December 17, 2023 23:37
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 this pull request may close these issues.

None yet

2 participants