fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #1779 from hey-api/fix/debug-missing-mark

fix: dont throw on missing performance marks

authored by

Lubos and committed by
GitHub
fae5e53b 64e46eb5

+22 -9
+5
.changeset/chilled-tips-lie.md
··· 1 + --- 2 + '@hey-api/openapi-ts': patch 3 + --- 4 + 5 + fix: don't throw on missing performance marks
+4
packages/openapi-ts/bin/index.cjs
··· 117 117 userConfig.watch = Number.parseInt(params.watch, 10); 118 118 } 119 119 120 + if (!Object.keys(userConfig.logs).length) { 121 + delete userConfig.logs; 122 + } 123 + 120 124 const context = await createClient(userConfig); 121 125 if (!context[0] || !context[0].config.watch) { 122 126 process.exit(0);
+13 -9
packages/openapi-ts/src/utils/performance.ts
··· 32 32 ); 33 33 34 34 marks.forEach((mark) => { 35 - const markMeasure = Performance.measure(mark); 36 - const markDuration = Math.ceil(markMeasure.duration * 100) / 100; 37 - const percentage = 38 - Math.ceil( 39 - (markMeasure.duration / this.totalMeasure.duration) * 100 * 100, 40 - ) / 100; 41 - console.warn( 42 - `${mark}: ${markDuration.toFixed(2)}ms (${percentage.toFixed(2)}%)`, 43 - ); 35 + try { 36 + const markMeasure = Performance.measure(mark); 37 + const markDuration = Math.ceil(markMeasure.duration * 100) / 100; 38 + const percentage = 39 + Math.ceil( 40 + (markMeasure.duration / this.totalMeasure.duration) * 100 * 100, 41 + ) / 100; 42 + console.warn( 43 + `${mark}: ${markDuration.toFixed(2)}ms (${percentage.toFixed(2)}%)`, 44 + ); 45 + } catch { 46 + // noop 47 + } 44 48 }); 45 49 } 46 50 }