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

@iringo/arguments-builder

v1.8.5

Published

用于统一维护项目参数配置的构建

Downloads

14

Readme

@iringo/arguments-builder

用于统一维护项目参数配置的构建

安装

pnpm add -D @iringo/arguments-builder
# or
npm add -D @iringo/arguments-builder

配置文件

默认读取 arguments-builder.config.(ts|js|mjs) 文件,支持 -c--config 指定配置文件

import { defineConfig } from "@iringo/arguments-builder";

export default defineConfig({
  // ...
});
/**
 * @type {import('@iringo/arguments-builder').ArgumentsBuilderConfig}
 */
module.exports = {
  // ...
};

配置

ArgumentsBuilderConfig

| 参数 | 类型 | 描述 | | ------ | ------------------------------- | ------------ | | output | Output | 输出文件配置 | | args | ArgumentItem[] | 参数配置 |

Output

| 参数 | 类型 | 描述 | | ------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | surge | { path?: string; template?: string; } | surge 输出内容配置。path 为输出路径,template 为模版路径 | | loon | { path?: string; template?: string; } | loon 输出内容配置。path 为输出路径,template 为模版路径 | | boxjsSettings | { path?: string; scope?: string } | boxjs 的 settings 部分内容的输出内容配置。path 为输出路径,scope 为存储键的前缀 | | dts | { path?: string; isExported?: boolean } | 输出 dts 文件的配置。isExported 默认根据输出文件后缀自动判断,及 .d.ts 文件认为是全局类型,则 isExportedfalse.ts 文件则反之 |

ArgumentItem

| 参数 | 类型 | 描述 | | ------------ | ------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | | key | string (必填) | 参数 key | | type | 'string' | 'number' | 'boolean' | 'array' (必填) | 参数类型 | | boxJsType | 'text' | 'slider' | 'boolean' | 'textarea' | 'radios' | 'checkboxes' | 'colorpicker' | 'number' | 'selects' | 'modalSelects' | 自动的映射关系无法满足时,可以使用 boxJsType 来自定义 | | name | string | 参数描述 | | description | string | 参数简介 | | defaultValue | any | 默认值 | | options | array | 选项 | | placeholder | string | 输入框占位符 | | exclude | Array<'surge'| 'loon' | 'boxjs' | 'dts'> | 当前参数在哪些平台上不生效 |

CLI

输出 dts 文件

用于开发阶段输出根据当前参数配置输出类型文件,方便类型推导

npx arguments-builder dts

生成 module 文件

一键生成

根据模版自动生成 surgeloon 的 module 文件,以及 boxjs 的 settings 部分的 JSON 文件

npx arguments-builder build

单独生成

命令行工具保留了分别生成单独平台文件的能力

npx arguments-builder (surge|loon|boxjs)

通用参数

所有命令均支持 -c--config 指定配置文件。

例如以下场景

// arguments-builder.config.ts
import { defineConfig } from "@iringo/arguments-builder";

export default defineConfig({
  // ...
});

// arguments-builder.beta.config.ts
import defaultConfig from "./arguments-builder.config.ts";
import { defineConfig } from "@iringo/arguments-builder";

export default defineConfig({
  ...defaultConfig,
  args: [
    ...defaultConfig.args,
    {
      // ...
    },
  ],
});

Node API

import { ArgumentsBuilder } from "@iringo/arguments-builder";

const argumentsBuilder = new ArgumentsBuilder();