mushroom-cli 2.0.0-alpha.4 → 2.0.0-alpha.5

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/README.md CHANGED
@@ -134,6 +134,12 @@ npx mushroom-cli parameters --no-check-update
134
134
 
135
135
  Bug fixes:
136
136
 
137
+ - gen c#-mongo: fix missing the function handlers in extensions when generating RefactorHelper.cs file
138
+
139
+ ### 2.0.0-alpha.4
140
+
141
+ Bug fixes:
142
+
137
143
  - gen ts-driver: fix the swapped extension exports. The `auth` feature now exports `Auth: AuthExtension` and the
138
144
  `file` feature now exports `File: FileExtension` (previously the two were swapped)
139
145
 
@@ -29,6 +29,17 @@ function transformViewNode(view) {
29
29
  return;
30
30
  view.parameters.forEach((p) => transformValidationNode(p.validation));
31
31
  }
32
+ function mergeObject(total, fragment, excludeFields = []) {
33
+ if (!fragment)
34
+ return;
35
+ Object.keys(fragment).forEach(key => {
36
+ if (excludeFields.includes(key))
37
+ return;
38
+ const newValue = fragment[key];
39
+ if (newValue !== undefined && newValue !== null)
40
+ total[key] = fragment[key];
41
+ });
42
+ }
32
43
  function mergeApiProject(totalProject, fragmentProject, options) {
33
44
  if (totalProject.name != null && fragmentProject.name != null && fragmentProject.name != totalProject.name)
34
45
  throw new Error(`Unable merge project '${fragmentProject.name}' into '${totalProject.name}'`);
@@ -108,11 +119,23 @@ function mergeApiProject(totalProject, fragmentProject, options) {
108
119
  fragmentProject.views[viewName].forEach(transformViewNode);
109
120
  }
110
121
  }
111
- for (const name in fragmentProject) {
112
- if (name === 'environmentVariables' || name === 'entities' || name === 'views' || name === '$schema')
113
- continue;
114
- totalProject[name] = fragmentProject[name];
122
+ if (fragmentProject.extensions) {
123
+ const fragmentExtensions = fragmentProject.extensions;
124
+ const totalExtensions = totalProject.extensions || {};
125
+ totalProject.extensions = totalExtensions;
126
+ Object.keys(fragmentExtensions).forEach(ext => {
127
+ const fragmentExtension = fragmentExtensions[ext];
128
+ const totalExtension = totalExtensions[ext] = totalExtensions[ext] || {};
129
+ if (fragmentExtension.description !== undefined && fragmentExtension.description !== null)
130
+ totalExtension.description = fragmentExtension.description;
131
+ if (fragmentExtension.startup !== undefined && fragmentExtension.startup !== null)
132
+ totalExtension.startup = fragmentExtension.startup;
133
+ mergeObject(totalExtension.config = totalExtension.config || {}, fragmentExtension.config);
134
+ mergeObject(totalExtension.ensureIndex = totalExtension.ensureIndex || {}, fragmentExtension.ensureIndex);
135
+ mergeObject(totalExtension.routes = totalExtension.routes || {}, fragmentExtension.routes);
136
+ });
115
137
  }
138
+ mergeObject(totalProject, fragmentProject, ['environmentVariables', 'extensions', 'entities', 'views', '$schema']);
116
139
  return totalProject;
117
140
  }
118
141
  export function processMasterFile(basePath, master) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mushroom-cli",
3
- "version": "2.0.0-alpha.4",
3
+ "version": "2.0.0-alpha.5",
4
4
  "description": "Mushroom CLI",
5
5
  "type": "module",
6
6
  "scripts": {