11<script lang="ts" setup>
2- import type { RendererObject } from ' marked'
3- import bash from ' @shikijs/langs/bash'
4- import githubDark from ' @shikijs/themes/github-dark'
5- import githubLight from ' @shikijs/themes/github-light'
6- import { marked } from ' marked'
7- import { createHighlighterCoreSync , type HighlighterCore } from ' shiki/core'
8- import { createJavaScriptRegexEngine } from ' shiki/engine/javascript'
2+ import type { RendererObject } from " marked" ;
3+ import bash from " @shikijs/langs/bash" ;
4+ import githubDark from " @shikijs/themes/github-dark" ;
5+ import githubLight from " @shikijs/themes/github-light" ;
6+ import { marked } from " marked" ;
7+ import { createHighlighterCoreSync , type HighlighterCore } from " shiki/core" ;
8+ import { createJavaScriptRegexEngine } from " shiki/engine/javascript" ;
99
1010const props = defineProps <{
11- owner: string
12- repo: string
13- }>()
11+ owner: string ;
12+ repo: string ;
13+ }>();
1414
15- const data = await $fetch (' /api/repo/commits' , {
15+ const data = await $fetch (" /api/repo/commits" , {
1616 query: {
1717 owner: props .owner ,
1818 repo: props .repo ,
1919 },
20- })
20+ });
2121
2222if (! data ) {
23- throw createError (' Could not load Commits' )
23+ throw createError (" Could not load Commits" );
2424}
2525
26- const branch = shallowReactive (data )
26+ const branch = shallowReactive (data );
2727
2828const commitsWithRelease = computed (() =>
2929 branch .target .history .nodes
30- .filter (commit =>
30+ .filter (( commit ) =>
3131 commit .statusCheckRollup ?.contexts .nodes .some (
32- context => context .name === ' Continuous Releases' ,
32+ ( context ) => context .name === " Continuous Releases" ,
3333 ),
3434 )
35- .map (commit => ({
35+ .map (( commit ) => ({
3636 ... commit ,
3737 release: commit .statusCheckRollup .contexts .nodes .find (
38- context => context .name === ' Continuous Releases' ,
38+ ( context ) => context .name === " Continuous Releases" ,
3939 )! ,
4040 })),
41- )
41+ );
4242
4343const selectedCommit = shallowRef <
4444 (typeof commitsWithRelease .value )[number ] | null
45- > (null )
45+ > (null );
4646
4747// Markdown
4848
4949// Add target to links
5050
51- const colorMode = useColorMode ()
52- let shiki: HighlighterCore
51+ const colorMode = useColorMode ();
52+ let shiki: HighlighterCore ;
5353
5454onBeforeMount (async () => {
5555 // if (typeof window === 'undefined') {
@@ -62,55 +62,58 @@ onBeforeMount(async () => {
6262 themes: [githubDark , githubLight ],
6363 langs: [bash ],
6464 engine: createJavaScriptRegexEngine (),
65- })
65+ });
6666
6767 const renderer: RendererObject = {
6868 link(originalLink ) {
69- const link = marked .Renderer .prototype .link .call (this , originalLink )
70- return link .replace (' <a' , ' <a target=\' _blank\' rel=\' noreferrer\' class=\' text-primary underline\' ' )
69+ const link = marked .Renderer .prototype .link .call (this , originalLink );
70+ return link .replace (
71+ " <a" ,
72+ " <a target='_blank' rel='noreferrer' class='text-primary underline'" ,
73+ );
7174 },
7275 code({ text }) {
7376 return ` <code class="language-bash">${shiki .codeToHtml (text , {
74- theme: colorMode .preference === ' dark' ? ' github-dark' : ' github-light' ,
75- lang: ' bash' ,
76- })}</code> `
77+ theme: colorMode .preference === " dark" ? " github-dark" : " github-light" ,
78+ lang: " bash" ,
79+ })}</code> ` ;
7780 },
78- }
81+ };
7982
80- marked .use ({ renderer })
81- })
83+ marked .use ({ renderer });
84+ });
8285
8386onBeforeUnmount (() => {
84- shiki ?.dispose ()
85- })
87+ shiki ?.dispose ();
88+ });
8689
8790// Pagination
88- const fetching = ref (false )
89- const fetchMoreForceDisabled = ref (! commitsWithRelease .value .length )
91+ const fetching = ref (false );
92+ const fetchMoreForceDisabled = ref (! commitsWithRelease .value .length );
9093
9194async function fetchMore() {
9295 if (! branch .target .history .pageInfo .hasNextPage ) {
93- return
96+ return ;
9497 }
9598
9699 if (fetching .value ) {
97- return
100+ return ;
98101 }
99102
100103 try {
101- fetching .value = true
104+ fetching .value = true ;
102105
103- const cursor = branch .target .history .pageInfo .endCursor
106+ const cursor = branch .target .history .pageInfo .endCursor ;
104107
105- const result = await $fetch (' /api/repo/commits' , {
108+ const result = await $fetch (" /api/repo/commits" , {
106109 query: {
107110 owner: props .owner ,
108111 repo: props .repo ,
109112 cursor ,
110113 },
111- })
114+ });
112115
113- const count = commitsWithRelease .value .length
116+ const count = commitsWithRelease .value .length ;
114117
115118 branch .target = {
116119 ... branch .target ,
@@ -119,14 +122,13 @@ async function fetchMore() {
119122 nodes: [... branch .target .history .nodes , ... result .target .history .nodes ],
120123 pageInfo: result .target .history .pageInfo ,
121124 },
122- }
125+ };
123126
124127 if (count === commitsWithRelease .value .length ) {
125- fetchMoreForceDisabled .value = true
128+ fetchMoreForceDisabled .value = true ;
126129 }
127- }
128- finally {
129- fetching .value = false
130+ } finally {
131+ fetching .value = false ;
130132 }
131133}
132134 </script >
@@ -196,16 +198,15 @@ async function fetchMore() {
196198 class =" flex flex-col items-center gap-4 border border-gray-100 dark:border-gray-800 rounded-xl p-8"
197199 >
198200 <UIcon name =" i-ph-crane-tower-light" class =" text-6xl opacity-50" />
199- <p class =" text-center text-lg" >
200- No Continuous Releases found
201- </p >
201+ <p class =" text-center text-lg" >No Continuous Releases found</p >
202202 <p class =" text-center" >
203203 Setup continuous releases with
204204 <a
205205 href =" https://github.com/stackblitz-labs/pkg.pr.new"
206206 target =" _blank"
207207 class =" text-primary"
208- >pkg.pr.new</a >
208+ >pkg.pr.new</a
209+ >
209210 first!
210211 </p >
211212 </div >
0 commit comments