@webpieces/code-rules 0.3.362 → 0.3.363

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/code-rules",
3
- "version": "0.3.362",
3
+ "version": "0.3.363",
4
4
  "description": "Standalone code validation rules extracted from architecture-validators, no Nx dependency required",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -20,7 +20,7 @@
20
20
  "directory": "packages/tooling/code-rules"
21
21
  },
22
22
  "dependencies": {
23
- "@webpieces/rules-config": "0.3.362",
23
+ "@webpieces/rules-config": "0.3.363",
24
24
  "@inversifyjs/binding-decorators": "1.1.5",
25
25
  "inversify": "7.10.4",
26
26
  "reflect-metadata": "0.2.2"
@@ -27,7 +27,7 @@ const rules_config_2 = require("@webpieces/rules-config");
27
27
  const inversify_1 = require("inversify");
28
28
  const tag_rule_1 = require("./tag-rule");
29
29
  const ROLE_TAG_PREFIX = 'role:';
30
- const DEFAULT_KNOWN_TYPES = ['server', 'app', 'designed-lib', 'lib', 'client', 'api-lib'];
30
+ const DEFAULT_KNOWN_TYPES = ['server', 'app', 'bundle', 'designed-lib', 'lib', 'client', 'api-lib'];
31
31
  /** The role-tag flavor of the shared missing-tag scan (exported for tests). */
32
32
  function findRoleUntaggedProjects(workspaceRoot, changedFiles) {
33
33
  return (0, tag_rule_1.findProjectsMissingTag)(workspaceRoot, changedFiles, ROLE_TAG_PREFIX);
@@ -1 +1 @@
1
- {"version":3,"file":"validate-role-tag.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-role-tag.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAYH,4DAEC;;AAZD,0DAAqE;AACrE,qDAAiE;AACjE,0DAA2D;AAC3D,yCAAuC;AACvC,yCAAqG;AAErG,MAAM,eAAe,GAAG,OAAO,CAAC;AAChC,MAAM,mBAAmB,GA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AE,CAAC,CAAC;IAC1C,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,aAAa,GAAG,IAAI,sBAAW,CAAC,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAI/G,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,8BAA4B;IAC9D,YAAY,MAAqB;QAC7B,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,aAAqB;QAC3B,OAAO,IAAA,0BAAe,EAAC,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;IACtE,CAAC;CACJ,CAAA;AARY,4CAAgB;2BAAhB,gBAAgB;IAF5B,IAAA,+BAAgB,GAAE;IAClB,IAAA,sBAAU,GAAE;6CAEW,4BAAa;GADxB,gBAAgB,CAQ5B","sourcesContent":["/**\n * Validate Role Tag Executor\n *\n * Every project that a changed source file belongs to must carry a\n * `role:<value>` nx tag in its project.json. That tag is the project's ROLE\n * (orthogonal to its `framework` libType):\n *\n * role:server | role:designed-lib | role:lib | role:client\n *\n * It is the source of truth for the `role` field written into\n * architecture/dependencies.json, for the `role-dependency` edge rule (apps are\n * never depended upon), and for DI-design generation (server → @DocumentDesign,\n * designed-lib → @DocumentDesign, lib → none, client → angular design).\n *\n * The project-walking + diff-scoping + mode logic is shared with the\n * `framework-tag` rule in `tag-rule.ts`; this file supplies only the\n * role-specific prefix, known values, and violation message.\n */\n\nimport { ProjectMode, RoleTagConfig } from '@webpieces/rules-config';\nimport { CodeValidator, ExecutorResult } from './code-validator';\nimport { provideSingleton } from '@webpieces/rules-config';\nimport { injectable } from 'inversify';\nimport { MissingTagProject, TagRuleSpec, findProjectsMissingTag, runTagValidator } from './tag-rule';\n\nconst ROLE_TAG_PREFIX = 'role:';\nconst DEFAULT_KNOWN_TYPES = ['server', 'app', 'designed-lib', 'lib', 'client', 'api-lib'];\n\n/** The role-tag flavor of the shared missing-tag scan (exported for tests). */\nexport function findRoleUntaggedProjects(workspaceRoot: string, changedFiles: string[]): MissingTagProject[] {\n return findProjectsMissingTag(workspaceRoot, changedFiles, ROLE_TAG_PREFIX);\n}\n\nfunction reportViolations(untagged: MissingTagProject[], knownTypes: string[], mode: ProjectMode): void {\n const suggestion = knownTypes.map((t: string) => `${ROLE_TAG_PREFIX}${t}`).join(' | ');\n console.error('');\n console.error('❌ Every modified project must declare its role (a role tag)!');\n console.error('');\n console.error(` Add ONE of these to the project's project.json \"tags\" array: ${suggestion}`);\n console.error(' (server = runnable HTTP app · app = runnable non-HTTP app via container.get(XxxApp) ·');\n console.error(' designed-lib = library with a @DocumentDesign DI design ·');\n console.error(' lib = plain library, no design · client = client app e.g. angular.)');\n console.error(' This role drives DI-design generation, the arch graph, and the role-dependency rule.');\n console.error('');\n\n for (const project of untagged) {\n console.error(` ❌ ${project.name} — ${project.projectJsonPath}`);\n console.error(` add e.g. \"tags\": [\"${ROLE_TAG_PREFIX}lib\"]`);\n }\n console.error('');\n console.error(` Current mode: ${mode}`);\n console.error('');\n}\n\nconst ROLE_TAG_SPEC = new TagRuleSpec(ROLE_TAG_PREFIX, 'role-tag', 'Role Tag', DEFAULT_KNOWN_TYPES, reportViolations);\n\n@provideSingleton()\n@injectable()\nexport class RoleTagValidator extends CodeValidator<RoleTagConfig> {\n constructor(config: RoleTagConfig) {\n super(config, 'role-tag');\n }\n\n async run(workspaceRoot: string): Promise<ExecutorResult> {\n return runTagValidator(this.config, workspaceRoot, ROLE_TAG_SPEC);\n }\n}\n"]}
1
+ {"version":3,"file":"validate-role-tag.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-role-tag.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAYH,4DAEC;;AAZD,0DAAqE;AACrE,qDAAiE;AACjE,0DAA2D;AAC3D,yCAAuC;AACvC,yCAAq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AK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,aAAa,GAAG,IAAI,sBAAW,CAAC,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAI/G,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,8BAA4B;IAC9D,YAAY,MAAqB;QAC7B,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,aAAqB;QAC3B,OAAO,IAAA,0BAAe,EAAC,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;IACtE,CAAC;CACJ,CAAA;AARY,4CAAgB;2BAAhB,gBAAgB;IAF5B,IAAA,+BAAgB,GAAE;IAClB,IAAA,sBAAU,GAAE;6CAEW,4BAAa;GADxB,gBAAgB,CAQ5B","sourcesContent":["/**\n * Validate Role Tag Executor\n *\n * Every project that a changed source file belongs to must carry a\n * `role:<value>` nx tag in its project.json. That tag is the project's ROLE\n * (orthogonal to its `framework` libType):\n *\n * role:server | role:designed-lib | role:lib | role:client\n *\n * It is the source of truth for the `role` field written into\n * architecture/dependencies.json, for the `role-dependency` edge rule (apps are\n * never depended upon), and for DI-design generation (server → @DocumentDesign,\n * designed-lib → @DocumentDesign, lib → none, client → angular design).\n *\n * The project-walking + diff-scoping + mode logic is shared with the\n * `framework-tag` rule in `tag-rule.ts`; this file supplies only the\n * role-specific prefix, known values, and violation message.\n */\n\nimport { ProjectMode, RoleTagConfig } from '@webpieces/rules-config';\nimport { CodeValidator, ExecutorResult } from './code-validator';\nimport { provideSingleton } from '@webpieces/rules-config';\nimport { injectable } from 'inversify';\nimport { MissingTagProject, TagRuleSpec, findProjectsMissingTag, runTagValidator } from './tag-rule';\n\nconst ROLE_TAG_PREFIX = 'role:';\nconst DEFAULT_KNOWN_TYPES = ['server', 'app', 'bundle', 'designed-lib', 'lib', 'client', 'api-lib'];\n\n/** The role-tag flavor of the shared missing-tag scan (exported for tests). */\nexport function findRoleUntaggedProjects(workspaceRoot: string, changedFiles: string[]): MissingTagProject[] {\n return findProjectsMissingTag(workspaceRoot, changedFiles, ROLE_TAG_PREFIX);\n}\n\nfunction reportViolations(untagged: MissingTagProject[], knownTypes: string[], mode: ProjectMode): void {\n const suggestion = knownTypes.map((t: string) => `${ROLE_TAG_PREFIX}${t}`).join(' | ');\n console.error('');\n console.error('❌ Every modified project must declare its role (a role tag)!');\n console.error('');\n console.error(` Add ONE of these to the project's project.json \"tags\" array: ${suggestion}`);\n console.error(' (server = runnable HTTP app · app = runnable non-HTTP app via container.get(XxxApp) ·');\n console.error(' designed-lib = library with a @DocumentDesign DI design ·');\n console.error(' lib = plain library, no design · client = client app e.g. angular.)');\n console.error(' This role drives DI-design generation, the arch graph, and the role-dependency rule.');\n console.error('');\n\n for (const project of untagged) {\n console.error(` ❌ ${project.name} — ${project.projectJsonPath}`);\n console.error(` add e.g. \"tags\": [\"${ROLE_TAG_PREFIX}lib\"]`);\n }\n console.error('');\n console.error(` Current mode: ${mode}`);\n console.error('');\n}\n\nconst ROLE_TAG_SPEC = new TagRuleSpec(ROLE_TAG_PREFIX, 'role-tag', 'Role Tag', DEFAULT_KNOWN_TYPES, reportViolations);\n\n@provideSingleton()\n@injectable()\nexport class RoleTagValidator extends CodeValidator<RoleTagConfig> {\n constructor(config: RoleTagConfig) {\n super(config, 'role-tag');\n }\n\n async run(workspaceRoot: string): Promise<ExecutorResult> {\n return runTagValidator(this.config, workspaceRoot, ROLE_TAG_SPEC);\n }\n}\n"]}