@book000/create-ts

中文文档
0.2.80发布于 2026/11/11MITES Module构建来源已验证近 30 天下载 2万

Create book000-style TypeScript projects

原始使用文档
文档目录8 节
  1. Requirements
  2. Usage
  3. Options
  4. Variants
  5. Generated project
  6. Development
  7. Release
  8. License

create-ts

A CLI that scaffolds book000-style TypeScript / Node.js projects. It copies the bundled template for the chosen variant into a directory, fills in the project metadata, and runs pnpm install.

Requirements

  • Node.js v20 or later (the CLI exits with an error otherwise)
  • pnpm (generated projects reject other package managers with only-allow)
  • Network access: dependencies are installed with pnpm install, the LICENSE text is fetched from the GitHub licenses API (skipped with a warning on failure), and fixpack / fixdevcontainer are run through npx (skipped on failure)

Usage

pnpm create @book000/ts [outdir] [options]

outdir defaults to the current directory and is created if it does not exist. Any value not given as an option is asked interactively. The directory name is offered as the default project name when it is a valid package name.

To run without prompts, pass every option:

pnpm create @book000/ts my-app \
  --name my-app --org book000 --repo my-app \
  --description "My app" --author book000 --license MIT --homepage "" \
  --bug-url https://github.com/book000/my-app/issues \
  --variant base --no-esm --no-test --no-docker \
  --no-ignore-data --no-add-reviewer --overwrite

Options

OptionDescriptionDefault
--name <name>Project name (npm package name rule: lowercase, up to 214 characters)Asked
--org <org>GitHub organization / user name. The package is named @<org lowercased>/<name>Asked (book000)
--repo <repo>Repository nameAsked
--description <desc>Project descriptionAsked
--author <author>Author nameAsked
--license <spdx>SPDX license identifier (for example MIT, Apache-2.0)Asked (MIT)
--homepage <url>Homepage URL. An empty string omits the fieldAsked
--bug-url <url>Bug report URLAsked
--variant <variant>base, config-batch, fastify or discord-botAsked (base)
--esm / --no-esmES Modules / CommonJSAsked (CommonJS)
--test / --no-testAdd / do not add Jest testsAsked (no)
--docker / --no-dockerAdd / do not add Dockerfile, entrypoint.sh and the Docker workflowAsked (no)
--ignore-data / --no-ignore-dataAdd / do not add data/ to .gitignoreAsked (no)
--add-reviewer / --no-add-reviewerAdd / do not add the add-reviewer workflowAsked (no)
--overwriteOverwrite existing files without asking. Without it, you are asked when package.json, tsconfig.json or src already existsOff

Invalid values for --name, --org, --repo, --license or --variant make the CLI exit with an error. The prompts and most CLI messages are in Japanese.

Variants

VariantContents
baseMinimal setup: src/main.ts
config-batchBatch job with a JSON config (ConfigFramework from @book000/node-utils) and a generate-schema script
fastifyFastify HTTP server with @fastify/cors
discord-botdiscord.js bot with a config and a generate-schema script

Generated project

Every project gets tsconfig.json, .prettierrc.yml, eslint.config.mjs, renovate.json, .depcheckrc.json, .fixpackrc, pnpm-workspace.yaml, .devcontainer/devcontainer.json, .gitignore, .node-version (the Node.js version used to run the CLI), LICENSE (when it can be fetched), package.json, pnpm-lock.yaml, .github/workflows/nodejs-ci-pnpm.yml and the variant's src/ files. With --test, the variant's test files and tsconfig.test.json are added. Without it, Jest packages are removed after install.

Inside the generated project, pnpm run lint, pnpm run test (with --test), pnpm start and pnpm run dev are available.

Development

pnpm install
pnpm build   # bundle src/index.ts to dist/index.mjs with tsdown
pnpm lint    # prettier --check src, eslint, tsc
pnpm test    # vitest
node dist/index.mjs --help

The Node.js version is pinned in .node-version and pnpm in package.json. See AGENTS.md for the code structure and conventions.

Release

Every push to main or master runs .github/workflows/release.yml, which bumps the version from the Conventional Commit types, tags it, and publishes @book000/create-ts to npm. Do not bump the version or publish manually.

License

MIT

版本与发布记录

@book000/create-ts 共发布 433 个版本,首次发布于 2026/06/18;过去 12 个月发布了 433 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.2.80latest2026/11/11今天
0.2.792026/11/11今天
0.2.782026/11/11今天
0.2.772026/11/11今天
0.2.762026/11/101 天前
0.2.752026/11/101 天前

关于 @book000/create-ts 的常见问题

@book000/create-ts 是什么?

Create book000-style TypeScript projects

如何安装 @book000/create-ts?

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

@book000/create-ts 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/book000__create-ts 是否存在。

@book000/create-ts 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@book000/create-ts 需要什么版本的 Node.js?

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

@book000/create-ts 可以商用吗?

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

@book000/create-ts 的下载量有多少?

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

@book000/create-ts 还在维护吗?

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