@barcidev/ngx-autogen 0.1.44 → 0.1.46

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.44",
3
+ "version": "0.1.46",
4
4
  "description": "A collection of Angular schematics for essential functionalities.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,9 +1,9 @@
1
- <div<% if (i18n === 'y') { %> *typedTransloco="let t; prefix:'<%= camelize(name) %>'"<% } %>>
1
+ <div<% if (i18n === 'yes') { %> *typedTransloco="let t; prefix:'<%= camelize(name) %>'"<% } %>>
2
2
  <h1>
3
- <% if (i18n === 'y') { %>{{ t('title') }}<% } else { %><%= classify(name) %> Works!<% } %>
3
+ <% if (i18n === 'yes') { %>{{ t('title') }}<% } else { %><%= classify(name) %> Works!<% } %>
4
4
  </h1>
5
5
 
6
- <% if (store === 'y') { %>
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 === 'y') { %>import { <%= classify(name) %>Store } from './state';<% } %>
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 === 'y') { %><%= classify(name) %>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 === 'y') { %>import { provideTranslocoScopeWrapper } from '@barcidev/typed-transloco';
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 === 'y') { %>import { <%= classify(name) %>Store } from './state';<% } %>
6
+ <% if (store === 'yes') { %>import { <%= classify(name) %>Store } from './state';<% } %>
7
7
 
8
8
  @Component({
9
- imports: [<% if (i18n === 'y') { %>AppTypedTranslocoDirective, JsonPipe<% } %>],
9
+ imports: [<% if (i18n === 'yes') { %>AppTypedTranslocoDirective, JsonPipe<% } %>],
10
10
  selector: 'app-<%= dasherize(name) %>',
11
- <% if (i18n === 'y') { %>providers: [provideTranslocoScopeWrapper(<%= camelize(name) %>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 === 'y') { %> private _<%= camelize(name) %>Store = inject(<%= classify(name) %>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,13 @@ 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() === "y"
26
- ? (0, schematics_1.schematic)("app-i18n", { name: context.options.name })
25
+ options.i18n.toLowerCase() === "yes"
26
+ ? (0, schematics_1.schematic)("app-i18n", {
27
+ name: context.options.name,
28
+ path: (0, path_1.join)(context.movePath, context.nameDash),
29
+ })
27
30
  : (0, schematics_1.noop)(),
28
- options.store.toLowerCase() === "y"
31
+ options.store.toLowerCase() === "yes"
29
32
  ? (0, schematics_1.schematic)("app-store", { name: context.options.name })
30
33
  : (0, schematics_1.noop)(),
31
34
  ]);
@@ -46,8 +49,6 @@ function resolveComponentContext(workspace, options) {
46
49
  ? fullPath.substring(srcIndex)
47
50
  : (0, path_1.join)((0, path_1.normalize)("src"), "app");
48
51
  let movePath = (0, path_1.normalize)(relativePath);
49
- if (!movePath.endsWith("state"))
50
- movePath = (0, path_1.join)(movePath, "state");
51
52
  // Resolución de Proyecto
52
53
  const projectName = options.project ||
53
54
  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? (Y/N)",
17
- "default": "Y",
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? (Y/N)",
24
- "default": "Y",
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",