@conformetry/nx

中文文档
0.0.79发布于 2026/11/10MITTypeScriptES Module构建来源已验证近 30 天下载 9443

Nx plugin providing dynamic generator scaffolding and conformance verification targets for Conformetry

原始使用文档
文档目录9 节
  1. Setup
  2. The emitted plugin
  3. Generating
  4. Validating
  5. Tag-scoped instances
  6. Exports
  7. Test
  8. License
  9. 👔 Conformetry

👔 Conformetry Nx

npm

The Nx host for Conformetry. Canonical documentation for command behavior, configuration, template syntax, scoring, and validators is in the @conformetry/cli README. This package adds two things the standalone CLI cannot offer: generators addressed by name through nx g, and a cached validation target inferred onto every project that holds instances.

npm install --save-dev @conformetry/nx

Setup

Register the plugin in nx.json and wire the bootstrap into postinstall:

{
  "plugins": [
    {
      "plugin": "@conformetry/nx",
      "options": {
        "configurationPath": "configuration/conformetry.config.ts",
        "validateTargetName": "conformetry-validate"
      }
    }
  ],
  "sync": { "globalGenerators": ["@conformetry/nx:sync"] }
}
{ "scripts": { "postinstall": "conformetry-nx-bootstrap-generators" } }

The configurationPath option is required: no default file is assumed and no filename is searched for. A plugin entry without it fails with a ConfigurationPathRequiredError from @conformetry/configuration naming the option, and so does the bootstrap, which reads it from nx.json. The executor and the sync generator take the same path as a configuration option, which wins over the registration when both are set.

Then type your configuration as ConformetryNxConfiguration rather than ConformetryConfiguration, so instance groups are checked against what Nx can actually resolve:

import { type ConformetryNxConfiguration } from "@conformetry/nx";

The emitted plugin

Which generators a workspace has is a property of its conformetry configuration, so the plugin exposing them is emitted rather than written. conformetry-nx-bootstrap-generators derives it from your configuration, writes it to .conformetry/nx-generators (gitignore that directory — it is a build artifact), and links it into the root node_modules so nx g conformetry:<generator> resolves. The link is what makes the plugin addressable, since Nx resolves a generator's package prefix by requiring it by name rather than by matching an Nx project.

DefaultValue
Output path.conformetry/nx-generators
Package nameconformetry — so generators are nx g conformetry:<name>

The bootstrap warns rather than exiting non-zero when the configuration cannot be read, so a configuration mid-edit never blocks an unrelated install. Drift is caught where it matters instead: every conformetry command compares the emitted plugin against the configuration and refuses to run against a stale one.

@conformetry/nx deliberately declares no generators of its own beyond sync. nx g @conformetry/nx:anything resolves nothing by design — which generators exist is a property of your configuration, not of this package.

sync runs both ways: nx sync and nx sync:check use it as the global sync generator, and nx g @conformetry/nx:sync runs it directly, writing the emitted plugin.

Generating

nx g conformetry:nestjs-service-module --name=billing --project=lexico

Nx prompts for missing inputs from the generator's own schema and writes through its virtual Tree, so --dry-run works and the workspace formatter runs over the result.

Validating

The plugin infers a conformetry-validate target onto every project holding instances, so validation is cached and participates in nx affected:

nx run <project>:conformetry-validate
nx run-many --target=conformetry-validate --all
nx affected --target=conformetry-validate --base=main
Executor optionPurpose
configurationConfiguration file, workspace-root relative. Taken from the configurationPath plugin option in nx.json when omitted; one of the two is required
languagesRestrict the run to named validators; all run when omitted

Tag-scoped instances

The Nx host reads an instance group's tags as project tags, and resolves that group's globs inside each matching project — so where a generator belongs is stated exactly once:

instances: [{ patterns: ["src/modules/*"], tags: ["framework:nestjs"] }];

A project must carry every tag a group names, so a second tag narrows the group further — tags: ["framework:nestjs", "language:graphql"] reaches only NestJS projects that are also GraphQL.

The two group forms are told apart by tags alone. There is no second field that could disagree with it: a separate scope that excluded a project the globs reached narrowed validation silently, and validation cannot notice instances it was never offered.

Omitting patterns selects the projects without locating anything in them, which is what a template with no instances yet wants — nx g is still confined to the projects the template suits.

Exports

runConformetryGenerator for generator wrappers, bootstrapPlugin and runBootstrapCli for the bootstrap, the ConformetryNxConfiguration and instance-group types, and the NestJS services behind them (PluginService, AdapterService, InstancesService, ScopeService, OptionsService).

Test

nx run conformetry-nx:vitest

License

MIT — see LICENSE.

👔 Conformetry

This project was generated from the nestjs-service-project conformetry template.

版本与发布记录

@conformetry/nx 共发布 77 个版本,首次发布于 2026/10/05;过去 12 个月发布了 77 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.0.79latest2026/11/10今天
0.0.782026/11/10今天
0.0.772026/11/091 天前
0.0.762026/11/091 天前
0.0.752026/11/091 天前
0.0.742026/11/082 天前

关于 @conformetry/nx 的常见问题

@conformetry/nx 是什么?

Nx plugin providing dynamic generator scaffolding and conformance verification targets for Conformetry

如何安装 @conformetry/nx?

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

@conformetry/nx 支持 TypeScript 吗?

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

@conformetry/nx 支持 ESM 还是 CommonJS?

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

@conformetry/nx 可以商用吗?

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

@conformetry/nx 的下载量有多少?

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

@conformetry/nx 还在维护吗?

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