@epilot/validators

中文文档
0.0.30发布于 2026/05/14MITTypeScriptESM + CJS近 30 天下载 1.8万

Shared input validators, regex patterns, and AJV schema keywords used across epilot Journey apps.

原始使用文档
文档目录7 节
  1. Installation
  2. Usage
  3. Development
  4. Releasing
  5. Why
  6. Cutting a release
  7. If you forget step 4

@epilot/validators

Shared input validators, regex patterns, and AJV schema keywords used across epilot Journey apps.

Installation

yarn add @epilot/validators

Usage

import {
  functionalValidators,
  regExpStatments,
  schemaKeywords,
  IBAN_Specifications
} from '@epilot/validators'

What each export provides:

ExportDescription
functionalValidatorsCallback-style validators: iban, birth_date, future_date_14.
regExpStatmentsNamed regex patterns (email, name, German date, telephone, etc.).
schemaKeywordsAJV-compatible custom JSON Schema keywords.
IBAN_SpecificationsCountry specifications re-exported from the iban package.

Development

yarn install
yarn start       # tsdx watch — rebuild on change
yarn build       # tsdx build — produces dist/
yarn test        # tsdx test
yarn lint        # eslint

dist/ is gitignored. The prepack script rebuilds it automatically before any npm publish / npm pack, so a fresh checkout never needs a manual yarn build before releasing.

Releasing

The CI does not publish this package. The publish job is disabled in .gitlab-ci.yml. Pushing a tag does not trigger a release. Version bumps and publishes happen manually from a developer's machine.

Why

The @epilot npm organisation has 2FA on writes. An unattended GitLab runner can't supply an OTP, so CI publishes are blocked at the registry with a 403. Until a service-account-style token is configured at the npm-org level, publishing is a human step.

Cutting a release

  1. Be on master with a clean working tree and an up-to-date pull.
  2. Bump version, regenerate CHANGELOG.md, commit, tag, and push:
    yarn release
    
    This runs prerelease (lint + test), then standard-version, then postrelease (git push && git push --tags). It does not publish.
  3. Make sure you're logged in to npm as a user with publish rights on @epilot/validators:
    npm whoami       # confirm the right user
    npm login        # only if needed
    
  4. Publish:
    npm publish
    
    • prepack rebuilds dist/ from source.
    • npm prompts for your 2FA OTP.
    • On success, the new version is on the registry; the tag pushed in step 2 is now the canonical marker for it.

If you forget step 4

The tag exists but no version was published. Either:

  • Run npm publish from the tagged commit, or
  • Run yarn release again (it will bump to the next patch) and publish that.

npm doesn't allow republishing the same version, so if a publish half-completed, bump and republish.

版本与发布记录

@epilot/validators 共发布 25 个版本,首次发布于 2021/03/15;过去 12 个月发布了 6 个版本。

版本发布日期距今
0.0.30latest2026/05/146 个月前
0.0.272026/05/146 个月前
0.0.262026/05/146 个月前
0.0.252026/05/146 个月前
0.0.242026/05/146 个月前
0.0.232026/05/146 个月前

关于 @epilot/validators 的常见问题

@epilot/validators 是什么?

Shared input validators, regex patterns, and AJV schema keywords used across epilot Journey apps.

如何安装 @epilot/validators?

在项目目录运行 npm install @epilot/validators,或使用 pnpm add / yarn add / bun add。

@epilot/validators 支持 TypeScript 吗?

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

@epilot/validators 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@epilot/validators 需要什么版本的 Node.js?

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

@epilot/validators 可以商用吗?

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

@epilot/validators 的下载量有多少?

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

@epilot/validators 还在维护吗?

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