ngx-essentials-schematics 0.0.18 → 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 +1 -1
- package/src/ng-add/index.js +10 -3
package/package.json
CHANGED
package/src/ng-add/index.js
CHANGED
|
@@ -36,6 +36,8 @@ function ngAdd(options) {
|
|
|
36
36
|
delete packageJson.dependencies[packageName];
|
|
37
37
|
packageJson.devDependencies = Object.assign(Object.assign({}, packageJson.devDependencies), { [packageName]: currentVer });
|
|
38
38
|
}
|
|
39
|
+
packageJson.dependencies = sortObjectKeys(packageJson.dependencies);
|
|
40
|
+
packageJson.devDependencies = sortObjectKeys(packageJson.devDependencies);
|
|
39
41
|
tree.overwrite(packagePath, JSON.stringify(packageJson, null, 2));
|
|
40
42
|
// 5. Configurar angular.json (Collections y Primary Key)
|
|
41
43
|
updateAngularJson(tree, options);
|
|
@@ -44,14 +46,20 @@ function ngAdd(options) {
|
|
|
44
46
|
return tree;
|
|
45
47
|
};
|
|
46
48
|
}
|
|
47
|
-
|
|
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
|
+
}
|
|
48
57
|
function updateAngularJson(tree, options) {
|
|
49
58
|
const path = "/angular.json";
|
|
50
59
|
const buffer = tree.read(path);
|
|
51
60
|
if (!buffer)
|
|
52
61
|
return;
|
|
53
62
|
const workspace = JSON.parse(buffer.toString());
|
|
54
|
-
// Agregar a schematicCollections
|
|
55
63
|
if (!workspace.cli)
|
|
56
64
|
workspace.cli = {};
|
|
57
65
|
const collections = workspace.cli.schematicCollections || [];
|
|
@@ -59,7 +67,6 @@ function updateAngularJson(tree, options) {
|
|
|
59
67
|
collections.push("ngx-essentials-schematics");
|
|
60
68
|
workspace.cli.schematicCollections = collections;
|
|
61
69
|
}
|
|
62
|
-
// Guardar configuración global
|
|
63
70
|
if (!workspace.schematics)
|
|
64
71
|
workspace.schematics = {};
|
|
65
72
|
workspace.schematics["ngx-essentials-schematics:all"] = {
|