@gadmin2n/cli 0.0.92 → 0.0.94

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.
@@ -28,6 +28,22 @@ const POLICY_OBJECT_KEYS = new Set([
28
28
  'optionalDependencies',
29
29
  'scripts',
30
30
  ]);
31
+ /**
32
+ * Default policy applied when the user has not configured an explicit policy
33
+ * via gadmin-cli.json `templateUpdate.policies`.
34
+ *
35
+ * Rationale: when running `gadmin2 update`, users almost always want template
36
+ * dependency versions to win — that's the whole point of the command. Keys
37
+ * intentionally absent from this map (e.g. `json.scripts`) fall through to the
38
+ * legacy preserve-instance behavior, since user scripts often diverge from
39
+ * template scripts on purpose.
40
+ */
41
+ const DEFAULT_POLICIES = {
42
+ 'json.dependencies': 'prefer-template',
43
+ 'json.devDependencies': 'prefer-template',
44
+ 'json.peerDependencies': 'prefer-template',
45
+ 'json.optionalDependencies': 'prefer-template',
46
+ };
31
47
  function isPlainObject(v) {
32
48
  return v !== null && typeof v === 'object' && !Array.isArray(v);
33
49
  }
@@ -100,6 +116,7 @@ class JsonMerger {
100
116
  this.name = 'json';
101
117
  }
102
118
  merge(ctx) {
119
+ var _a;
103
120
  let instData;
104
121
  let tmplData;
105
122
  try {
@@ -139,7 +156,7 @@ class JsonMerger {
139
156
  const instVal = instData[k];
140
157
  const tmplVal = tmplData[k];
141
158
  const policyKey = `json.${k}`;
142
- const policy = policies[policyKey];
159
+ const policy = (_a = policies[policyKey]) !== null && _a !== void 0 ? _a : DEFAULT_POLICIES[policyKey];
143
160
  if (POLICY_OBJECT_KEYS.has(k) && policy) {
144
161
  if (policy === 'overwrite') {
145
162
  if (inTmpl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gadmin2n/cli",
3
- "version": "0.0.92",
3
+ "version": "0.0.94",
4
4
  "description": "Gadmin - modern, fast, powerful node.js web framework (@cli)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -47,7 +47,7 @@
47
47
  "@angular-devkit/core": "13.3.2",
48
48
  "@angular-devkit/schematics": "13.3.2",
49
49
  "@angular-devkit/schematics-cli": "13.3.2",
50
- "@gadmin2n/schematics": "^0.0.74",
50
+ "@gadmin2n/schematics": "^0.0.76",
51
51
  "abc": "^0.6.1",
52
52
  "chalk": "3.0.0",
53
53
  "chokidar": "3.5.3",