mushroom-cli 2.0.0-alpha.2 → 2.0.0-alpha.4
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 +13 -0
- package/dist/gen/gen-csharp.js +9 -0
- package/dist/gen/gen-db-docs.js +9 -0
- package/dist/gen/gen-js-driver.js +9 -0
- package/dist/gen/gen-ts-driver.js +20 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -130,6 +130,19 @@ npx mushroom-cli parameters --no-check-update
|
|
|
130
130
|
|
|
131
131
|
## Version
|
|
132
132
|
|
|
133
|
+
### 2.0.0-alpha.4
|
|
134
|
+
|
|
135
|
+
Bug fixes:
|
|
136
|
+
|
|
137
|
+
- gen ts-driver: fix the swapped extension exports. The `auth` feature now exports `Auth: AuthExtension` and the
|
|
138
|
+
`file` feature now exports `File: FileExtension` (previously the two were swapped)
|
|
139
|
+
|
|
140
|
+
### 2.0.0-alpha.3
|
|
141
|
+
|
|
142
|
+
New features:
|
|
143
|
+
|
|
144
|
+
- gen ts-driver, gen js-driver, gen db-docs, gen c#-driver: add the `entities` option (an array of regular expressions) to each alias project. When set, only entities whose name matches at least one of the patterns are generated. If omitted, all entities are generated as before
|
|
145
|
+
|
|
133
146
|
### 2.0.0-alpha.2
|
|
134
147
|
|
|
135
148
|
Improvement:
|
package/dist/gen/gen-csharp.js
CHANGED
|
@@ -713,6 +713,15 @@ export function genCSharpDriver(args, projectName, project, alias, source) {
|
|
|
713
713
|
throw new Error(`Not found gen c#-driver configuration. Please run 'npx mushroom-cli config ${projectName} gen c#-driver OUTPUT_FILE.cs${alias === 'default' ? '' : ' alias ' + alias}' first`);
|
|
714
714
|
}
|
|
715
715
|
const entities = common.getEntities(source, aliasProject.allowRoles);
|
|
716
|
+
if (Array.isArray(aliasProject.entities)) {
|
|
717
|
+
for (const entityName in entities) {
|
|
718
|
+
if (Object.hasOwnProperty.call(entities, entityName)) {
|
|
719
|
+
if (aliasProject.entities.every((re) => !new RegExp(re).test(entityName))) {
|
|
720
|
+
delete entities[entityName];
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
716
725
|
const namespace = toCSharpName(source.name);
|
|
717
726
|
let strClasses = '';
|
|
718
727
|
let strEnumClasses = '';
|
package/dist/gen/gen-db-docs.js
CHANGED
|
@@ -167,6 +167,15 @@ export default function genDatabaseDocs(args, projectName, project, alias, sourc
|
|
|
167
167
|
throw new Error(`Not found gen db-docs configuration. Please run 'npx mushroom-cli config ${projectName} gen db-docs OUTPUT_FILE.html${alias === 'default' ? '' : ' alias ' + alias}' first`);
|
|
168
168
|
}
|
|
169
169
|
const entities = common.getEntities(source, aliasProject.allowRoles, true);
|
|
170
|
+
if (Array.isArray(aliasProject.entities)) {
|
|
171
|
+
for (const entityName in entities) {
|
|
172
|
+
if (Object.hasOwnProperty.call(entities, entityName)) {
|
|
173
|
+
if (aliasProject.entities.every((re) => !new RegExp(re).test(entityName))) {
|
|
174
|
+
delete entities[entityName];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
170
179
|
let code;
|
|
171
180
|
switch (source.db) {
|
|
172
181
|
case 'MongoDB':
|
|
@@ -23,6 +23,15 @@ export function genJavascriptDriverString(aliasProject, source) {
|
|
|
23
23
|
return '';
|
|
24
24
|
}
|
|
25
25
|
const entities = common.getEntities(source, aliasProject.allowRoles);
|
|
26
|
+
if (Array.isArray(aliasProject.entities)) {
|
|
27
|
+
for (const entityName in entities) {
|
|
28
|
+
if (Object.hasOwnProperty.call(entities, entityName)) {
|
|
29
|
+
if (aliasProject.entities.every((re) => !new RegExp(re).test(entityName))) {
|
|
30
|
+
delete entities[entityName];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
26
35
|
const extensionsImportLines = ['/* import all mushroom extensions */'];
|
|
27
36
|
const extensionsExportLines = [];
|
|
28
37
|
const extensionsCodeLines = ['/* using all mushroom extensions */'];
|
|
@@ -231,6 +231,15 @@ export function genTypescriptDriverString(aliasProject, source) {
|
|
|
231
231
|
return '';
|
|
232
232
|
}
|
|
233
233
|
const entities = common.getEntities(source, aliasProject.allowRoles);
|
|
234
|
+
if (Array.isArray(aliasProject.entities)) {
|
|
235
|
+
for (const entityName in entities) {
|
|
236
|
+
if (Object.hasOwnProperty.call(entities, entityName)) {
|
|
237
|
+
if (aliasProject.entities.every((re) => !new RegExp(re).test(entityName))) {
|
|
238
|
+
delete entities[entityName];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
234
243
|
const extensionsImportLines = ['/* import all mushroom extensions */'];
|
|
235
244
|
const extensionsExportLines = [];
|
|
236
245
|
const extensionsTypes = ['/* all mushroom extensions types */'];
|
|
@@ -238,13 +247,13 @@ export function genTypescriptDriverString(aliasProject, source) {
|
|
|
238
247
|
if (Array.isArray(aliasProject.features)) {
|
|
239
248
|
if (aliasProject.features.includes('auth')) {
|
|
240
249
|
extensionsImportLines.push('import * as AuthExtension from "mushroomjs-auth";');
|
|
241
|
-
extensionsExportLines.push('
|
|
250
|
+
extensionsExportLines.push('Auth: AuthExtension');
|
|
242
251
|
extensionsTypes.push('AuthExtension.IMushroomAuth & ');
|
|
243
252
|
extensionsCodeLines.push('AuthExtension.useAuth(AuthExtension.AuthLocalStorage, mushroom);');
|
|
244
253
|
}
|
|
245
254
|
if (aliasProject.features.includes('file')) {
|
|
246
255
|
extensionsImportLines.push('import * as FileExtension from "mushroomjs-file";');
|
|
247
|
-
extensionsExportLines.push('
|
|
256
|
+
extensionsExportLines.push('File: FileExtension');
|
|
248
257
|
extensionsTypes.push('FileExtension.IMushroomFile & ');
|
|
249
258
|
extensionsCodeLines.push('FileExtension.useFile(mushroom);');
|
|
250
259
|
}
|
|
@@ -419,6 +428,15 @@ export function genDtsString(aliasProject, source) {
|
|
|
419
428
|
return '';
|
|
420
429
|
}
|
|
421
430
|
const entities = common.getEntities(source, aliasProject.allowRoles);
|
|
431
|
+
if (Array.isArray(aliasProject.entities)) {
|
|
432
|
+
for (const entityName in entities) {
|
|
433
|
+
if (Object.hasOwnProperty.call(entities, entityName)) {
|
|
434
|
+
if (aliasProject.entities.every((re) => !new RegExp(re).test(entityName))) {
|
|
435
|
+
delete entities[entityName];
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
422
440
|
const extensionsImportLines = [];
|
|
423
441
|
const extensionsExportLines = [];
|
|
424
442
|
const extensionsTypes = [];
|