@barcidev/ngx-autogen 0.1.43 → 0.1.45
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/angular/component/files/__name@dasherize__.component.html.template +3 -3
- package/src/angular/component/files/__name@dasherize__.component.spec.ts.template +2 -2
- package/src/angular/component/files/__name@dasherize__.component.ts.template +5 -5
- package/src/angular/component/index.js +2 -4
- package/src/angular/component/schema.json +4 -6
- package/src/collection.json +2 -2
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<div<% if (i18n === '
|
|
1
|
+
<div<% if (i18n === 'yes') { %> *typedTransloco="let t; prefix:'<%= camelize(name) %>'"<% } %>>
|
|
2
2
|
<h1>
|
|
3
|
-
<% if (i18n === '
|
|
3
|
+
<% if (i18n === 'yes') { %>{{ t('title') }}<% } else { %><%= classify(name) %> Works!<% } %>
|
|
4
4
|
</h1>
|
|
5
5
|
|
|
6
|
-
<% if (store === '
|
|
6
|
+
<% if (store === 'yes') { %>
|
|
7
7
|
<pre>{{ data$() | json }}</pre>
|
|
8
8
|
<% } %>
|
|
9
9
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.component';
|
|
3
|
-
<% if (store === '
|
|
3
|
+
<% if (store === 'yes') { %>import { <%= classify(name) %>Store } from './state';<% } %>
|
|
4
4
|
|
|
5
5
|
describe('<%= classify(name) %>Component', () => {
|
|
6
6
|
let component: <%= classify(name) %>Component;
|
|
@@ -10,7 +10,7 @@ describe('<%= classify(name) %>Component', () => {
|
|
|
10
10
|
await TestBed.configureTestingModule({
|
|
11
11
|
imports: [<%= classify(name) %>Component],
|
|
12
12
|
providers: [
|
|
13
|
-
<% if (store === '
|
|
13
|
+
<% if (store === 'yes') { %><%= classify(name) %>Store,<% } %>
|
|
14
14
|
]
|
|
15
15
|
}).compileComponents();
|
|
16
16
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Component, inject } from '@angular/core';
|
|
2
2
|
import { JsonPipe } from '@angular/common';
|
|
3
|
-
<% if (i18n === '
|
|
3
|
+
<% if (i18n === 'yes') { %>import { provideTranslocoScopeWrapper } from '@barcidev/typed-transloco';
|
|
4
4
|
import { <%= camelize(name) %>I18n } from './<%= dasherize(name) %>.i18n';
|
|
5
5
|
import { AppTypedTranslocoDirective } from '@i18n/app-typed-transloco.directive';<% } %>
|
|
6
|
-
<% if (store === '
|
|
6
|
+
<% if (store === 'yes') { %>import { <%= classify(name) %>Store } from './state';<% } %>
|
|
7
7
|
|
|
8
8
|
@Component({
|
|
9
|
-
imports: [<% if (i18n === '
|
|
9
|
+
imports: [<% if (i18n === 'yes') { %>AppTypedTranslocoDirective, JsonPipe<% } %>],
|
|
10
10
|
selector: 'app-<%= dasherize(name) %>',
|
|
11
|
-
<% if (i18n === '
|
|
11
|
+
<% if (i18n === 'yes') { %>providers: [provideTranslocoScopeWrapper(<%= camelize(name) %>I18n)],<% } %>
|
|
12
12
|
styleUrls: ['./<%= dasherize(name) %>.component.scss'],
|
|
13
13
|
templateUrl: './<%= dasherize(name) %>.component.html',
|
|
14
14
|
})
|
|
15
15
|
export class <%= classify(name) %>Component {
|
|
16
|
-
<% if (store === '
|
|
16
|
+
<% if (store === 'yes') { %> private _<%= camelize(name) %>Store = inject(<%= classify(name) %>Store);
|
|
17
17
|
data$ = this._<%= camelize(name) %>Store.entities();<% } %>
|
|
18
18
|
}
|
|
@@ -22,10 +22,10 @@ function component(options) {
|
|
|
22
22
|
// Aquí podrías agregar más reglas para otras funcionalidades, como NgRx
|
|
23
23
|
return (0, schematics_1.chain)([
|
|
24
24
|
generateComponentFiles(context),
|
|
25
|
-
options.i18n.toLowerCase() === "
|
|
25
|
+
options.i18n.toLowerCase() === "yes"
|
|
26
26
|
? (0, schematics_1.schematic)("app-i18n", { name: context.options.name })
|
|
27
27
|
: (0, schematics_1.noop)(),
|
|
28
|
-
options.store.toLowerCase() === "
|
|
28
|
+
options.store.toLowerCase() === "yes"
|
|
29
29
|
? (0, schematics_1.schematic)("app-store", { name: context.options.name })
|
|
30
30
|
: (0, schematics_1.noop)(),
|
|
31
31
|
]);
|
|
@@ -46,8 +46,6 @@ function resolveComponentContext(workspace, options) {
|
|
|
46
46
|
? fullPath.substring(srcIndex)
|
|
47
47
|
: (0, path_1.join)((0, path_1.normalize)("src"), "app");
|
|
48
48
|
let movePath = (0, path_1.normalize)(relativePath);
|
|
49
|
-
if (!movePath.endsWith("state"))
|
|
50
|
-
movePath = (0, path_1.join)(movePath, "state");
|
|
51
49
|
// Resolución de Proyecto
|
|
52
50
|
const projectName = options.project ||
|
|
53
51
|
workspace.extensions.defaultProject ||
|
|
@@ -13,16 +13,14 @@
|
|
|
13
13
|
"store":{
|
|
14
14
|
"type": "string",
|
|
15
15
|
"description": "Whether to create a store for the component.",
|
|
16
|
-
"x-prompt": "Do you want to create a store for the component?
|
|
17
|
-
"
|
|
18
|
-
"enum": ["Y", "N", "y", "n"]
|
|
16
|
+
"x-prompt": "Do you want to create a store for the component?",
|
|
17
|
+
"enum": ["Yes", "No"]
|
|
19
18
|
},
|
|
20
19
|
"i18n": {
|
|
21
20
|
"type": "string",
|
|
22
21
|
"description": "Whether to create an i18n file for the component.",
|
|
23
|
-
"x-prompt": "Do you want to create an i18n file for the component?
|
|
24
|
-
"
|
|
25
|
-
"enum": ["Y", "N", "y", "n"]
|
|
22
|
+
"x-prompt": "Do you want to create an i18n file for the component?",
|
|
23
|
+
"enum": ["Yes", "No"]
|
|
26
24
|
},
|
|
27
25
|
"path": {
|
|
28
26
|
"type": "string",
|
package/src/collection.json
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"app-component": {
|
|
20
20
|
"description": "Generates an Angular component with optional i18n and NgRx support.",
|
|
21
|
-
"factory": "./component/index#component",
|
|
22
|
-
"schema": "./component/schema.json"
|
|
21
|
+
"factory": "./angular/component/index#component",
|
|
22
|
+
"schema": "./angular/component/schema.json"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|