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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@aplus-frontend/sync-cli

v2.1.0

Published

aplus sync template for aplus-frontend team.

Readme

Aplus Sync Cli

NPM Version NPM Downloads NPM License

aplus 业务应用代码同步工具,用于在不同仓库间收集和同步代码,支持用户应用和管理应用。

提示: 本工具主要用于管理多仓库前端项目,简化代码同步与整合流程。

建议使用方式

pnpx @aplus-frontend/sync-cli [命令]

使用

# 显示帮助信息
pnpx @aplus-frontend/sync-cli --help

# 更新用户模板(已废弃,推荐使用 up:template)
pnpx @aplus-frontend/sync-cli up:user-template

# 收集用户子应用代码
pnpx @aplus-frontend/sync-cli collect:user:son-all

# 更新管理员模板(已废弃,推荐使用 up:template)
pnpx @aplus-frontend/sync-cli up:admin-template

# 更新模板(推荐)
pnpx @aplus-frontend/sync-cli up:template -b feature/branch

# 从任意仓库收集代码到指定目录
pnpx @aplus-frontend/sync-cli collect \
  --repository "https://codeup.aliyun.com/xxx/frontend/aplus-admin-group/aplus-admin-bms.git" \
  --branch "dev-merge" \
  --source "src/subapp-bms" \
  --target "subapp-bms" \
  --ignores "views" \
  --auto-commit true

可用命令

用户应用相关

| 命令 | 描述 | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | up:user-template | 【已废弃】收集USER端特地分支拉取代码,更新目标仓库可选参数: --branch 拉取分支名称可选参数: --not-commit 只更新不产生提交记录可选参数: --auto-push 提交之后自动push到仓库 | | collect:user:base | 收集aplus-user-base项目的代码到目标仓库可选参数: --branch 拉取分支名称,默认dev-publish | | collect:user:mos | 收集aplus-user-mos项目的代码到目标仓库可选参数: --branch 拉取分支名称,默认dev-publish | | collect:user:wms | 收集aplus-user-wms项目的代码到目标仓库可选参数: --branch 拉取分支名称,默认dev-publish | | collect:user:bms | 收集aplus-user-bms项目的代码到目标仓库可选参数: --branch 拉取分支名称,默认dev-publish | | collect:user:son-all | 收集aplus-user,base,mos,wms,bms项目的代码到目标仓库 | | up:publish-user-app | 【已废弃】收集publish-user-app项目的代码到目标仓库,忽略subapp-base,subapp-mos,subapp-wms,subapp-bms |

管理应用相关

| 命令 | 描述 | | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | up:admin-template | 【已废弃】收集ADMIN端特地分支拉取代码,更新目标仓库可选参数: --branch 拉取分支名称可选参数: --not-commit 只更新不产生提交记录可选参数: --auto-push 提交之后自动push到仓库 | | collect:admin:base | 收集aplus-admin-base项目的代码到目标仓库可选参数: --branch 拉取分支名称,默认dev-publish | | collect:admin:mos | 收集aplus-admin-mos项目的代码到目标仓库可选参数: --branch 拉取分支名称,默认dev-publish | | collect:admin:wms | 收集aplus-admin-wms项目的代码到目标仓库可选参数: --branch 拉取分支名称,默认dev-publish | | collect:admin:bms | 收集aplus-admin-bms项目的代码到目标仓库可选参数: --branch 拉取分支名称,默认dev-publish | | collect:admin:son-all | 收集aplus-admin,base,mos,wms,bms项目的代码到目标仓库 | | up:publish-admin-app | 【已废弃】收集publish-admin-app项目的代码到目标仓库,忽略subapp-base,subapp-mos,subapp-wms,subapp-bms |

通用命令

| 命令 | 描述 | | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | collect | 收集任意项目的代码到目标仓库的任意目录必填参数: -r, --repository <string> 拉取的远程仓库地址必填参数: -s, --source <string> 需要拷贝的源目录路径必填参数: -t, --target <string> 需要拷贝到目标目录路径可选参数: -b, --branch <string> 拉取的分支名称,默认 master可选参数: -i, --ignores <string> 拷贝过程中忽略的文件或目录,多个用逗号分隔可选参数: -c, --auto-commit 自动提交 | | up:template | 收集特地分支拉取代码,更新目标仓库可选参数: -b, --branch <name> 拉取分支名称可选参数: -n, --not-commit 只更新不产生提交记录可选参数: -a, --auto-push 提交之后自动push到仓库 |

//收集指定仓库的指定目录代码到当前仓库的指定目录

pnpx @aplus-frontend/sync-cli collect \
  --repository "https://codeup.aliyun.com/xxx/frontend/aplus-admin-group/aplus-admin-bms.git" \
  --branch "dev-merge" \
  --source "src/subapp-bms" \
  --target "subapp-bms" \
  --ignores "views" \
  --auto-commit true

配置文件

为了简化操作,您可以在项目根目录创建 .aplus-sync-rc 配置文件:

{
  "manage-template": "https://codeup.aliyun.com/xxx/frontend/yurex-group/yurex-manage-template.git",
  "sync-template-branch": "master",
  "aplus-user": {
    "aplus-user-base": "https://codeup.aliyun.com/xxx/frontend/aplus-user-group/aplus-user-base.git",
    "aplus-user-mos": "https://codeup.aliyun.com/xxx/frontend/aplus-user-group/aplus-user-mos.git",
    "aplus-user-wms": "https://codeup.aliyun.com/xxx/frontend/aplus-user-group/aplus-user-wms.git",
    "aplus-user-bms": "https://codeup.aliyun.com/xxx/frontend/aplus-user-group/aplus-user-bms.git"
  },
  "aplus-admin": {
    "aplus-admin-base": "https://codeup.aliyun.com/xxx/frontend/aplus-admin-group/aplus-admin-base.git",
    "aplus-admin-mos": "https://codeup.aliyun.com/xxx/frontend/aplus-admin-group/aplus-admin-mos.git",
    "aplus-admin-wms": "https://codeup.aliyun.com/xxx/frontend/aplus-admin-group/aplus-admin-wms.git",
    "aplus-admin-bms": "https://codeup.aliyun.com/xxx/frontend/aplus-admin-group/aplus-admin-bms.git"
  },
  "global-admin": {
    "aplus-admin-mos": "https://codeup.aliyun.com/xxx/frontend/aplus-admin-group/aplus-admin-mos.git",
    "aplus-admin-wms": "https://codeup.aliyun.com/xxx/frontend/aplus-admin-group/aplus-admin-wms.git",
    "aplus-admin-bms": "https://codeup.aliyun.com/xxx/frontend/aplus-admin-group/aplus-admin-bms.git"
  },
  "sub-app-name-mapping": {
    "aplus-user-base": "subapp-base",
    "aplus-user-mos": "subapp-mos",
    "aplus-user-wms": "subapp-wms",
    "aplus-user-bms": "subapp-bms",
    "aplus-admin-base": "subapp-base",
    "aplus-admin-mos": "subapp-mos",
    "aplus-admin-wms": "subapp-wms",
    "aplus-admin-bms": "subapp-bms"
  },
  "ignoreFiles": [
    "i18n.config.cjs",
    "node_modules",
    "dist",
    ".env",
    ".git",
    ".gitignore"
  ]
}

| 配置参数 | 描述 | 类型 | | ---------------------------------- | -------------------------------- | ---------- | | aplus-manage-template | 模板仓库的远程地址 【废弃】 | string | | aplus-user-sync-template-branch | 用户应用模板分支名称【废弃】 | string | | aplus-admin-sync-template-branch | 管理员应用模板分支名称【废弃】 | string | | manage-template | 模板仓库的远程地址 | string | | sync-template-branch | 应用模板拉取分支名称 | string | | publish-user-app | 用户发布应用仓库地址 【废弃】 | string | | publish-admin-app | 管理发布应用仓库地址 【废弃】 | string | | aplus-user | 用户应用各子模块的仓库地址配置 | Object | | aplus-admin | 管理应用各子模块的仓库地址配置 | Object | | global-admin | 管理应用各子模块的仓库地址配置 | Object | | ignoreFiles | 在同步过程中需要忽略的文件或目录 | string[] |

工作流程说明

模板更新流程

  1. 检查目标仓库的 Git 工作区是否干净
  2. 克隆模板仓库的指定分支到临时目录
  3. 将模板文件复制到目标目录,忽略配置中指定的文件
  4. 保留目标目录中独有的文件
  5. 生成一个更新模板的 Git 提交记录

代码收集流程

  1. 克隆源子应用仓库到临时目录
  2. 将源代码复制到目标目录下对应的子应用文件夹
  3. 保留目标特有的文件,避免覆盖其他子应用的代码
  4. 删除临时目录
  5. 显示详细的操作摘要(忽略的文件、更新的文件等)

性能优化

  • 使用 CPU 多核加速复制和同步过程
  • 基于文件哈希比较,只更新确实变更的文件
  • 批量文件操作优化,提高大量文件处理效率

License

MIT