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

@taoya7/label-print

v1.0.0

Published

一个用于标签打印机开发者调试的用户界面

Readme

标签打印机调试工具

这是一个用于标签打印机开发者调试的用户界面,基于Nuxt 3和Shadcn Vue UI框架构建。该应用允许用户编写打印指令并发送到指定的打印机IP和端口。

功能特点

  • 打印机连接配置(IP地址和端口设置)与本地存储持久化
  • 代码编辑器支持TSPL打印指令格式
  • 暗黑/亮色主题切换
  • 快捷菜单栏,可快速插入文本、条形码、二维码和图片元素
  • 指令格式化功能
  • 示例模板快速插入
  • 将指令发送到打印机并显示结果状态
  • 完善的中文支持
  • 命令行工具(CLI)支持

技术栈

安装

全局安装(推荐)

npm install -g label-print
# 或者使用 yarn
yarn global add label-print
# 或者使用 pnpm
pnpm add -g label-print

安装后,您可以通过命令启动应用:

label-print start

在项目中安装

npm install label-print
# 或者使用 yarn
yarn add label-print
# 或者使用 pnpm
pnpm add label-print

命令行工具使用

此应用提供了命令行工具,可以通过以下命令使用:

# 启动应用
label-print start [选项]

# 显示版本信息
label-print -v

# 显示帮助信息
label-print --help

常用选项:

  • --port, -p:指定端口号,默认为3661
  • --host, -h:指定主机地址,默认为0.0.0.0

例如:

# 使用自定义端口启动
label-print start --port 8080

# 使用自定义主机地址
label-print start --host localhost

更多详细说明请参考 CLI文档

开发设置

确保你已经安装了Node.js(推荐v16或更高版本)和pnpm。

# 安装依赖
pnpm install

# 启动开发服务器
pnpm dev

# 构建应用
pnpm build

# 本地预览生产版本
pnpm preview

# 本地开发CLI
pnpm cli

# 本地链接(使CLI命令全局可用)
pnpm link

开发服务器将在 http://localhost:3000 运行。

使用说明

  1. 设置打印机连接

    • 点击顶部的"设置"按钮
    • 输入打印机的IP地址和端口(通常是9100)
    • 点击"保存设置"(设置将持久化保存)
  2. 编写打印指令

    • 在编辑器中输入TSPL打印指令,或点击"示例"按钮插入模板
    • 使用菜单栏快速插入常用元素(文本、条形码、二维码、图片)
    • 可以使用"格式化"按钮优化指令格式
  3. 发送到打印机

    • 确保已配置打印机连接
    • 点击"发送到打印机"按钮
    • 查看操作状态反馈
  4. 切换主题

    • 点击右上角的太阳/月亮图标切换暗黑/亮色主题

支持的指令类型

  • TSPL (TSC Programming Language) - 适用于TSC和许多其他品牌的热敏标签打印机

环境变量配置

应用支持以下环境变量:

  • FORCE_PRINTER_CONNECT=true - 强制在开发环境中进行实际打印机连接测试
  • FORCE_PRINTER_PRINT=true - 强制在开发环境中进行实际打印,而不是模拟打印

注意事项

  • 在生产环境中,应用将实际连接到打印机并发送指令
  • 本应用默认在开发环境使用模拟模式,不会实际连接到打印机,方便开发和测试
  • 项目已添加中文编码支持,可以正常打印中文字符
  • 项目结构已预留扩展空间,未来可以添加更多打印指令类型支持

项目结构

  • components/ - UI组件
  • layouts/ - 页面布局
  • pages/ - 应用页面
  • stores/ - Pinia状态管理
  • server/ - 后端API和服务
    • api/ - API端点
    • services/ - 服务层,包含打印机服务
  • utils/ - 实用工具类
    • storage.ts - localStorage封装
    • tspl-templates.ts - TSPL模板生成工具
  • cli/ - 命令行工具
    • index.js - CLI主入口
    • bin/ - 可执行文件

许可证

MIT