@barcidev/ngx-autogen 0.1.32 → 0.1.34

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.32",
3
+ "version": "0.1.34",
4
4
  "description": "A collection of Angular schematics for essential functionalities.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -50,7 +50,7 @@
50
50
  "dependencies": {
51
51
  "@angular-devkit/core": "^21.2.0",
52
52
  "@angular-devkit/schematics": "^21.2.0",
53
- "@barcidev/typed-transloco": "^0.0.10",
53
+ "@barcidev/typed-transloco": "^0.0.11",
54
54
  "@schematics/angular": "^21.2.0",
55
55
  "typescript": "~5.9.2"
56
56
  },
@@ -34,9 +34,13 @@ function transloco(options) {
34
34
  const finalOptions = Object.assign(Object.assign({}, options), { name: componentName, path: path, project: projectName, projectRoot: projectRoot });
35
35
  return (0, schematics_1.chain)([
36
36
  ensureExternalConfig(),
37
- generateI18nFiles(finalOptions),
38
- updateAppI18nTypeRule(finalOptions),
39
- registerProviderInComponent(finalOptions, componentFile),
37
+ () => {
38
+ return (0, schematics_1.chain)([
39
+ generateI18nFiles(finalOptions),
40
+ updateAppI18nTypeRule(finalOptions),
41
+ registerProviderInComponent(finalOptions, componentFile),
42
+ ]);
43
+ },
40
44
  ]);
41
45
  });
42
46
  }
@@ -50,12 +54,12 @@ function transloco(options) {
50
54
  function ensureExternalConfig() {
51
55
  return (tree) => {
52
56
  const appConfigPath = "src/app/app.config.ts";
53
- // Si el archivo no existe, quizás es una app con NgModules,
54
- // pero si existe y no tiene el provider, corremos el external.
55
- if (tree.exists(appConfigPath)) {
57
+ const exists = tree.exists(appConfigPath);
58
+ if (exists) {
56
59
  const content = tree.read(appConfigPath).toString();
57
60
  if (!content.includes("provideTransloco")) {
58
- // Retornamos el schematic externo pasándole el proyecto explícitamente
61
+ // Al retornar el externalSchematic aquí, Angular CLI
62
+ // gestiona la creación de archivos global antes de pasar a la siguiente regla del chain
59
63
  return (0, schematics_1.externalSchematic)("@barcidev/typed-transloco", "ng-add", {});
60
64
  }
61
65
  }