Skip to content

feat(create-farm): rewrite create farm#2102

Open
fu050409 wants to merge 465 commits intomainfrom
feat/rewrite-create-farm
Open

feat(create-farm): rewrite create farm#2102
fu050409 wants to merge 465 commits intomainfrom
feat/rewrite-create-farm

Conversation

@fu050409
Copy link
Member

@fu050409 fu050409 commented Feb 26, 2025

Resolved: #2091


Roadmap

  • Refactor chore works after asking users

  • Other chore works

    • Biome init and it's dependency
    • Oxlint init and it's dependency
    • Suggest users our plugin echosystems
  • Auto detect if a project exists, if the project is based on Vite or Rspack, ask user to migrate to farm.


Current works like

t-rec

fu050409 and others added 7 commits February 13, 2025 19:44
* fix: clippy issue

* fix: example panic when start

* fix: runtime should not be emitted twice for a single bundle
fix: tree shake, HMR and source map issues
* fix(schema): invalid server schema with types

* chore: optimize types and schema

---------

Co-authored-by: ADNY <66500121+ErKeLost@users.noreply.github.com>
* feat: add js plugin freeze_modules hooks

* chore: remove unless code

* chore: update code

* chore: remove format

* chore: update code

* chore: update types

* chore: update code

* chore: update code

* chore: update code

* chore: update code

* chore: add module_hook_common
* chore: write generate resource moves into rust side

* chore: update generate resource write

* feat: add rust plugin file size

* chore: update file-size plugins

* chore: update file-size plugins

* chore: update code

* chore: update code

* chore: rewrite writeResourceToDisk

* chore: remove unless file

* chore: remove file size in farm crate

* chore: remove file size in farm crate

* chore: remove file size in farm crate

* chore: add schema
@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2025

⚠️ No Changeset found

Latest commit: 43e02c4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "farm-docs" is specified in the `ignore` option but it is not found in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@fu050409 fu050409 added the WIP Working in progress label Feb 26, 2025
@fu050409 fu050409 requested a review from ErKeLost February 27, 2025 02:28
@ErKeLost
Copy link
Member

I think we should try not to make things too complicated, such as package manager and initializing git. We need to allow users to quickly access the project. These tasks should be considered by higher-layer frameworks.

@fu050409
Copy link
Member Author

fu050409 commented Feb 27, 2025

@ErKeLost Personally, I think the role of CLI tools is to save the user as much time as possible, and integrating tasks that may need to be performed in a CLI tool can help the user start a new project faster. In fact, in addition to making it clearer to maintain our CLI tools, the new architecture also makes it easier to expand the functionality of create-farm more quickly, and even create more subtasks for different package managers or template projects. For example, 他和 new version of pnpm has a security mechanism that causes Electron's dependency installations to fail, we can perform more actions or give more hints specifically for pnpm.

As you can see, special customizations are also done in create-vue for templates, such as JSX support, Vue Router configuration, Pinia and Vitest. So while this leads to making more choices when creating a project, it can be more convenient for the user. Besides, create-tauri-app also provides lots of choices for the user.

We could also follow this design, which would allow users to explore many of Farm's features earlier. In my vision, I would add some interesting optional generic plugins to create-farm, such as unpluin's imagemin, or our @farmfe/plugin-compress, and so on. The fact that we are currently facing the problem that many users don't find Farm's plugin ecosystem very quickly, which makes some users waste a considerable amount of time when using Farm, I think that these problems can be solved partially in create-farm, as this is something that almost every user starting Farm needs to do.

I followed the user needs oriented basis in the new refactoring to create less extraneous code while helping users with more tasks in the CLI tools. In the Git initialization task, I bind the .gitignore file to .git, since projects decoupled from Git don't seem to need a .gitignore file either. If you don't mind, maybe I can configure the Git initialization task and the tasks like configure biome or vitest in one task. We could consolidate the tasks in create-vue into one multi-select task, this can reduce the number of choices.

Of course, if you're sure we don't need to do that, I'll change the code later.

@ErKeLost
Copy link
Member

ErKeLost commented Mar 4, 2025

@fu050409

On the one hand, since we are a basic framework, we should ensure user friendliness as much as possible, enabling students who are just starting to learn front-end development, for example, to use and understand the functions of this framework more quickly starter.
On the other hand, based on many users' feedback or my own experience with some scaffolding tools and projects I've participated in before, users believe that the fewer configurations for this type of basic framework, the better. Maybe at first, people just want to test something and don't need to keep choosing configurations. This is my personal opinion.

@fu050409
Copy link
Member Author

fu050409 commented Mar 4, 2025

@ErKeLost Thanks for the advice, I know what u are thinking abount but I still reserve my opinion.

I asked some working front-end engineers for their opinion in order to solve this problem, and it looks like the problem exists in both of the scenarios we mentioned. Some engineers prefer a strong scaffolding, but some of my friends (who may be using farm for the first time or are new to front-end development) object to the complexity this may bring.

Maybe we could use a compromise solution, such as letting users choose whether to go further or not, which would triage users: for those who want to test something or get up to speed with farm as soon as possible, they could choose no at this step, and for the other group of users who choose yes, our create-farm scaffolding could do the work for them more work for them.

WDYT? I think this could both avoid the complexity for new comers and get better user exprience for advanced users which can improve the user friendliness.

@ErKeLost
Copy link
Member

ErKeLost commented Mar 4, 2025

I personally think this might not be what the create farm needs to do. If more powerful features are required, we can simply start a new scaffolding to handle these. This kind of issue is rather subjective. I also know that everyone will have different views. Everyone bases their opinions on their own experiences. We can ask for everyone's opinions.

@fu050409
Copy link
Member Author

I'll be moving forward with this one, and next I'll be placing all the other miscellaneous tasks after asking the user if they've decided to continue, as a way of accommodating the usage preferences of different user types.

@fu050409 fu050409 changed the base branch from v2-dev to main November 30, 2025 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WIP Working in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants