@barcidev/ngx-autogen 0.1.34 → 0.1.35
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 +2 -2
- package/src/transloco/index.js +21 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barcidev/ngx-autogen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.35",
|
|
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.
|
|
53
|
+
"@barcidev/typed-transloco": "^0.0.12",
|
|
54
54
|
"@schematics/angular": "^21.2.0",
|
|
55
55
|
"typescript": "~5.9.2"
|
|
56
56
|
},
|
package/src/transloco/index.js
CHANGED
|
@@ -34,13 +34,9 @@ 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
|
-
()
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
updateAppI18nTypeRule(finalOptions),
|
|
41
|
-
registerProviderInComponent(finalOptions, componentFile),
|
|
42
|
-
]);
|
|
43
|
-
},
|
|
37
|
+
generateI18nFiles(finalOptions),
|
|
38
|
+
updateAppI18nTypeRule(finalOptions),
|
|
39
|
+
registerProviderInComponent(finalOptions, componentFile),
|
|
44
40
|
]);
|
|
45
41
|
});
|
|
46
42
|
}
|
|
@@ -86,7 +82,7 @@ function updateAppI18nTypeRule(options) {
|
|
|
86
82
|
const camelName = schematics_1.strings.camelize(options.name);
|
|
87
83
|
const i18nConstantName = `${camelName}I18n`;
|
|
88
84
|
// Inyección de Import
|
|
89
|
-
const importStatement = `import { ${i18nConstantName} } from '${options.path
|
|
85
|
+
const importStatement = `import { ${i18nConstantName} } from '${options.path}/${schematics_1.strings.dasherize(options.name)}.i18n';\n`;
|
|
90
86
|
if (!content.includes(i18nConstantName)) {
|
|
91
87
|
content = importStatement + content;
|
|
92
88
|
}
|
|
@@ -117,15 +113,23 @@ function registerProviderInComponent(options, componentFile) {
|
|
|
117
113
|
return (tree) => tree;
|
|
118
114
|
const componentPath = (0, path_1.join)(options.path, componentFile);
|
|
119
115
|
const i18nConstantName = `${schematics_1.strings.camelize(options.name)}I18n`;
|
|
120
|
-
return (0,
|
|
121
|
-
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
116
|
+
return (0, schematics_1.chain)([
|
|
117
|
+
(0, file_actions_1.addProviderToStandaloneComponent)(componentPath, `provideTranslocoScopeWrapper(${i18nConstantName})`, [
|
|
118
|
+
{
|
|
119
|
+
symbol: "provideTranslocoScopeWrapper",
|
|
120
|
+
path: "@barcidev/typed-transloco",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
symbol: i18nConstantName,
|
|
124
|
+
path: `./${schematics_1.strings.dasherize(options.name)}.i18n`,
|
|
125
|
+
},
|
|
126
|
+
]),
|
|
127
|
+
(0, file_actions_1.addProviderToStandaloneComponent)(componentPath, "AppTypedTranslocoDirective", [
|
|
128
|
+
{
|
|
129
|
+
symbol: "AppTypedTranslocoDirective",
|
|
130
|
+
path: "@i18n/app-typed-transloco.directive",
|
|
131
|
+
},
|
|
132
|
+
]),
|
|
129
133
|
]);
|
|
130
134
|
}
|
|
131
135
|
/**
|