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

taozi-uniapp-engineering-script

v1.0.46

Published

桃子科技 uniapp 工程化脚本

Readme

uniapp-engineering-script

一个用于管理 uniapp 项目的工程化脚本工具集,提供项目启动、构建、发布、页面生成等功能。

配置文件

配置文件获取方式

项目会在当前目录及上层目录中查找名为 taozi-uniapp-engineering-script-config.mjs 的配置文件。

配置文件类型定义

配置文件需要导出一个符合 ProjectConfig 接口的对象:

interface ProjectConfig {
  /** 应用配置列表 */
  apps: AppConfig[];
  /** 微信小程序配置 */
  wx?: {
    getAppInfo: (appConfig: AppConfig) => {
      appid: string;
      privateKey: string;
    };
  };
  /** 分发 app */
  distributionApp?: {
    /** 获取 app 的 scripts */
    getAppScripts?: (appConfig: AppConfig) => Record<string, string>;
    /** 加载器 */
    loaders?: Loader[];
  };
  /** 运行脚本配置 */
  runsScripts?: {
    /** 命令 key */
    command: string;
    /** 命令描述 */
    description: string;
  }[];
  /** 环境变量字典 */
  appEnvKeyDicts?: { value: string; label: string }[];
  /** 批量处理app的并发数 */
  appSyncHandleNumber?: number;
  /** 创建 app 页面处理器 */
  createAppPagesHandler?: (pageDir: string, page: Page) => void | Promise<void>;
  /** 创建 core 页面处理器 */
  createCorePagesHandler?: (pageDir: string, page: Page) => void | Promise<void>;
}

interface AppConfig {
  /** app名字 */
  name: string;
  /** app 类型 */
  type: AppType;
  /** 描述 */
  description: string;
  /** 公共环境 */
  comEnv?: AppEnv;
  /** 所有环境 */
  envs?: {
    /** 环境名称 */
    name: EnvName;
    /** 环境描述 */
    description: string;
    /** ci机器人编号 1-9 */
    ciRobot: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
    /** 环境配置 */
    value: AppEnv;
  }[];
  /** 发布配置,用于批量发布小程序 */
  release?: {
    /** 发布类型,体验版 | 正式版本 */
    type: MPVersionTypeValue;
    /** 使用环境 */
    env: EnvName;
  }[];
}

type AppType = "cloud-outpatient" | "internet-hospital";
type EnvName = "production" | "development" | "test";
type MPVersionTypeValue = "trial" | "release";

命令说明

taozi-ues-app-start

启动 uniapp 项目,支持开发模式和构建模式。

参数:

  • -p, --packageName <packageName> - 项目package.json中的name字段
  • -m, --mode <mode> - 模式,可选值:dev|build
  • -e, --env <env> - 环境
  • -o, --openInWXTool <openInWXTool> - 是否在微信开发者工具中打开,可选值:yes|no
  • -u, --upload <upload> - 是否上传小程序,可选值:yes|no
  • -v, --versionType <versionType> - 上传小程序类型,可选值:trial|release
  • -t, --updateVersion <updateVersion> - 更新版本,可选类型:none|patch|minor|major,或者一个版本号,如:1.0.0
  • -c, --ifCreateApp <ifCreateApp> - 是否创建项目,可选值:yes|no

示例:

taozi-ues-app-start -p my-app -m dev -e development

taozi-ues-cleanup-temp-folders

清理临时文件夹。

参数:

示例:

taozi-ues-cleanup-temp-folders

taozi-ues-copy-plugin

复制插件到分包目录。

参数:

示例:

taozi-ues-copy-plugin

taozi-ues-create-app-pages

创建应用页面。

参数:

示例:

taozi-ues-create-app-pages

taozi-ues-create-core-pages

创建核心页面。

参数:

示例:

taozi-ues-create-core-pages

taozi-ues-elder-transform

对小程序进行老年化适配转换,包括添加 page-meta 和转换字体大小。

参数:

示例:

taozi-ues-elder-transform

taozi-ues-generate-app-item-pages-json

根据 pages.ts 配置生成 pages.json 文件。

参数:

示例:

taozi-ues-generate-app-item-pages-json

taozi-ues-miniprogram-subpackage-optimization

小程序分包优化,用于优化小程序的分包结构和文件引用路径。

参数:

  • -p, --project-dist-path <path> - 项目构建目录路径,默认为 ./dist/build/mp-weixin
  • -o, --origin-dir-name <name> - 原始 node-modules 目录名称,默认为 node-modules
  • -t, --target-dir-tag <tag> - 目标目录标签,默认为 pages

功能:

  • 将根目录的 node-modules 复制到所有分包中
  • 调整分包文件对 node-modules 的引用路径
  • 调整 node-modules 文件对 vendor.js 的引用路径
  • 删除分包中多余的 pages 和 components 目录

示例:

taozi-ues-miniprogram-subpackage-optimization
taozi-ues-miniprogram-subpackage-optimization -p ./dist/build/mp-weixin -o node-modules -t pages

taozi-ues-open-app-in-wxtool

在微信开发者工具中打开项目。

参数:

  • -p, --appPath <appPath> - 项目路径
  • -t, --openType <openType> - 打开类型,可选值:dev|build

示例:

taozi-ues-open-app-in-wxtool -p /path/to/app -t dev

taozi-ues-release

批量发布项目。

参数:

  • -s, --apps <apps> - 要发布的项目,多个项目用逗号分隔,query 参数格式:packageName=xxx&env=xxx&type=xxx&version=xxx
  • -a, --all - 是否发布所有项目

示例:

taozi-ues-release -s "my-app&env=production&type=release&version=1.0.0"
taozi-ues-release -a

taozi-ues-runs

运行项目脚本。

参数:

  • -s, --commands <commands> - 要执行的命令,多个命令用逗号分隔

示例:

taozi-ues-runs -s "start,test"

taozi-ues-start

启动主流程,包括创建页面和选择启动类型。

参数:

示例:

taozi-ues-start

taozi-ues-test

测试命令。

参数:

示例:

taozi-ues-test

安装和使用

  1. 安装依赖:
pnpm install
  1. 构建项目:
pnpm run build-w
  1. 在项目根目录创建配置文件 taozi-uniapp-engineering-script-config.mjs

  2. 使用相应的命令进行项目操作

许可证

本项目采用 MIT 许可证

贡献

欢迎提交 Issue 和 Pull Request 来改进这个项目。

作者

[email protected]

关于miniprogram-subpackage-optimization 使用的是 包miniprogram-subpackage-optimization-monorepo