@flink-app/flink 0.13.0 → 0.13.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @flink-app/flink
2
2
 
3
+ ## 0.13.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed invalid types and improve typescript error message during schema compilation
8
+
3
9
  ## 0.13.0
4
10
 
5
11
  ### Minor Changes
@@ -590,7 +590,34 @@ var TypeScriptCompiler = /** @class */ (function () {
590
590
  console.log(" tsconfig:", tsconfigPath);
591
591
  // Create a fresh TypeScript Program that includes the schema file
592
592
  // This ensures ts-json-schema-generator can find the types we just generated
593
- var program = (0, ts_json_schema_generator_1.createProgram)(conf);
593
+ var program;
594
+ try {
595
+ program = (0, ts_json_schema_generator_1.createProgram)(conf);
596
+ }
597
+ catch (error) {
598
+ // Format the error in a more developer-friendly way
599
+ console.error("\nāŒ Schema generation failed due to TypeScript compilation errors:\n");
600
+ if (error.diagnostic && error.diagnostic.relatedInformation) {
601
+ // Extract and display only the relevant error messages
602
+ for (var _i = 0, _a = error.diagnostic.relatedInformation; _i < _a.length; _i++) {
603
+ var info = _a[_i];
604
+ if (info.file) {
605
+ var _b = info.file.getLineAndCharacterOfPosition(info.start), line = _b.line, character = _b.character;
606
+ var fileName = info.file.fileName.replace(this.cwd, ".");
607
+ var message = typeof info.messageText === "string"
608
+ ? info.messageText
609
+ : info.messageText.messageText;
610
+ console.error(" ".concat(fileName, ":").concat(line + 1, ":").concat(character + 1));
611
+ console.error(" ".concat(message, "\n"));
612
+ }
613
+ }
614
+ }
615
+ else if (error.message) {
616
+ console.error(" ".concat(error.message, "\n"));
617
+ }
618
+ console.error("šŸ’” Tip: Fix the TypeScript errors above and try again.\n");
619
+ process.exit(1);
620
+ }
594
621
  console.log(" TypeScript version:", ts_morph_1.ts.version);
595
622
  console.log(" Program root files:", program.getRootFileNames().length);
596
623
  var formatter = (0, ts_json_schema_generator_1.createFormatter)(conf);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flink-app/flink",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Typescript only framework for creating REST-like APIs on top of Express and mongodb",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "main": "dist/src/index.js",
@@ -533,7 +533,34 @@ export default {}; // Export an empty object to make it a module
533
533
 
534
534
  // Create a fresh TypeScript Program that includes the schema file
535
535
  // This ensures ts-json-schema-generator can find the types we just generated
536
- const program = createProgram(conf);
536
+ let program;
537
+ try {
538
+ program = createProgram(conf);
539
+ } catch (error: any) {
540
+ // Format the error in a more developer-friendly way
541
+ console.error("\nāŒ Schema generation failed due to TypeScript compilation errors:\n");
542
+
543
+ if (error.diagnostic && error.diagnostic.relatedInformation) {
544
+ // Extract and display only the relevant error messages
545
+ for (const info of error.diagnostic.relatedInformation) {
546
+ if (info.file) {
547
+ const { line, character } = info.file.getLineAndCharacterOfPosition(info.start);
548
+ const fileName = info.file.fileName.replace(this.cwd, ".");
549
+ const message = typeof info.messageText === "string"
550
+ ? info.messageText
551
+ : info.messageText.messageText;
552
+
553
+ console.error(` ${fileName}:${line + 1}:${character + 1}`);
554
+ console.error(` ${message}\n`);
555
+ }
556
+ }
557
+ } else if (error.message) {
558
+ console.error(` ${error.message}\n`);
559
+ }
560
+
561
+ console.error("šŸ’” Tip: Fix the TypeScript errors above and try again.\n");
562
+ process.exit(1);
563
+ }
537
564
 
538
565
  console.log(" TypeScript version:", ts.version);
539
566
  console.log(" Program root files:", program.getRootFileNames().length);