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

done-coding-inject

v0.5.20

Published

信息(JSON)注入命令行工具

Readme

@done-coding/cli-inject

信息(JSON)注入命令行工具 - 将 JSON 数据注入到文件中

npm version License: MIT

安装

独立安装

npm install @done-coding/cli-inject
# 或
pnpm add @done-coding/cli-inject

作为 done-coding CLI 的一部分

npm install -g @done-coding/cli
# 然后使用
DC inject [command]

快速开始

# 独立使用
dc-inject [command]

# 作为主 CLI 的子命令
DC inject [command]

# 查看帮助
dc-inject --help

功能特性

  • JSON 注入: 将 JSON 数据注入到指定文件中
  • 🔧 配置管理: 支持配置文件管理注入规则
  • 📁 目录支持: 支持指定运行目录和配置文件路径
  • 🔄 批量处理: 支持批量注入操作

API 文档

基础命令

dc-inject init

初始化配置文件

# 创建默认配置文件
dc-inject init

dc-inject (默认命令)

生成文件

# 使用默认配置生成文件
dc-inject

# 指定运行目录
dc-inject -R ./src

# 指定配置文件路径
dc-inject -C ./custom-config.json

选项说明:

  • -R, --rootDir: 运行目录
  • -C, --configPath: 配置文件相对路径,默认为 ./.done-coding/inject.json

使用示例

基础使用场景

# 1. 初始化配置
dc-inject init

# 2. 执行注入操作
dc-inject

# 3. 指定不同的运行目录
dc-inject -R ./packages/core

作为主 CLI 的一部分

# Windows 系统
dc inject init
dc inject -R ./src

# macOS/Linux 系统
DC inject init
DC inject -R ./src

配置

通过 dc-inject init 命令可以初始化配置文件 .done-coding/inject.json

具体的配置选项需要查看初始化后生成的配置文件内容。

编程接口

本包提供了编程接口,具体的导出内容请查看包的类型定义文件。

故障排除

常见问题

Q: 配置文件找不到

# 检查配置文件是否存在
ls -la .done-coding/inject.json

# 重新初始化配置
dc-inject init

Q: 注入失败

# 检查运行目录
dc-inject -R ./src

# 检查配置文件路径
dc-inject -C ./custom-config.json

调试模式

# 查看版本信息
dc-inject --version

# 查看帮助信息
dc-inject --help

贡献指南

我们欢迎贡献!请遵循以下步骤:

  1. Fork 本仓库
  2. 创建功能分支:git checkout -b feature/amazing-feature
  3. 提交更改:git commit -m "feat: add amazing feature"
  4. 推送分支:git push origin feature/amazing-feature
  5. 创建 Pull Request

开发环境设置

# 克隆仓库
git clone https://gitee.com/done-coding/done-coding-cli.git
cd done-coding-cli/packages/inject

# 安装依赖
pnpm install

# 开发模式
pnpm dev

# 构建
pnpm build

# 本地开发测试
node es/cli.mjs --help

# 注意:本地使用 node + 入口文件,发布后使用 bin 命令名
# 功能完全一致,只是调用方式不同

许可证

MIT © JustSoSu

相关链接