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

@minij/cli

v0.0.7

Published

minij 一键建站方案 - 本地触发端

Downloads

889

Readme

@minij/cli

minij 一键建站方案的本地触发端,主要面向 AI 助手调用,负责本地项目初始化、模板替换,并协调 minij-orchestrator-server 完成 GitLab 仓库创建和 CI/CD 变量注入。

注意:需在minij 608 内网中使用。 orchestrator 服务固定部署在 http://192.168.50.41:8888,不在内网无法连接。


安装

npm install -g @minij/cli
# 或
pnpm add -g @minij/cli

前置要求

  • Node.js >= 18
  • pnpm
  • Git
  • SSH 公钥已配置到 git.minij.com
  • 处于minij 608 内网环境

命令

minij create <name>

一键创建 BI 项目或纯前端项目:克隆模板 → 替换项目名 → 创建 GitLab 仓库 → 注入 CI/CD 变量 → 初始化 git 并推送。

# 创建纯前端项目(默认)
minij create my-project

# 显式指定创建纯前端项目
minij create my-frontend-project --type frontend

# 创建 BI 项目
minij create my-bi-project --type bi --port 3002

选项

| 选项 | 说明 | |------|------| | -t, --type <type> | 项目类型(bi/frontend,默认 frontend) | | -p, --port <port> | Node 服务端口,范围 3000-3100,默认 3001(仅适用于 BI 项目) |

执行流程

  1. 根据项目类型选择模板:
  2. 删除 .git 目录
  3. 根据项目类型替换模板内容:
    • BI 项目:替换 frontend/backend/ 中的模板名和配置
    • 纯前端项目:替换根目录中的模板名和配置
  4. 生成 .minijrc.json,记录项目来源模板、项目元信息和创建进度,供后续 sync-templatecontinue-create 使用
  5. 调用 orchestrator POST /api/create-repo 创建 GitLab 私有仓库
  6. 调用 orchestrator POST /api/setup-ci-variables 注入 CI/CD 变量
  7. 初始化本地 git 并推送到远程仓库
  8. 若流程因内网、SSH、GitLab 服务异常中断,可通过 minij continue-create <name> 继续执行剩余步骤

完成后输出

✓ 项目 my-project 创建完成!

目录: /path/to/my-project
远程仓库(SSH): [email protected]:dataverse/my-project.git
远程仓库(HTTPS): https://git.minij.com/dataverse/my-project
Node 端口: 3002

提示:GitLab CI/CD 正在构建,约 20S后可访问

访问地址:
https://dataverse.minij.com/DataVerse/my-project/

minij continue-create <name>

minij create 因网络、SSH 或 GitLab 服务异常在中途中断时,本地项目已生成但远程流程未完成,可通过此命令继续执行剩余步骤。

这是 AI 助手在检测到创建中断时应首先尝试的恢复命令,禁止手动执行 git 操作代替它。

minij continue-create my-project
# 别名
minij resume-create my-project

恢复逻辑

该命令读取项目根目录的 .minijrc.json 中的进度状态,自动跳过已完成步骤:

| 步骤 | 判断依据 | 未完成时执行 | |------|----------|-------------| | 创建 GitLab 仓库 | gitlabProjectId 是否存在 | POST /api/create-repo | | 绑定 CI/CD 变量 | ciVariablesSetup 是否为 true | POST /api/setup-ci-variables | | 初始化本地 git | gitInitialized 是否为 true | git init → remote → commit | | 推送初始代码 | initialPushDone 是否为 true | git push -u origin main |

已完成的步骤会直接跳过,输出"跳过"提示。

安全边界

  • 本地目录不存在:报错,提示先执行 minij create
  • 本地目录存在但无 .minijrc.json:报错,无法识别未完成的任务。
  • .minijrc.json 中的项目名与命令参数不一致:报错,防止误操作。
  • 所有步骤均已完成(initialPushDone: true):直接输出创建完成信息,不重复执行。

也可通过重新执行 minij create <name> 触发自动续跑,效果相同。


minij sync-template

同步当前项目的模板架构代码。该命令会读取项目根目录下的 .minijrc.json,自动识别项目最初是从哪个模板创建而来,然后仅同步白名单中的架构文件,不覆盖业务代码。

# 预览将要同步的文件
minij sync-template --dry-run

# 同步模板架构代码
minij sync-template

# 跳过确认,直接同步
minij sync-template --force

选项

| 选项 | 说明 | |------|------| | --dry-run | 仅预览将要同步的文件,不实际修改项目 | | --force | 跳过确认,直接执行同步 |

同步机制

  1. 读取项目根目录的 .minijrc.json
  2. 自动识别来源模板类型(bi / frontend
  3. 拉取对应模板最新代码到临时目录
  4. 只同步白名单中的架构文件
  5. 同步前自动将模板中的占位符替换为当前项目名
  6. 输出已同步文件列表,业务代码不受影响

老项目手动补 .minijrc.json

如果项目是较早通过旧版本 CLI 创建的,根目录可能还没有 .minijrc.json。这时可以手动创建后再执行 sync-template

BI 项目示例:

{
  "templateType": "bi",
  "projectName": "your-project-name",
  "createdAt": "2026-04-15T00:00:00.000Z",
  "backendPort": "3001"
}

纯前端项目示例:

{
  "templateType": "frontend",
  "projectName": "your-project-name",
  "createdAt": "2026-04-15T00:00:00.000Z"
}

字段说明:

  • templateType:来源模板类型,必须是 bifrontend
  • projectName:当前项目名,用于模板占位符替换
  • createdAt:创建时间,建议使用 ISO 格式时间字符串
  • backendPort:仅 BI 项目需要,用于同步 backend/.env 等配置

创建完成后,在项目根目录执行:

minij sync-template --dry-run
minij sync-template

当前白名单策略

  • BI 项目:.gitlab-ci.ymlfrontend/package.jsonfrontend/vite.config.tsfrontend/src/main.tsfrontend/src/router/index.tsfrontend/src/router/guards.tsfrontend/src/layouts/AdminLayout.vuefrontend/src/utils/request.tsfrontend/src/utils/auth.tsREADME.md
  • 纯前端项目:.gitlab-ci.ymlpackage.jsonvite.config.tssrc/main.tssrc/router/index.tssrc/router/guards.tssrc/layouts/AdminLayout.vuesrc/utils/request.tssrc/utils/auth.tsREADME.md

不在白名单内的文件不会被同步,因此已创建项目中的业务页面和业务组件不会被覆盖。package.json 会采用 merge 策略:同步模板新增的 scriptsdependenciesdevDependenciespackageManager,保留当前项目名。


minij init

在当前目录生成 CLAUDE.md(AI 助手执行规则),并检测 608 内网连通性和 SSH 到 GitLab 的连通性。

此命令面向 AI 助手调用,生成的 CLAUDE.md 包含 CLI 指令映射表和断点续跑规则,供 AI 理解并遵循。

minij init

SSH 检查失败时会提示配置步骤:

ssh-keygen -t ed25519 -C "[email protected]"
cat ~/.ssh/id_ed25519.pub
# 将公钥添加到 git.minij.com → Settings → SSH Keys

minij server-deploy <name>

调用 orchestrator POST /api/setup-router 为项目分配端口并配置 Nginx 路由。

minij server-deploy my-project

当前 DataVerse 体系前端通过 CI/CD 直接部署,通常不需要单独调用此命令。


完整工作流

# 1. 检查环境(首次使用)
minij init

# 2. 创建纯前端项目(默认)
minij create my-project

# 若创建因内网/SSH/GitLab 异常中断,继续执行剩余步骤
minij continue-create my-project

# 或创建 BI 项目
minij create my-bi-project --type bi --port 3002

# 3. 进入项目目录,开始开发
cd my-project  # 或 cd my-bi-project

# 4. 推送代码触发 CI/CD 自动部署
git add .
git commit -m "feat: ..."
git push

# 5. 部署完成后访问
# https://dataverse.minij.com/DataVerse/my-project/

本地开发测试

1. 安装依赖并构建

pnpm install
pnpm build

2. 本地挂载 CLI

minij-cli 目录执行:

pnpm link --global

挂载完成后,可直接在终端使用:

minij --version
minij init

3. 测试创建项目全流程

需确保当前机器已连接minij 608 内网,且 minij-orchestrator-server 已部署在 http://192.168.50.41:8888

# 测试创建 BI 项目
minij create test-bi-demo --type bi --port 3002

# 测试创建纯前端项目
minij create test-frontend-demo --type frontend

该命令会验证以下完整链路:

  1. 克隆对应类型的模板仓库
  2. 替换项目名
  3. 调用 orchestrator 创建 GitLab 仓库
  4. 注入 GitLab CI/CD 变量
  5. 初始化 git 并推送到远程仓库

4. 修改代码后重新测试

每次修改 CLI 源码后,重新执行:

pnpm build

然后再次运行:

# 测试 BI 项目
minij create another-bi-demo --type bi --port 3003

# 测试纯前端项目
minij create another-frontend-demo --type frontend

5. 如需取消全局挂载

pnpm unlink --global @minij/cli

配置

CLI 默认连接 http://192.168.50.41:8888,无需手动配置。

如需覆盖,可编辑 ~/.minij/config.json

{
  "ORCHESTRATOR_URL": "http://192.168.50.41:8888"
}

项目名规范

  • 只能包含字母、数字、中划线、下划线
  • 示例:my-projectdata_dashboardbi2025