ngx-essentials-schematics 0.0.12 → 0.0.14

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": "ngx-essentials-schematics",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "A collection of Angular schematics for essential functionalities.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -5,6 +5,11 @@
5
5
  "description": "Adds NgRx Store to the Angular application with signal support.",
6
6
  "factory": "./ngrx/store/index#signalStore",
7
7
  "schema": "./ngrx/store/schema.json"
8
+ },
9
+ "ng-add": {
10
+ "description": "Ng add schematic for ngx-essentials-schematics.",
11
+ "factory": "./ng-add/index#ngAdd",
12
+ "schema": "./ng-add/schema.json"
8
13
  }
9
14
  }
10
15
  }
@@ -0,0 +1,3 @@
1
+ import { Rule } from "@angular-devkit/schematics";
2
+ import { NgAddSchema } from "./schema";
3
+ export declare function ngAdd(options: NgAddSchema): Rule;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngAdd = ngAdd;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ function ngAdd(options) {
6
+ return (tree, _context) => {
7
+ const workspacePath = "/angular.json";
8
+ const buffer = tree.read(workspacePath);
9
+ if (!buffer) {
10
+ throw new schematics_1.SchematicsException("Could not find angular.json");
11
+ }
12
+ const workspace = JSON.parse(buffer.toString());
13
+ if (!workspace.cli) {
14
+ workspace.cli = {};
15
+ }
16
+ const collections = workspace.cli.schematicCollections || [];
17
+ if (!collections.includes("ngx-essentials-schematics")) {
18
+ collections.push("ngx-essentials-schematics");
19
+ }
20
+ workspace.cli.schematicCollections = collections;
21
+ if (!workspace.schematics) {
22
+ workspace.schematics = {};
23
+ }
24
+ workspace.schematics["ngx-essentials-schematics:all"] = {
25
+ pk: options.pk,
26
+ };
27
+ tree.overwrite(workspacePath, JSON.stringify(workspace, null, 2));
28
+ _context.logger.info("✅ Configuration completed. Your default Primary Key is: " + options.pk);
29
+ return tree;
30
+ };
31
+ }
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ export interface NgAddSchema {
2
+ pk: string;
3
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "id": "ng-add-schema",
4
+ "type": "object",
5
+ "properties": {
6
+ "pk": {
7
+ "type": "string",
8
+ "description": "The name of the default Primary Key (e.g., id, cod, uuid); default is 'id'.",
9
+ "x-prompt": "What is the name of the default Primary Key (e.g., id, cod, uuid)? Default is 'id'.",
10
+ "default": "id"
11
+ }
12
+ },
13
+ "required": ["pk"]
14
+ }
@@ -31,7 +31,6 @@ const config = entityConfig({
31
31
  });
32
32
 
33
33
  export const <%= classify(name) %>Store = signalStore(
34
- { providedIn: 'root' },
35
34
  withEntities(config),
36
35
  withState({
37
36
  _status: initialStatus,
@@ -27,10 +27,6 @@ const pluralizeEn = (name) => {
27
27
  }
28
28
  return name + "s";
29
29
  };
30
- /**
31
- * Filtra y fusiona archivos de forma segura.
32
- * Si el archivo ya existe, comprueba si el contenido clave ya está presente.
33
- */
34
30
  function mergeFilesSmart(urlPath, destPath, options) {
35
31
  return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(urlPath), [
36
32
  (0, schematics_1.applyTemplates)(Object.assign(Object.assign({}, core_1.strings), options)),
@@ -1,21 +1,6 @@
1
1
  export interface SchemaOptions {
2
- /**
3
- * El nombre de la entidad (ej: Task, User).
4
- */
5
2
  name: string;
6
-
7
- /**
8
- * La ruta donde se generará el archivo.
9
- */
10
3
  path: string;
11
-
12
- /**
13
- * El idioma para la pluralización ('en' para inglés, 'es' para español).
14
- */
15
4
  language: "en" | "es";
16
-
17
- /**
18
- * Indica el nombre de la clave primaria (por defecto 'id').
19
- */
20
5
  pk: string;
21
6
  }
@@ -6,25 +6,24 @@
6
6
  "properties": {
7
7
  "name": {
8
8
  "type": "string",
9
- "description": "Nombre de la entidad.",
10
- "x-prompt": "¿Cómo se llama la entidad?",
9
+ "description": "Name of the entity.",
10
+ "x-prompt": "What's the name of the entity?",
11
11
  "priority": 1
12
12
  },
13
13
  "path": {
14
14
  "type": "string",
15
- "description": "Ruta de destino.",
15
+ "description": "Destination path.",
16
16
  "default": "src/app/core"
17
17
  },
18
18
  "language": {
19
19
  "type": "string",
20
- "description": "Idioma para la pluralización ('en' para inglés, 'es' para español).",
20
+ "description": "Language for pluralization ('en' for English, 'es' for Spanish).",
21
21
  "enum": ["en", "es"],
22
22
  "default": "en"
23
23
  },
24
24
  "pk": {
25
25
  "type": "string",
26
- "description": "Nombre de la clave primaria.",
27
- "default": "id"
26
+ "description": "Name of the primary key."
28
27
  }
29
28
  },
30
29
  "required": ["name"]