@barcidev/ngx-autogen 0.1.9 → 0.1.10
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 +5 -0
package/package.json
CHANGED
package/src/transloco/index.js
CHANGED
|
@@ -38,7 +38,9 @@ function transloco(options) {
|
|
|
38
38
|
.replace(process.cwd(), "")
|
|
39
39
|
.replace(/\\/g, "/");
|
|
40
40
|
const directory = tree.getDir((0, path_1.normalize)(relativeExecutionPath));
|
|
41
|
+
console.log(`🔍 Buscando componente en: ${relativeExecutionPath}`);
|
|
41
42
|
const componentFile = directory.subfiles.find((file) => file.endsWith(".component.ts"));
|
|
43
|
+
console.log(`📄 Componente detectado: ${componentFile || "Ninguno"}`);
|
|
42
44
|
if (!componentFile && !options.name) {
|
|
43
45
|
throw new schematics_1.SchematicsException("❌ No se encontró un archivo *.component.ts en este directorio.");
|
|
44
46
|
}
|
|
@@ -46,12 +48,14 @@ function transloco(options) {
|
|
|
46
48
|
? componentFile.replace(".component.ts", "")
|
|
47
49
|
: options.name;
|
|
48
50
|
options.name = componentFileName;
|
|
51
|
+
console.log(`✅ Nombre del componente para i18n: ${options.name}`);
|
|
49
52
|
// 3. Determinación de rutas para generación de archivos
|
|
50
53
|
const srcIndex = fullPath.lastIndexOf("src");
|
|
51
54
|
const relativePath = srcIndex !== -1
|
|
52
55
|
? fullPath.substring(srcIndex)
|
|
53
56
|
: (0, path_1.join)((0, path_1.normalize)("src"), "app");
|
|
54
57
|
options.path = (0, path_1.normalize)(relativePath);
|
|
58
|
+
console.log(`📂 Ruta de generación de archivos i18n: ${options.path}`);
|
|
55
59
|
const namePath = options.path; // Generamos archivos en la misma carpeta del componente detectado
|
|
56
60
|
const rules = [];
|
|
57
61
|
// 4. Verificación de instalación de Transloco (Idempotencia)
|
|
@@ -94,6 +98,7 @@ function transloco(options) {
|
|
|
94
98
|
if (componentFile) {
|
|
95
99
|
const componentPath = (0, path_1.join)(namePath, componentFile);
|
|
96
100
|
const i18nConstantName = `${schematics_1.strings.camelize(options.name)}I18n`;
|
|
101
|
+
console.log(`🔗 Registrando scope de Transloco en ${componentFile} con constante ${i18nConstantName}, este es el path: ${componentPath}`);
|
|
97
102
|
rules.push((0, file_actions_1.addProviderToStandaloneComponent)(componentPath, `provideTranslocoScopeWrapper(${i18nConstantName})`, [
|
|
98
103
|
{
|
|
99
104
|
symbol: `provideTranslocoScopeWrapper`,
|