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

nuxt-gin-tools

v0.2.16

Published

This project is used as a dependency for [nuxt-gin-starter](https://github.com/RapboyGao/nuxt-gin-starter.git)

Readme

nuxt-gin-tools

nuxt-gin-toolsnuxt-gin-starter 的配套开发工具包,提供 Nuxt + Gin 项目的统一命令入口。

核心目标:

  • 一条命令启动前后端开发环境
  • 自动处理 Go 侧依赖和文件监听重启
  • 提供 OpenAPI 代码生成与构建打包辅助

功能概览

  • nuxt-gin dev
    • 启动 Nuxt 开发服务
    • 启动 Go 文件监听(基于 chokidar
    • Go 文件变化后自动重启 go run main.go
  • nuxt-gin install
    • 执行 Nuxt prepare
    • 如果检测到 Go,则执行 go mod download && go mod tidy
  • nuxt-gin gen
    • 基于 openapi.yaml 生成 Go / TS API 代码
  • nuxt-gin build
    • 执行项目构建与打包流程
  • nuxt-gin cleanup
    • 清理开发产物
  • nuxt-gin update
    • 执行依赖更新流程

安装

nuxt-gin-starter 项目中作为依赖安装:

pnpm add nuxt-gin-tools

快速开始

# 初始化依赖(可选)
nuxt-gin install

# 启动开发
nuxt-gin dev

命令说明

nuxt-gin dev

开发模式下会并行运行:

  • Nuxt:npx nuxt dev --port=<nuxtPort> --host
  • Go:监听变更并运行 go run main.go

Go 监听规则来自 .go-watch.json(见下文)。

nuxt-gin install

  • 总是执行:npx nuxt prepare
  • 检测到 Go 时额外执行:go mod download && go mod tidy

nuxt-gin gen

依赖 openapi-generator-cli,默认会:

  • 生成 Go Gin server 相关代码
  • 生成 TypeScript axios 客户端代码

nuxt-gin build

执行工具链内置的构建与打包逻辑。

nuxt-gin cleanup

清理由工具链生成的临时目录和产物。

nuxt-gin update

执行项目约定的更新逻辑。

配置

1) server.config.json

dev 命令会读取该文件,常用字段:

  • ginPort: Gin 服务端口
  • nuxtPort: Nuxt 开发端口
  • baseUrl: Nuxt baseUrl
  • killPortBeforeDevelop: 开发前是否释放端口(默认 true
  • cleanupBeforeDevelop: 开发前是否执行 cleanup(默认 false

3) 开发环境向前端暴露 ginPort

createDefaultConfig 会在 Nuxt runtimeConfig.public 中注入 ginPort

  • 开发环境:useRuntimeConfig().public.ginPortserver.config.jsonginPort
  • 生产环境:useRuntimeConfig().public.ginPortnull
  • 所有环境:useRuntimeConfig().public.isDevelopment 直接暴露当前是否开发环境

前端示例:

const config = useRuntimeConfig();
const ginPort = config.public.ginPort;
const isDevelopment = config.public.isDevelopment;

2) .go-watch.json

Go 监听配置文件,示例:

{
  "tmpDir": ".build/.server",
  "testDataDir": "testdata",
  "includeExt": ["go", "tpl", "html"],
  "includeDir": [],
  "includeFile": [],
  "excludeDir": [
    "assets",
    ".build/.server",
    "vendor",
    "testdata",
    "node_modules",
    "vue",
    "api",
    ".vscode",
    ".git"
  ],
  "excludeFile": [],
  "excludeRegex": ["_test.go"]
}

也支持环境变量指定路径:

NUXT_GIN_WATCH_CONFIG=/path/to/.go-watch.json

环境依赖

  • Node.js
  • pnpm
  • Go(需要运行 Gin 侧开发与依赖下载时)
  • openapi-generator-cli(仅 nuxt-gin gen 需要)

说明

  • Go 侧热更新已不再依赖 Air。
  • 当前方案为:chokidar 监听文件变化 + 重启 go run main.go