@barcidev/ngx-autogen 0.1.27 → 0.1.28
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 +21 -20
package/package.json
CHANGED
package/src/transloco/index.js
CHANGED
|
@@ -11,8 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.transloco = transloco;
|
|
13
13
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
-
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
15
|
-
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
|
16
14
|
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
17
15
|
const path_1 = require("path");
|
|
18
16
|
const file_actions_1 = require("../common/file-actions");
|
|
@@ -22,7 +20,6 @@ const pluralize_1 = require("../common/pluralize");
|
|
|
22
20
|
*/
|
|
23
21
|
function transloco(options) {
|
|
24
22
|
return (tree, _context) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
var _a;
|
|
26
23
|
// --- 1. CONFIGURACIÓN INICIAL Y WORKSPACE ---
|
|
27
24
|
const workspace = yield (0, workspace_1.getWorkspace)(tree);
|
|
28
25
|
if (!options.project) {
|
|
@@ -53,25 +50,26 @@ function transloco(options) {
|
|
|
53
50
|
options.name = componentFile
|
|
54
51
|
? componentFile.replace(".component.ts", "").replace(".ts", "")
|
|
55
52
|
: options.name;
|
|
56
|
-
const rules = [
|
|
57
|
-
(0, schematics_1.externalSchematic)("@barcidev/typed-transloco", "ng-add", {}),
|
|
58
|
-
];
|
|
53
|
+
const rules = [];
|
|
59
54
|
// --- 3. CONFIGURACIÓN GLOBAL (IDEMPOTENTE) ---
|
|
60
|
-
const appConfigPath = "src/app/app.config.ts";
|
|
61
|
-
const appConfigContent =
|
|
55
|
+
/*const appConfigPath = "src/app/app.config.ts";
|
|
56
|
+
const appConfigContent = tree.read(appConfigPath)?.toString() || "";
|
|
57
|
+
|
|
62
58
|
if (!appConfigContent.includes("provideTransloco")) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return host;
|
|
59
|
+
_context.logger.info(
|
|
60
|
+
"📦 Transloco no detectado. Configurando globalmente...",
|
|
61
|
+
);
|
|
62
|
+
// Dependencias y tarea de instalación
|
|
63
|
+
rules.push((host: Tree) => {
|
|
64
|
+
addPackageJsonDependency(host, {
|
|
65
|
+
type: NodeDependencyType.Default,
|
|
66
|
+
name: "@jsverse/transloco",
|
|
67
|
+
version: "^7.0.0",
|
|
73
68
|
});
|
|
74
|
-
|
|
69
|
+
_context.addTask(new NodePackageInstallTask());
|
|
70
|
+
return host;
|
|
71
|
+
});
|
|
72
|
+
}*/
|
|
75
73
|
// --- 4. GENERACIÓN DE ARCHIVOS I18N DEL COMPONENTE ---
|
|
76
74
|
rules.push((0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)("./files/component"), [
|
|
77
75
|
(0, schematics_1.applyTemplates)(Object.assign(Object.assign(Object.assign({}, schematics_1.strings), options), { pluralize: (word) => options.lang === "es" ? (0, pluralize_1.pluralizeEs)(word) : (0, pluralize_1.pluralizeEn)(word) })),
|
|
@@ -92,7 +90,10 @@ function transloco(options) {
|
|
|
92
90
|
},
|
|
93
91
|
]));
|
|
94
92
|
}
|
|
95
|
-
return (0, schematics_1.chain)(
|
|
93
|
+
return (0, schematics_1.chain)([
|
|
94
|
+
...rules,
|
|
95
|
+
(0, schematics_1.externalSchematic)("@barcidev/typed-transloco", "ng-add", {}),
|
|
96
|
+
]);
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
/*function updateAppI18nType(
|