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

@tomjs/hbuilderx-cli

v1.3.1

Published

为 HBuilderX 开发插件提供便利的 cli 工具,根据 package.json 中的 contributes 配置,为 hbuilderx 的命令、视图等 API 提供 id 提示

Readme

@tomjs/hbuilderx-cli

npm node-current (scoped) license jsDocs.io

HBuilderX 开发 插件 提供便利的 cli 工具,根据 package.json 中的 contributes 配置,为 hbuilderx 命令视图 等的 API 提供 id 提示。

Install

# pnpm
pnpm add -D @tomjs/hbuilderx-cli

# yarn
yarn add -D @tomjs/hbuilderx-cli

# npm
npm add -D @tomjs/hbuilderx-cli

使用

安装后可以使用 hx-cli 命令行运行本 CLI 工具。

生成 d.ts 文件和打包插件

Usage
  $ hx-cli [options] <dir>

  dir                   指定扩展目录,默认 "extension”

Options
  --watch, -w           监听 package.json,生产 d.ts 文件
  --pack, -p            生成插件打包文件
  --flag, -f            日志标识:time/symbol/none,默认 "time"
  --config              指定配置文件,如 "hx-cli.config.mjs"
  --verbose             显示更多信息
  --help, -h            显示帮助信息
  --version, -v         显示版本信息

Examples
  $ hx-cli --watch
  $ hx-cli --watch --flag=symbol
  $ hx-cli --pack

scripts

package.jsonscripts 中添加以下命令

# 开发模式,根据 package.json 中 contributes 配置,为 hbuilderx 增加命令、视图等 id 的提示
hx-cli --watch
# 打包模式,将当前项目打包成插件压缩包
hx-cli --pack

插件使用

tsconfig.json 中,将 cli 生成的 hbuilderx.d.ts 添加到 include 配置项,

tsconfig.json

{
  "compilerOptions": {
    "types": ["@tomjs/hbuilderx/types"]
  },
  // 添加项目根目录的 hbuilderx.d.ts
  "include": ["hbuilderx.d.ts", "src/**/*.ts", "src/**/*.d.ts"]
}

示例

import type { ExtensionContext } from 'hbuilderx';
import { isAlphaVersion, setContext } from '@tomjs/hbuilderx';
import { commands, window } from 'hbuilderx';

export function activate(context: ExtensionContext) {
  setContext(context);

  context.subscriptions.push(
    // 此处会有命令id提示
    commands.registerCommand('tomjs.xxx.showHello', async () => {
      window.showInformationMessage(`Hello World!这是 ${isAlphaVersion ? '测试' : '正式'}版本的 HBuilderX。`, ['确定1', '取消2']).then((result) => {
        window.showInformationMessage(`你点击了${result}`);
      });
    }),
  );
}

export function deactivate() { }

示例

打开 examples 目录,查看 cli 使用示例。