@doubleshot/builder

中文文档
0.0.25发布于 2026/08/31MITTypeScriptCommonJS构建来源已验证近 30 天下载 2386
原始使用文档
文档目录7 节
  1. Description
  2. Features
  3. Install
  4. Usage
  5. Configuration
  6. CLI Options
  7. License

@doubleshot/builder

Description

Builder is a cli tool for quickly building node backend or electron main process. It's powered by tsdown, bundled through Rolldown, and decorators are supported by swc.

Note: Builder is only suitable for building node and electron code, that is, files converted to CommonJS standards.

Features

  • ⚡ Fast start and bundled.
  • 💟 TypeScript decorator available.
  • ✅ Configure via file or command line.
  • 📦 Support electron packaging.
  • 💡 Support stand-alone use.

Warning: this project is in early stage, do not use in production environment

Install

npm i @doubleshot/builder -D
# Or Yarn
yarn add @doubleshot/builder -D
# Or PNPM
pnpm add @doubleshot/builder -D

Usage

Use directly:

# development mode
npx dsb dev
# production mode
npx dsb build

Or through a script in package.json:

{
  "scripts": {
    "dev": "dsb dev",
    "build": "dsb build"
  }
}

Configuration

Configuration file like dsb.config.ts ('.js' | '.cjs' | '.mjs') is also available:

import { defineConfig } from '@doubleshot/builder'

export default defineConfig({
  main: 'dist/main.js',
  entry: './src/main.ts',
  outDir: './dist',
  external: ['electron'],
  electron: {
    preload: {
      entry: './src/preload.ts'
    },
    rendererUrl: 'http://localhost:31123',
    waitTimeout: 5000,
  }
})

You can find more configurations through the type definition file.

CLI Options

Cli options are also available, use --help to see them.

License

MIT License © 2022 Archer Gu

版本与发布记录

@doubleshot/builder 共发布 32 个版本,首次发布于 2022/07/11;过去 12 个月发布了 6 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.0.25latest2026/08/312 个月前
0.0.242026/07/134 个月前
0.0.232026/06/135 个月前
0.0.222026/05/086 个月前
0.0.182026/03/317 个月前
0.0.172026/03/148 个月前

其他发布通道:alpha → 0.1.0-alpha.5,beta → 0.1.0-beta.2。

关于 @doubleshot/builder 的常见问题

如何安装 @doubleshot/builder?

在项目目录运行 npm install @doubleshot/builder,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 doubleshot-build、dsb,可以用 npx doubleshot-build 直接运行。

@doubleshot/builder 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@doubleshot/builder 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@doubleshot/builder 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=14.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@doubleshot/builder 可以商用吗?

@doubleshot/builder 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@doubleshot/builder 的下载量有多少?

根据 npm 官方下载统计,@doubleshot/builder 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,386 次,日均约 80 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@doubleshot/builder 还在维护吗?

最新版本 0.0.25 发布于 2026/08/31(2 个月前);至今共发布 32 个版本,其中过去 12 个月发布了 6 个;首次发布于 2022/07/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。