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

@morningfast/create-ui

v1.1.12

Published

Morningfast UI internal system scaffold CLI.

Readme

@morningfast/create-ui

Morningfast UI 公司内部系统脚手架 CLI。

当前阶段用于从 templates/sub-apptemplates/main-apptemplates/workspace 生成业务项目。脚手架只复制用户选择的模板,不会把 monorepo 根目录、docspackages/create-ui 源码复制进业务项目。

本地构建

morningfast-ui 仓库根目录执行:

pnpm --filter @morningfast/create-ui build

构建后会生成:

packages/create-ui/dist/index.js
packages/create-ui/dist/templates/main-app
packages/create-ui/dist/templates/sub-app
packages/create-ui/dist/templates/workspace

使用本地构建产物交互生成:

node packages/create-ui/dist/index.js

也可以直接跑源码调试:

pnpm --filter @morningfast/create-ui dev

交互生成

使用已发布到 npm 的线上版本时,可以在任意希望放置新项目的目录执行:

pnpm dlx @morningfast/create-ui

脚手架会依次询问:

生成类型 sub-app(子应用)/workspace(主子应用 monorepo)/main-app(单独主应用)
项目目录
系统名
后端代理地址(main-app / workspace)
是否保留 demo

不确定时直接回车,脚手架会使用默认值。

命令生成

生成默认子应用:

pnpm dlx @morningfast/create-ui my-sub

生成主应用:

pnpm dlx @morningfast/create-ui my-main --template main-app

生成主应用并移除 demo:

pnpm dlx @morningfast/create-ui my-main --template main-app --no-demo

生成子应用:

pnpm dlx @morningfast/create-ui my-sub --template sub-app

生成业务 monorepo:

pnpm dlx @morningfast/create-ui my-platform --template workspace

在已生成项目根目录更新:

pnpm dlx @morningfast/create-ui --update

也可以在项目外指定 workspace 根目录更新:

pnpm dlx @morningfast/create-ui my-platform --update

--update 必须在 workspace 根目录执行,或显式传入 workspace 根目录。它会读取根目录 .morningfast-ui.json, 再扫描 apps/*/.morningfast-ui.json,按模板类型识别主应用和所有子应用。

默认更新整个 monorepo:

pnpm dlx @morningfast/create-ui --update

只更新主应用:

pnpm dlx @morningfast/create-ui --update --update-target main

只更新所有子应用:

pnpm dlx @morningfast/create-ui --update --update-target sub-apps

更新只覆盖 .morningfast-ui.json 里声明的 managedRoots。业务页面、业务接口模块和业务路由默认不覆盖; package.json.morningfast-ui.json 采用受控合并,保留业务项目 name、自定义字段和本地配置, 只补齐模板依赖、脚本、engines、托管清单和版本信息。

执行 --update 前必须保证 git 工作区干净。更新还会校验托管文件 hash:如果 src/main.tssrc/App.vuevite.config.ts 等托管文件被业务手动改过,即使已经提交,也会停止更新,提示先迁移到 src/setup.tssrc/AppRoot.vuevite.business.config.ts 等扩展文件。

hash 是按文件完整内容计算的,空格、换行和 CRLF/LF 变化都会触发冲突。冲突时脚手架会提供三份文件:

  • base:上一次脚手架托管快照,位于 .morningfast/managed-snapshots/**
  • current:项目当前文件。
  • next:本次新模板候选,位于 .morningfast-update-conflicts/**

如果确认只是格式差异,可以按提示用 cp base current 恢复托管文件后重新更新。

平台运行时已经迁到 @morningfast/platform npm 包。生成出去的业务项目通过依赖升级获取平台能力,不再复制 src/morningfast-core/**。业务代码写在 src/pages/**src/stores/**src/api/modules/**src/router/business-routes.tssrc/app.config.ts,更新不覆盖。

根目录文件按 .morningfast-ui.json 的几类规则维护:

  • managedRoots:脚手架托管文件或目录,--update 可以覆盖,例如 src/main.tssrc/App.vuevite.config.tstsconfig.app.json
  • ensureRoots:缺失补齐文件或目录,初始化会生成,--update 只在目标不存在时补齐,存在则不覆盖,例如 public/release.json 这类业务可接管文件。
  • preservedRoots:项目环境、部署和业务代码,--update 不覆盖,例如 .env.development.env.exampleindex.html、业务 src/pages
  • mergeFiles:受控合并文件,目前是 .morningfast-ui.jsonpackage.json

后续模板新增文件时先判断职责:入口壳、构建配置、类型声明等会影响统一升级的文件放入 managedRoots; 初始化应带上、后续只想给老项目补缺口且不覆盖业务的文件放入 ensureRoots;项目环境变量、部署配置、业务页面、业务请求和业务状态放入 preservedRoots;需要保留项目自定义字段又要补齐模板字段的文件放入 mergeFiles,并在 CLI 里实现对应合并逻辑。

指定系统初始名:

pnpm dlx @morningfast/create-ui my-main --system-name "FMS 管理系统"

生成完成后进入新项目:

cd my-main
pnpm install
pnpm dev

当前支持的替换

  • package.jsonname 会替换为目标项目名。
  • 系统初始名会替换到模板默认标题。
  • main-app 的 nginx 静态资源目录会按项目名替换。
  • main-app 可选替换 nginx 的 proxy_pass
  • 默认模板是 sub-app,单独主应用需要显式传 --template main-app
  • --no-demo 会删除 src/pages/demo、对应示例路由和示例子应用配置,main-app / sub-app 都适用。
  • --update 只能在 workspace 根目录执行,支持 allmainsub-apps 三种更新目标。

不处理的内容

  • 接口请求前缀统一放在 src/api/base-urls.ts,默认是 /api.env.development 只放本地代理目标等开发期变量。
  • --update 只覆盖脚手架托管白名单文件,不做业务代码三方合并;业务文件升级通过组件库、共享包、迁移说明或 codemod 处理。
  • sub-app 当前保持轻量,不包含主应用布局和系统设置;公共组件统一从 morningfast-plus/components 引入。