@skmtc/core 0.0.874 → 0.0.876

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.
@@ -487,9 +487,7 @@ _RenderContext_prettierConfig = new WeakMap(), _RenderContext_stackTrail = new W
487
487
  */
488
488
  const renderFile = async ({ content, destinationPath, basePath, prettierConfig }) => {
489
489
  const path = toResolvedArtifactPath({ basePath, destinationPath });
490
- const formatted = prettierConfig
491
- ? await prettier.format(content, { ...prettierConfig, parser: 'typescript' })
492
- : content;
490
+ const formatted = await formatFile({ content, prettierConfig });
493
491
  return {
494
492
  content: formatted,
495
493
  path,
@@ -498,3 +496,14 @@ const renderFile = async ({ content, destinationPath, basePath, prettierConfig }
498
496
  characters: formatted.length
499
497
  };
500
498
  };
499
+ const formatFile = async ({ content, prettierConfig }) => {
500
+ try {
501
+ return prettierConfig
502
+ ? await prettier.format(content, { ...prettierConfig, parser: 'typescript' })
503
+ : content;
504
+ }
505
+ catch (e) {
506
+ console.error(e);
507
+ return content;
508
+ }
509
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.874",
3
+ "version": "0.0.876",
4
4
  "description": "Skmtc is a declarative code generation framework",
5
5
  "keywords": [
6
6
  "openapi",
@@ -527,9 +527,7 @@ _RenderContext_prettierConfig = new WeakMap(), _RenderContext_stackTrail = new W
527
527
  */
528
528
  const renderFile = async ({ content, destinationPath, basePath, prettierConfig }) => {
529
529
  const path = (0, toResolvedArtifactPath_js_1.toResolvedArtifactPath)({ basePath, destinationPath });
530
- const formatted = prettierConfig
531
- ? await prettier.format(content, { ...prettierConfig, parser: 'typescript' })
532
- : content;
530
+ const formatted = await formatFile({ content, prettierConfig });
533
531
  return {
534
532
  content: formatted,
535
533
  path,
@@ -538,3 +536,14 @@ const renderFile = async ({ content, destinationPath, basePath, prettierConfig }
538
536
  characters: formatted.length
539
537
  };
540
538
  };
539
+ const formatFile = async ({ content, prettierConfig }) => {
540
+ try {
541
+ return prettierConfig
542
+ ? await prettier.format(content, { ...prettierConfig, parser: 'typescript' })
543
+ : content;
544
+ }
545
+ catch (e) {
546
+ console.error(e);
547
+ return content;
548
+ }
549
+ };