@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 +1 -1
- package/package.json +1 -1
- package/skills/forge/scripts/rename.mjs +17 -10
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -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 =
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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
|
}
|