@barcidev/ngx-autogen 0.1.51 → 0.1.52

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.51",
3
+ "version": "0.1.52",
4
4
  "description": "A collection of Angular schematics for essential functionalities.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -25,7 +25,9 @@ function signalStore(options) {
25
25
  const workspace = yield (0, workspace_1.getWorkspace)(tree);
26
26
  // 1. Preparar contexto y opciones enriquecidas
27
27
  const context = resolveStoreContext(workspace, options);
28
- const project = workspace.projects.get(context.projectName);
28
+ const project = workspace.projects.get(options.project || context.projectName);
29
+ if (!project)
30
+ throw new schematics_1.SchematicsException(`El proyecto "${options.project || context.projectName}" no existe.`);
29
31
  const projectRoot = (project === null || project === void 0 ? void 0 : project.sourceRoot) || "src";
30
32
  const { angularVersion } = (0, project_metadata_1.getProjectMetadata)(tree);
31
33
  // 2. Orquestar la ejecución
@@ -55,9 +57,10 @@ function resolveStoreContext(workspace, options) {
55
57
  // Resolución de Rutas (Lógica de Directorio Actual)
56
58
  const fullPath = process.cwd();
57
59
  const srcIndex = fullPath.lastIndexOf("src");
58
- let relativePath = options.path || srcIndex !== -1
59
- ? fullPath.substring(srcIndex)
60
- : (0, core_1.join)((0, core_1.normalize)("src"), "app");
60
+ let relativePath = options.path ||
61
+ (srcIndex !== -1
62
+ ? fullPath.substring(srcIndex)
63
+ : (0, core_1.join)((0, core_1.normalize)("src"), "app"));
61
64
  let movePath = (0, core_1.normalize)(relativePath);
62
65
  if (!movePath.endsWith("state"))
63
66
  movePath = (0, core_1.join)(movePath, "state");
@@ -29,7 +29,7 @@ function transloco(options) {
29
29
  throw new schematics_1.SchematicsException(`El proyecto "${projectName}" no existe.`);
30
30
  const projectRoot = project.sourceRoot || "src";
31
31
  // 2. Resolución de Contexto (Path y Componente)
32
- const { path, componentFile, componentName } = resolveComponentContext(tree, options);
32
+ const { path, componentFile, componentName } = resolveTranslocoContext(tree, options);
33
33
  // Sincronizamos las opciones normalizadas
34
34
  const finalOptions = Object.assign(Object.assign({}, options), { name: componentName, path: path, project: projectName, projectRoot: projectRoot });
35
35
  return (0, schematics_1.chain)([
@@ -66,7 +66,7 @@ function ensureExternalConfig() {
66
66
  function generateI18nFiles(options) {
67
67
  return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)("./files/component"), [
68
68
  (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) })),
69
- (0, schematics_1.move)(options.path),
69
+ (0, schematics_1.move)(options.path || "src/app"),
70
70
  ]));
71
71
  }
72
72
  // Actualización del archivo de tipos global
@@ -135,7 +135,7 @@ function registerProviderInComponent(options, componentFile) {
135
135
  /**
136
136
  * --- HELPERS ---
137
137
  */
138
- function resolveComponentContext(tree, options) {
138
+ function resolveTranslocoContext(tree, options) {
139
139
  const fullPath = process.cwd();
140
140
  const srcIndex = fullPath.lastIndexOf("src");
141
141
  const path = options.path ||