@barcidev/ngx-autogen 0.1.46 → 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 +1 -1
- package/src/transloco/index.js +9 -6
package/package.json
CHANGED
package/src/transloco/index.js
CHANGED
|
@@ -138,15 +138,18 @@ function registerProviderInComponent(options, componentFile) {
|
|
|
138
138
|
function resolveComponentContext(tree, options) {
|
|
139
139
|
const fullPath = process.cwd();
|
|
140
140
|
const srcIndex = fullPath.lastIndexOf("src");
|
|
141
|
-
const path =
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
const path = options.path ||
|
|
142
|
+
(0, path_1.normalize)(srcIndex !== -1
|
|
143
|
+
? fullPath.substring(srcIndex)
|
|
144
|
+
: (0, path_1.join)((0, path_1.normalize)("src"), "app"));
|
|
145
|
+
let componentName = options.name;
|
|
144
146
|
const directory = tree.getDir(path);
|
|
145
147
|
const componentFile = directory.subfiles.find((f) => f.endsWith(".component.ts")) ||
|
|
146
148
|
directory.subfiles.find((f) => f.endsWith(".ts"));
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
if (!options.name) {
|
|
150
|
+
componentName =
|
|
151
|
+
(componentFile === null || componentFile === void 0 ? void 0 : componentFile.replace(".component.ts", "").replace(".ts", "")) || "file";
|
|
152
|
+
}
|
|
150
153
|
if (!componentName)
|
|
151
154
|
throw new schematics_1.SchematicsException("❌ No se pudo determinar el nombre del componente.");
|
|
152
155
|
return { path, componentFile, componentName };
|