交错核心
共享合同彼此 调和
软件包正在扩展。 是五层脊椎的叶子 core <- configuration <- analysis <- output <- cli 因此它宣布类型和持有
无可执行文件:无服务、无雀巢JS模块、不依赖任何东西
其它的,在图表中。 因此从这里导入结果类型
无所牵引.
npm install --save-dev @conformetry/core
它拥有的
| 文件 | 责任 |
|---|---|
lib/differences.types.ts | 结构化 ConformetryDifference 形状,以及歧视语言和类别联盟 |
lib/inventory.types.ts | 发现什么,因为输出层使它: 模板、实例以及它们之间的配对 |
lib/runner.types.ts | 这个 ConformetryLanguageValidator 合同和文件、有效载荷,以及结果形状 |
lib/scoring.types.ts | InstanceScore: 匹配实例如何符合匹配模板 |
这些类型的行为描述了他们之上的生命. 区别和得分
原始的,文件存在证,每个格式的验证器都在
@conformetry/languages; 验证符
信封装入 @conformetry/validation· ;
渲染为 @conformetry/output。 。 。 .
这里的"语言"是指一个文件格式——TypeScript,JSON,
(原始内容存档于2018-10-21). Mark down, Python. “插件”一词保留在 Nx 插件中
@conformetry/nx,并被故意不使用
这些.
写入语言验证符
验证器提供描述符和单文件比较. 延长
过滤、在文件下组合差异并组装结果
处理一次 RunnerService 内 @conformetry/validation,所以一种语言
软件包只包含其比较逻辑 :
@Injectable()
export class ExampleValidatorService implements ConformetryLanguageValidator {
public readonly descriptor = EXAMPLE_VALIDATOR_DESCRIPTOR;
public validateDocument(
document: PreparedValidationDocument,
): DocumentValidationResult {
// compare document.renderedTemplate against document.instance
return { differences, totalWeight };
}
}
重量和分数
一个验证者报告说,模板需要多少,以及它找到多少.
totalWeight 计算所权衡的每一项要求——符合要求
包括其中,因为不让他们参加只得比
已经错了部分.
每种差异可能包含一个 weight,默认为 1. 上面写着多少个
证明人报告缺失
无论它持有多少成员,都曾参加过一次课,因此,它以 "
子树是将一个类从成本中删除到删除
导入。 不需要人均体重表——一个等级的价值更高,因为它
包含更多内容.
score = (totalWeight - sum(difference.weight ?? 1)) / totalWeight
ScoringService输入 @conformetry/languages,拥有算术,包括
两种情况值得纠正一次:
宣布无;和一个空模板,其分母为零
因此,它完全符合.
@conformetry/validation 驱动
已注册的验证器; 它们从来不负责发现文件或
装入配置.
结构差异
分歧沿两侧的位置——实例和模板)
与预期价值和混凝土 fix。最后一个字段是:
报告要由任何人或任何方面采取行动
文件符合。 优先充电 instanceLine编号 :templateLine (或
instancePath 用于文档格式)将一个位置折叠到信件中.
出口
只有类型 : ConformetryDifference, (中文(简体) ), ConformetryDifferenceLanguage, (中文(简体) ),
ConformetryDifferenceType, (中文(简体) ), ConformetryLanguageValidator, (中文(简体) ), DirectoryEntry, (中文(简体) ),
DocumentValidationResult, (中文(简体) ), FileSystemAdapter, (中文(简体) ), GeneratorDefinition, (中文(简体) ),
GeneratorHook, (中文(简体) ), GeneratorHookContext, (中文(简体) ), GeneratorHooks, (中文(简体) ), InstanceScore, (中文(简体) ),
InventoriedInstance, (中文(简体) ), InventoriedPairing, (中文(简体) ), InventoriedTemplate, (中文(简体) ),
LanguageValidatorDescriptor, (中文(简体) ), LanguageValidatorResult, (中文(简体) ),
PreparedValidationDocument, (中文(简体) ), PreparedValidationPayload,以及
ValidationFileResult。 。 。 .
测试
nx run conformetry-core:vitest
一个测试,它声称这个包裹是叶子的属性: 模块在运行时无贡献, 因此从这里导入结果类型 无法将服务或雀巢JS模块拖入其后方。 导出一个值失败 这个.
许可证
麻省理工学院——见 自由主义。 。 。 .
* 调和
这个项目源于 巢-服务-项目 符合模板.