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 🙏

© 2024 – Pkg Stats / Ryan Hefner

hsl-mini-program-ci

v1.7.24

Published

Mini-Program-CI 是一个基于支付宝小程序 CLI、微信小程序 CLI工具功能增强的应用, 适用于本地项目 CLI 上传、批量矩阵账号上传、项目内设置环境变量等场景,兼容支付宝、微信原生项目与 Uni-app 项目

Downloads

24

Readme

简介

Hsl-Mini-Program-CI 是一个基于支付宝小程序 CLI微信小程序 CLI工具功能增强的应用,适用于本地项目 CLI 上传、批量矩阵账号上传、项目内设置环境变量等场景,兼容支付宝、微信原生项目与 Uni-app 项目

特性

  • 支持支付宝、微信小程序批量修改文件上传
  • 支持支付宝、微信小程序设置环境变量
  • 配置面板,测试、产品等人员通过配置面板生成对应的小程序二维码用于测试、体验

最近变更

1.7.0

  • refactor server服务改版、优化mp-ci.config.js配置文件结构,详情请看readme

1.6.0

  • feat 新增sentry平台日志上报功能
  • refactor 优化preview、upload指令相关日志输出

1.5.0

  • feat 新增server指令
  • refactor 优化mp-ci.config.js配置文件结构, 新增pagesListPath参数用于获取该小程序所有页面列表

安装

npm install hsl-mini-program-ci -D

yarn add hsl-mini-program-ci --dev

pnpm add hsl-mini-program-ci --save-dev

配置

hsl-mini-program-ci从命令行运行时,会自动读取项目根目录下的mp-ci.config.js进行配置运行

  • 支付宝密钥对应位于开放平台存储的公钥 publicKey 可以登录 开放平台,在 账户中心 > 密钥管理 > 开发工具密钥 > 配置密钥 中的 工具公钥 中查看
  • 微信端 使用 miniprogram-ci 前应访问"微信公众平台-开发-开发设置"后下载代码上传密钥
// mp-ci.config.js
module.exports =  {
  // 支付宝ci必填
  alipay: {
    authentication: {
      // 工具 ID
      toolId: "4f9015a0b7c94a08a65966c28b821c36",
      // 私钥
      privateKey:
        "-----BEGIN PRIVATE KEY-----\nMi\n-----END PRIVATE KEY-----\n",
    },
    projectPath: "xxxx", // 默认使用根目录 如果是原生小程序 该参数可以不填 uniapp开发的小程序可参考: unpackage/dist/xxxx/xxxx
    privateKeyPath:"xxx.json", // 选填 如果使用了这个参数 则不会读取authentication 从项目根路径读取xxx.json文件(支付宝平台下载下来的)
    // 如果需要飞书消息推送该参数必填
    larkParams: {
      isPushMessageToLark: true // 是否推送消息至飞书
      // https://open.feishu.cn/document/server-docs/authentication-management/access-token/tenant_access_token_internal
      // 以下两个参数为自建应用app信息,用于授权后调用飞书上传接口
      larkRobotAppId: "cli_a58dxxxxxxxxx",
      larkRobotAppSecret: "Vk4XeM577bPNxxxxxxx",
      larkRobotWebhook: "https://open.feishu.cn/open-apis/bot/v2/hook/a2cxxxxxxx", // 飞书机器人webhook 创建群聊机器人后可获
      messageTemplateId: "ctp_AAwkkxxxxx" // 目前仅支持模版卡片消息推送格式 https://open.feishu.cn/document/common-capabilities/message-card/introduction-of-message-cards
      // 以下参数为可选项 假如有自定义模版卡片变量则需填写 参考上面的链接
      templateData: {
        key: value
      }
    },
    pagesListPath: 'dev/mp-alipay/app.json', // 获取页面配置的路径 必填 会读取对应pages和subpages获取所有可访问的页面
    // 新增formList参数对应预览/上传自定义配置项
    formList: {
      pageQuery: '',
      test1: '',
      test2: ''
    },
    dynamicConfig: {
    replace: function () {
      // processing data
      return [
        // 如果需通过server服务来使用该预览功能,该数组中第一项必填,用于生成默认配置项appid和editValue
        {
          appid: "xxxx", // 必填
          version: "xxxx", // upload必填
          // 如有需要替换的文件可填 否则可用空数组 仅支持js或json文件修改
          replace_list: [
            {
              type: "js", // js or json
              filePath: "utils/useDynamic.js",
              editValue: {
                appid: "xxx",
                applet_id: 'xxxx',
              },
            },
            {
              type: "json", // js or json
              filePath: "utils/index.json",
              editValue: {
                transparentTitle: "always",
              },
            },
          ],
        },
        {
          appid: "xxxx",
          version: "xxxx", // 必填
          replace_list: [
            {
              type: "js", // js or json
              filePath: "utils/useDynamic.js",
              editValue: {
                appid: "xxx",
                applet_id: "xxx",
              },
            },
            {
              type: "json", // js or json
              filePath: "utils/index.json",
              // 需要修改的key与对应value
              editValue: {
                key: "value",
              },
            },
          ],
        },
        // ..array
      ];
    },
  },
  },
  wechat: {
    projectPath: "xxx",
    dynamicConfig: {
    replace: function () {
      // processing data
      return [
        {
          appid: "xxxx", // 必填
          privateKey:"-----BEGIN RSA PRIVATE KEY----------END RSA PRIVATE KEY-----\n", // 微信小程序对应私钥
          privateKeyPath:"授权文件路径", // 选填 如果使用了该参数 则不会读取privateKey
          version: "xxxx", // upload必填
          // 如有需要替换的文件可填 否则可用空数组 仅支持js或json文件修改
          replace_list: [
            {
              type: "js", // js or json
              filePath: "utils/useDynamic.js",
              editValue: {
                appid: "xxx",
                applet_id: 'xxxx',
              },
            },
            {
              type: "json", // js or json
              filePath: "utils/index.json",
              editValue: {
                transparentTitle: "always",
              },
            },
          ],
        },
        {
          appid: "xxxx",
          privateKey:"-----BEGIN RSA PRIVATE KEY----------END RSA PRIVATE KEY-----\n", // 选填
          version: "xxxx", // 必填
          replace_list: [
            {
              type: "js", // js or json
              filePath: "utils/useDynamic.js",
              editValue: {
                appid: "xxx",
                applet_id: "xxx",
              },
            },
            {
              type: "json", // js or json
              filePath: "utils/index.json",
              // 需要修改的key与对应value
              editValue: {
                key: "value",
                'window.textTitle': 'aaaa'
              },
            },
          ],
        },
        // ..array
      ];
    },
  },
  },
  // uni-app cli config
  uniAppConfig: {},
};

使用方式

  • 该npm包提供内置指令preview、upload、server三个指令提供给业务方进行使用
  "scripts": {
    "upload": "upload",
    "preview": "preview",
    "server": "server"
  },

可参考以上配置在你项目中的package.json去配置对应指令

npm run upload

npm run preview

npm run server

如不进行配置可利用npx指令直接使用

npx upload 

npx preview

npx server

npm run upload 和 npm run preview 需提供platform平台例如

npm run preview alipay: 预览支付宝小程序

别的指令同理

npm run preview alipay

npm run preview wechat

npm run upload alipay

npm run upload wechat

npx server会开启一个本地服务器让开发者使用,目前仅提供了根据相关配置参数来生成二维码(目前仅支持支付宝小程序) windows可通过ipconfig指令在终端上查找本地ip mac可通过ifconfig指令在终端上查找本地ip