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

dedupe button #11

Open
3 tasks done
OrbisK opened this issue Feb 3, 2025 · 1 comment
Open
3 tasks done

dedupe button #11

OrbisK opened this issue Feb 3, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@OrbisK
Copy link
Contributor

OrbisK commented Feb 3, 2025

Clear and concise description of the problem

Currently inspector hints for pnpm dedupe

Image

I think with https://github.com/unjs/nypm?tab=readme-ov-file#dedupedependenciesoptions we can add a button to dedupe via backend. (only if not built static or not webcontainer)

Suggested solution

use nypm to trigger dedupe, if possible.

POC:
server:

import process from "node:process";
import {dedupeDependencies} from "nypm";


export default defineEventHandler(async () => {
    await dedupeDependencies({cwd: process.cwd()})
})

frontend:

// if not built or webcontainer
$fetch('/api/dedupe' )

Alternative

No response

Additional context

No response

Validations

@OrbisK OrbisK added the enhancement New feature or request label Feb 3, 2025
@antfu
Copy link
Owner

antfu commented Feb 3, 2025

It might be a nice feature to have, but I am a bit concerned that this would be a bit too babysitting at this moment

  • Due to the complexity of node_mdoules, we can't really do watcher/auto-reload to reflect the latest changes (a manual hard refresh might work tho)
  • To execute commands, we might want to show a terminal and stream back to the front end or so.
  • There might be arguments or more fine-grained operations users might want to use, which would be tricky for us to provide (in another word, the UI is not as expressive as the CLI in terms of the options)
  • If an error occurs, the user will still need to move back to the terminal to handle it.
  • It's not very hard to execute the command by users themselves.

That said, I think this is still a nice improvement to make, but I would deprioritize it a bit to avoid introduce too much complexity to the infra.

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

No branches or pull requests

2 participants