ngx-essentials-schematics 0.0.19 → 0.0.20

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.19",
3
+ "version": "0.0.20",
4
4
  "description": "A collection of Angular schematics for essential functionalities.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -26,8 +26,18 @@ function ngAdd(options) {
26
26
  // 3. Mapear versión de NgRx (NgRx suele ir a la par con Angular)
27
27
  const ngrxVersion = `^${mainVersion}.0.0`;
28
28
  _context.logger.info(`📦 Configuring dependencies for Angular v${mainVersion}...`);
29
+ // 4. Modificar package.json
30
+ const packageName = "ngx-essentials-schematics";
29
31
  // Inyectar dependencias compatibles
30
32
  packageJson.dependencies = Object.assign(Object.assign({}, packageJson.dependencies), { "@ngrx/signals": ngrxVersion });
33
+ // Mover a devDependencies si es necesario
34
+ if (packageJson.dependencies[packageName]) {
35
+ const currentVer = packageJson.dependencies[packageName];
36
+ delete packageJson.dependencies[packageName];
37
+ packageJson.devDependencies = Object.assign(Object.assign({}, packageJson.devDependencies), { [packageName]: currentVer });
38
+ }
39
+ packageJson.dependencies = sortObjectKeys(packageJson.dependencies);
40
+ packageJson.devDependencies = sortObjectKeys(packageJson.devDependencies);
31
41
  tree.overwrite(packagePath, JSON.stringify(packageJson, null, 2));
32
42
  // 5. Configurar angular.json (Collections y Primary Key)
33
43
  updateAngularJson(tree, options);
@@ -36,14 +46,20 @@ function ngAdd(options) {
36
46
  return tree;
37
47
  };
38
48
  }
39
- // Función auxiliar para mantener el código limpio
49
+ function sortObjectKeys(obj) {
50
+ return Object.keys(obj)
51
+ .sort()
52
+ .reduce((result, key) => {
53
+ result[key] = obj[key];
54
+ return result;
55
+ }, {});
56
+ }
40
57
  function updateAngularJson(tree, options) {
41
58
  const path = "/angular.json";
42
59
  const buffer = tree.read(path);
43
60
  if (!buffer)
44
61
  return;
45
62
  const workspace = JSON.parse(buffer.toString());
46
- // Agregar a schematicCollections
47
63
  if (!workspace.cli)
48
64
  workspace.cli = {};
49
65
  const collections = workspace.cli.schematicCollections || [];
@@ -51,7 +67,6 @@ function updateAngularJson(tree, options) {
51
67
  collections.push("ngx-essentials-schematics");
52
68
  workspace.cli.schematicCollections = collections;
53
69
  }
54
- // Guardar configuración global
55
70
  if (!workspace.schematics)
56
71
  workspace.schematics = {};
57
72
  workspace.schematics["ngx-essentials-schematics:all"] = {