web-infra-dev / modern.js

Modern.js is a web engineering system, including a web framework and a npm package solution.
https://modernjs.dev/en/
MIT License
4.26k stars 351 forks source link

[Feature]: Avoid modifying existing codes/configs when init modernjs from an existing repo #5837

Open yf-yang opened 3 weeks ago

yf-yang commented 3 weeks ago

What problem does this feature solve?

I am trying to convert a module repo to modern.js module, so I run pnpm create @modern-js, it is the recommended way to init an existing repo. Actually it does the following:

  1. Update package.json (overrides everything)
  2. Update src/index.ts
  3. Commit working changes

Change 1 is unpleasing as existing repo has its own dependencies, scripts... Change 2/3 are unexpected. Editors could have caches and those changes are not even explicitly notified, so I spent hours figuring out if rspack etc. have bugs.

Suggestion:

  1. When enabling modern.js in an existing repo, do incremental change instead of complete overwrite.
  2. Notify the file changes, git commits, and anything else that I haven't even observed.

What does the proposed API look like?

Nope