@barcidev/ngx-autogen 0.1.47 → 0.1.48

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": "@barcidev/ngx-autogen",
3
- "version": "0.1.47",
3
+ "version": "0.1.48",
4
4
  "description": "A collection of Angular schematics for essential functionalities.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -142,12 +142,14 @@ function resolveComponentContext(tree, options) {
142
142
  (0, path_1.normalize)(srcIndex !== -1
143
143
  ? fullPath.substring(srcIndex)
144
144
  : (0, path_1.join)((0, path_1.normalize)("src"), "app"));
145
+ let componentName = options.name;
145
146
  const directory = tree.getDir(path);
146
147
  const componentFile = directory.subfiles.find((f) => f.endsWith(".component.ts")) ||
147
148
  directory.subfiles.find((f) => f.endsWith(".ts"));
148
- const componentName = componentFile
149
- ? componentFile.replace(".component.ts", "").replace(".ts", "")
150
- : options.name;
149
+ if (!options.name) {
150
+ componentName =
151
+ (componentFile === null || componentFile === void 0 ? void 0 : componentFile.replace(".component.ts", "").replace(".ts", "")) || "file";
152
+ }
151
153
  if (!componentName)
152
154
  throw new schematics_1.SchematicsException("❌ No se pudo determinar el nombre del componente.");
153
155
  return { path, componentFile, componentName };