prisma-nestjs-graphql 15.1.1 → 15.2.0

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.
Files changed (2) hide show
  1. package/index.js +21 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1451,12 +1451,24 @@ function beforeGenerateFiles2(args) {
1451
1451
  ReExport.Directories,
1452
1452
  ReExport.All
1453
1453
  ].includes(config.reExport)) {
1454
- for (const directory of rootDirectory.getDirectories()) {
1454
+ for (const directory of rootDirectory.getDescendantDirectories()) {
1455
+ let indexSourceFile;
1455
1456
  const exportDeclarations = directory.getSourceFiles().filter((sourceFile) => {
1456
1457
  return sourceFile.getBaseName() !== "index.ts";
1457
1458
  }).map((sourcesFile) => getExportDeclaration2(directory, sourcesFile));
1458
- directory.createSourceFile("index.ts", {
1459
- statements: exportDeclarations
1459
+ if (exportDeclarations.length > 0) {
1460
+ indexSourceFile = directory.createSourceFile("index.ts", {
1461
+ statements: exportDeclarations
1462
+ }, {
1463
+ overwrite: true
1464
+ });
1465
+ }
1466
+ if (indexSourceFile) {
1467
+ continue;
1468
+ }
1469
+ const namespaceExportDeclarations = directory.getDirectories().map((sourceDirectory) => getNamespaceExportDeclaration(directory, sourceDirectory));
1470
+ project.createSourceFile(`${directory.getPath()}/index.ts`, {
1471
+ statements: namespaceExportDeclarations
1460
1472
  }, {
1461
1473
  overwrite: true
1462
1474
  });
@@ -1496,6 +1508,12 @@ function getExportDeclaration2(directory, sourceFile) {
1496
1508
  };
1497
1509
  }
1498
1510
  __name(getExportDeclaration2, "getExportDeclaration");
1511
+ function getNamespaceExportDeclaration(directory, sourceDirectory) {
1512
+ return {
1513
+ kind: import_ts_morph7.StructureKind.ExportDeclaration,
1514
+ moduleSpecifier: directory.getRelativePathAsModuleSpecifierTo(sourceDirectory)
1515
+ };
1516
+ }
1499
1517
 
1500
1518
  // src/handlers/register-enum.ts
1501
1519
  var import_ts_morph8 = require("ts-morph");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-nestjs-graphql",
3
- "version": "15.1.1",
3
+ "version": "15.2.0",
4
4
  "license": "MIT",
5
5
  "description": "Generate object types, inputs, args, etc. from prisma schema file for usage with @nestjs/graphql module",
6
6
  "main": "index.js",