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

th-remote-build-cli

v0.0.17

Published

脚手架监听当前的文件修改,将修改的文件上传远程编译服务,和主项目的代码进行合并后编译完整项目,然后将产出物返回给客户端

Readme

远程镜像编译构建脚手架

脚手架监听当前的文件修改,将修改的文件上传远程编译服务,和主项目的代码进行合并后编译完整项目,然后将产出物返回给客户端

PS. 目前仅支持小程序远程开发

使用

1. 安装脚手架

# 全局安装脚手架
$ npm i th-remote-build-cli -g

2. 项目中增加配置文件

在子项目根目录下创建thbuild.config.js文件

export default {
    // 远端项目名称(必须)
    appname: 'my-app-mini',

    // 本地项目源码监听目录,用于监听文件改动,只能相对路径,默认:'./src'
    rootDir: './src',

    // 构建产出物目录,只能相对路径,默认:'./dist'
    outDir: './dist',

    // 构建环境服务的地址,默认:空
    buildUrl: 'http://www.test.com/dev/compile/',

    // 源码和远程项目的对应路径(和本地路径是相对路径关系),慎用此选项,一般用于映射目录
    // 例如:项目源代码监听目录为./,远端项目目录./src/customer-service-mini,此字段配置为./src/customer-service-mini
    // 监听到pages/index.vue文件改动,则组装成./src/customer-service-mini/pages/index.vue上传至远端
    // 暂时不支持路径穿越,待废弃,准备迁移至远端配置
    remoteRootDir: '',

    // 代码合并模式, 可选值:0: 整文件合并(默认值),1: 片段
    // 片段模式下,配合startTag和endTag来按规则匹配
    mergeType: 0,
    startTag: "<template>",
    endTag: "</template>",

    checkStatusSleepTime: 1500, // 检查状态等待时间(单位毫秒),默认: 1500

    // 忽略在rootDir下文件监听
    ignored: [
        /node_modules/,
        /dist/,
        /scripts/,
        /\.git/,
        /submodules/,
        /package-lock\.json/,
        /README\.md/,
        /\.gitignore/,
        /\.gitmodules/,
        /package\.json/
    ],
}

编译命令

thbuild [cmd] --help

查询帮助

$ thbuild --help
$ thbuild exec --help

thbuild login [option]

登录命令

| 选项 | 是否必填 | 默认值 | 描述 | | ---- | ---- | ---- | ---- | | -u, --username | 是 | | 用户名 | | -s, --secret-key | 是 | | secret |

# 登录命令(Demo)
$ thbuild login -u test -s abcdefg

thbuild logout

退出登录

# 退出登录命令(Demo)
$ thbuild logout

thbuild status

查询远程构建环境的运行状态(包括当前分支、构建命令以及远端构建环境状态)

$ thbuild status
# 输出(Demo)
branch: sprint 
cmd: npm run dev:minitest 
status: 已就绪

thbuild branch [option]

1.查询远程构建环境可以支持切换的所有分支

2.切换远程构建环境分支

| 选项 | 是否必填 | 默认值 | 描述 | | ---- | ---- | ---- | ---- | | -l, --list | 否 | | 列出远程的所有可用分支 |

| 参数 | 是否必填 | 默认值 | 描述 | | ---- | ---- | ---- | ---- | | branch | 是 | | 切换远程构建环境分支 |

$ thbuild branch -l # 列出远程的所有可用分支
# 输出(Demo)
* sprint
master

$ thbuild branch sprint # 切换构建环境到sprint分支

thbuild exec [option]

在远程环境下执行指定的命令

| 选项 | 是否必填 | 默认值 | 描述 | | ---- | ---- | ---- | ---- | | -n, --appname | 否 | | 对应远程环境的项目名称(可用项目配置文件代替读取) | | -opt, --option | 否 | | 远程编译使用的配置参数(可用项目配置文件代替读取) | | -l, --list | 否 | | 列出远程可使用的执行命令 |

| 参数 | 是否必填 | 默认值 | 描述 | | ---- | ---- | ---- | ---- | | cmd | 是 | | 远程构建环境执行的命令 |

$ thbuild exec 'npm run dev' # 远程构建环境执行npm run dev

$ thbuild exec -l # 列出远程可使用的执行命令
# 输出(Demo)
npm run dev
npm run dev:prod
npm run dev:txjk
* npm run dev:minitest

thbuild rebuild

重新部署远端项目(更新远端项目代码)

$ thbuild rebuild

thbuild reset

重置远端项目(撤销已改动的文件)

$ thbuild reset

thbuild watch

启动编译&&监听文件修改

$ thbuild watch

thbuild start

启动远端编译进程

thbuild start

thbuild stop

停止远端编译进程

thbuild stop