@ronaldjdevfs/forge 1.3.2 → 1.3.3

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <img src="favicon.svg" alt="Forge Logo" width="100" height="100">
2
2
 
3
- > **v1.4.0** — Domain Subdirectory Structure & Port Support
3
+ > **v1.3.2** — Domain Subdirectory Structure & Port Support
4
4
 
5
5
  ## Forge — Backend Architecture Operating System
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronaldjdevfs/forge",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Forge — Architecture Operating System for backend systems. Arquitectura Hexagonal, DDD pragmático y vertical slices.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -40,6 +40,13 @@ function toPascalCase(str) {
40
40
  .join("");
41
41
  }
42
42
 
43
+ function toPascalCaseI(str) {
44
+ if (/^I[A-Za-z]/.test(str)) {
45
+ return "I" + toPascalCase(str.slice(1));
46
+ }
47
+ return toPascalCase(str);
48
+ }
49
+
43
50
  function toCamelCase(str) {
44
51
  const pascal = toPascalCase(str);
45
52
  return pascal.charAt(0).toLowerCase() + pascal.slice(1);
@@ -189,7 +196,7 @@ export function computeExpectedName(filePath) {
189
196
  } else {
190
197
  inferredEntity = stem;
191
198
  }
192
- const entityStem = toPascalCase(inferredEntity);
199
+ const entityStem = toPascalCaseI(inferredEntity);
193
200
  const expectedName = `${entityStem}.entity${ext}`;
194
201
  if (expectedName !== filename) {
195
202
  return { current: filePath, expected: join(dirname(filePath), expectedName), relPath: join(dirname(relPath), expectedName), rule: `feature/${featureName}/domain/entities: ${rule.description}` };
@@ -215,7 +222,7 @@ export function computeExpectedName(filePath) {
215
222
  const noEntity = stem.replace(/[Ee]ntity$/, "");
216
223
  inferredEntity = noEntity || featureName;
217
224
  }
218
- const entityStem = toPascalCase(inferredEntity);
225
+ const entityStem = toPascalCaseI(inferredEntity);
219
226
  const expectedName = `${entityStem}.entity${ext}`;
220
227
  const expectedPath = join(dirname(filePath), "entities", expectedName);
221
228
  return { current: filePath, expected: expectedPath, relPath: join(dirname(relPath), "entities", expectedName), rule: `feature/${featureName}/domain → domain/entities: ${rule.description}` };
@@ -229,7 +236,7 @@ export function computeExpectedName(filePath) {
229
236
  } else {
230
237
  inferredPort = stem;
231
238
  }
232
- const portStem = toPascalCase(inferredPort);
239
+ const portStem = toPascalCaseI(inferredPort);
233
240
  const expectedName = `${portStem}.port${ext}`;
234
241
  if (expectedName !== filename) {
235
242
  return { current: filePath, expected: join(dirname(filePath), expectedName), relPath: join(dirname(relPath), expectedName), rule: `feature/${featureName}/domain: ${rule.description}` };
@@ -336,13 +343,13 @@ export function computeExpectedName(filePath) {
336
343
  if (subdir === "contracts") {
337
344
  const hasI = stem.startsWith("I");
338
345
  if (hasI) {
339
- const fixedStem = toPascalCase(stem);
340
- if (fixedStem !== stem) {
341
- const expectedName = `${fixedStem}${ext}`;
342
- return { current: filePath, expected: join(dirname(filePath), expectedName), relPath: join(dirname(relPath), expectedName), rule: `shared/contracts: ${rule.description}` };
343
- }
344
- } else {
345
- const expectedName = `I${toPascalCase(stem)}${ext}`;
346
+ const fixedStem = toPascalCaseI(stem);
347
+ if (fixedStem !== stem) {
348
+ const expectedName = `${fixedStem}${ext}`;
349
+ return { current: filePath, expected: join(dirname(filePath), expectedName), relPath: join(dirname(relPath), expectedName), rule: `shared/contracts: ${rule.description}` };
350
+ }
351
+ } else {
352
+ const expectedName = `I${toPascalCaseI(stem)}${ext}`;
346
353
  return { current: filePath, expected: join(dirname(filePath), expectedName), relPath: join(dirname(relPath), expectedName), rule: `shared/contracts: ${rule.description}` };
347
354
  }
348
355
  }