npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

flu-cli-core

v1.0.2

Published

Core logic for flu-cli

Readme

@flu-cli/core (V6.0)

核心逻辑库,遵循 Task Pipeline (任务流水线) 架构,为 flu-cli 和 VSCode 扩展提供标准化的 Flutter 代码生成与增强能力。

🏗 核心架构:Task Pipeline

从 V6.0 开始,核心生成器由传统的命令式逻辑转变为 原子化任务流水线 架构。

1. 乐高式搭建 (The Lego Model)

ProjectGenerator 不再直接操作文件,而是作为一个 Orchestrator (指挥官)。它通过 ProjectPipeline 编排一系列 IProjectTask

graph LR
    A[ProjectGenerator] --> B(ProjectPipeline)
    B --> T1[FlutterInitTask]
    B --> T2[TemplateCopyTask]
    B --> T3[VariablesReplaceTask]
    B --> T4[NetworkEnrichTask]
    B --> T5[RouteMappingTask]
    B --> T6[HomePatchTask]
    B --> T7[CleanupTask]

2. 骨架 + 增强 (Skeleton + Enrichment)

  • Skeleton (骨架): 从 Git 或本地加载的纯净 Flutter 代码模板。
  • Enrichment (增强): CLI 通过任务流水线动态注入的功能层(如:NetworkEnrichTask 注入 Dio 封装,StateManagerEnrichTask 注入状态管理适配器)。

💡 为什么这么牛?

  • 极简核心: ProjectGenerator.ts 从 1500 行精简至 100 行,逻辑高度内聚于各个 Task。
  • 高可扩展性: 想要支持一个新的功能(如 Sentry 监控、WeChat SDK)?只需编写一个新的 EnrichTask 并加入流水线。
  • 高度解耦: 状态管理、路由注册、环境修复各司其职,互不干扰。
  • 声明式配置: 开发者可以清晰地看到项目生成的每一个步骤。

🚀 核心组件

生成器 (Generators)

  • ProjectGenerator: 采用 Pipeline 模式的项目实例化引擎。
  • Page/ViewModel/Model Generator: 针对不同架构模板的高级代码生成器。
  • Service Generator: 智能服务层生成器,支持自动网络层检测与 Mock 降级。

任务体系 (Tasks)

  • FlutterInitTask: 确保原生 Flutter 环境就绪。
  • TemplateCopyTask: 智能处理模板复制与冗余清理。
  • NetworkEnrichTask: 声明式注入网络层基础设施。
  • RouteMappingTask: 自动扫描业务路径并注册路由表。
  • HomePatchTask: 自动化首页示例入口侵入。

🛠 开发与扩展

如何添加一个新任务?

  1. src/generators/tasks/ 创建实现 IProjectTask 的类。
  2. ProjectGenerator.generate 中通过 .addTask() 链式调用。
pipeline.addTask(new YourAwesomeTask());

📜 许可证

MIT - Copyright © 2025 火叶工作室