Skip to content

Added Base Package.json Page#61

Open
AlexanderKaran wants to merge 10 commits intomainfrom
package-json-scan
Open

Added Base Package.json Page#61
AlexanderKaran wants to merge 10 commits intomainfrom
package-json-scan

Conversation

@AlexanderKaran
Copy link
Copy Markdown
Collaborator

@AlexanderKaran AlexanderKaran commented May 2, 2026

PR 1/3

I built the full functionality and the PR would have been huge, so to keep things simple and easy to review, I have broken things up. Also learning Svelte and more can go wrong in one huge PR

First PR covers the paste in package.json; second, the local file; and third, the remote file. I have not linked this page on the homepage until we add all functionality, unless you want me to.

  • Turned the submit form button into a component to re-use
  • Built form for submitting package.json
  • Display results of scan
  • Auto submit on paste
  • Added e2e test
  • Links to the details page for each package

I scaled the UI back from the demo to keep it simple and to the point.

Screen Recording 2026-05-02 at 8 04 33 pm

Mobile view

Scan-package-json-replacements-fyi-05-02-2026_08_09_PM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 2, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
module-replacements-app 2e53cc2 May 10 2026, 12:30 PM

Comment thread src/routes/package-json/+page.server.ts Outdated
Comment thread src/routes/package-json/+page.server.ts Outdated
AlexanderKaran and others added 2 commits May 3, 2026 16:00
Co-authored-by: James Garbutt <43081j@users.noreply.github.com>
Co-authored-by: James Garbutt <43081j@users.noreply.github.com>
@43081j
Copy link
Copy Markdown
Contributor

43081j commented May 3, 2026

i think an input is the wrong choice of form control.

we're basically either:

  • drag/dropping a file
  • pasting a file
  • pasting text

so i'd actually just have a drop zone and a paste handler on the window.

that way if i paste something in the page in general, it gets "dropped". meanwhile, if i drag/drop onto the dropzone, it also gets dropped.

Comment thread src/routes/package-json/+page.svelte Outdated
{:else}
<div class="empty-state">
<p class="empty-copy">
We checked your dependencies against the replacement directory and did not find any
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it'd be nice to reword this to be a bit more of a celebration message.

maybe we can even style it like a success message some way. so its more like "No replaceable dependencies were found. Your package is clean! 🎉 " but better wording

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I actually had a gift in here but removed as I thought it was too silly.

Will make it a celebration.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@43081j How is this

Screenshot 2026-05-03 at 6 04 34 pm

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added the internet 90s kid lol maybe to fun

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd maybe make the subtitle something more like "Your dependencies look good!"

The meme is good fun 😄 but let's see what the others think

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Wording changed will wait to see what the others say

@AlexanderKaran
Copy link
Copy Markdown
Collaborator Author

i think an input is the wrong choice of form control.

we're basically either:

  • drag/dropping a file
  • pasting a file
  • pasting text

so i'd actually just have a drop zone and a paste handler on the window.

that way if i paste something in the page in general, it gets "dropped". meanwhile, if i drag/drop onto the dropzone, it also gets dropped.

Sorry @43081j missed this comment.

So this is actually based on NPMGraph, which uses an input. This is just the first PR, which does paste package.json. In the second PR, we will drag or paste in a local file. It will come with a drop zone and some changes but around the input like NPMGraph.

Happy to change if you do not like. I tested there out and liked it so copied it lol

@43081j
Copy link
Copy Markdown
Contributor

43081j commented May 3, 2026

npmgraph doesn't paste into the input, though.

the handler picks it up regardless of what is focused. the input is just used to search by name.

so im agreeing with what npmgraph does, but we don't need a search in our case, which is why i think a dropzone rather than an input makes more sense even beyond this PR

@paoloricciuti
Copy link
Copy Markdown
Collaborator

Not able to review yet but just to chime in, I think we should have an input there for the users who are still loading JS

Comment thread src/routes/package-json/+page.server.ts Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just as an additional comment: once we switch to remote functions it could be useful to also extract the logic to find the replacements and use the enhance method so that if JS is enabled we don't go to the server and we just do the same logic on the client.

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.

3 participants