@barcidev/ngx-autogen 0.1.13 → 0.1.14
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 +8 -12
package/package.json
CHANGED
package/src/transloco/index.js
CHANGED
|
@@ -32,13 +32,15 @@ function transloco(options) {
|
|
|
32
32
|
if (!project) {
|
|
33
33
|
throw new schematics_1.SchematicsException(`El proyecto "${options.project}" no existe.`);
|
|
34
34
|
}
|
|
35
|
-
//
|
|
35
|
+
// 3. Determinación de rutas para generación de archivos
|
|
36
36
|
const fullPath = process.cwd();
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
const srcIndex = fullPath.lastIndexOf("src");
|
|
38
|
+
const relativePath = srcIndex !== -1
|
|
39
|
+
? fullPath.substring(srcIndex)
|
|
40
|
+
: (0, path_1.join)((0, path_1.normalize)("src"), "app");
|
|
41
|
+
options.path = (0, path_1.normalize)(relativePath);
|
|
42
|
+
const directory = tree.getDir((0, path_1.normalize)(options.path));
|
|
43
|
+
console.log(`🔍 Buscando componente en: ${options.path}`);
|
|
42
44
|
const componentFile = directory.subfiles.find((file) => file.endsWith(".component.ts"));
|
|
43
45
|
console.log(`📄 Componente detectado: ${componentFile || "Ninguno"}`);
|
|
44
46
|
if (!componentFile && !options.name) {
|
|
@@ -49,12 +51,6 @@ function transloco(options) {
|
|
|
49
51
|
: options.name;
|
|
50
52
|
options.name = componentFileName;
|
|
51
53
|
console.log(`✅ Nombre del componente para i18n: ${options.name}`);
|
|
52
|
-
// 3. Determinación de rutas para generación de archivos
|
|
53
|
-
const srcIndex = fullPath.lastIndexOf("src");
|
|
54
|
-
const relativePath = srcIndex !== -1
|
|
55
|
-
? fullPath.substring(srcIndex)
|
|
56
|
-
: (0, path_1.join)((0, path_1.normalize)("src"), "app");
|
|
57
|
-
options.path = (0, path_1.normalize)(relativePath);
|
|
58
54
|
console.log(`📂 Ruta de generación de archivos i18n: ${options.path}`);
|
|
59
55
|
const namePath = options.path; // Generamos archivos en la misma carpeta del componente detectado
|
|
60
56
|
const rules = [];
|