Skip to content

Commit dca34fb

Browse files
committed
init
1 parent 6bb5cab commit dca34fb

51 files changed

Lines changed: 2107 additions & 1193 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/app/app/app.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default defineAppConfig({
22
ui: {
33
colors: {
4-
primary: "sky",
4+
primary: 'sky',
55
},
66
},
7-
});
7+
})

packages/app/app/app.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<script setup>
22
useHead({
33
htmlAttrs: {
4-
lang: "en",
4+
lang: 'en',
55
},
66
link: [
7-
{ rel: "icon", href: "/favicon.png" },
8-
{ rel: "icon", type: "image/svg+xml", href: "/favicon.svg" },
7+
{ rel: 'icon', href: '/favicon.png' },
8+
{ rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' },
99
],
10-
});
10+
})
1111
1212
useSeoMeta({
13-
title: "pkg.pr.new",
13+
title: 'pkg.pr.new',
1414
description:
15-
"Search repositories on GitHub to list their continuous releases.",
16-
});
15+
'Search repositories on GitHub to list their continuous releases.',
16+
})
1717
</script>
1818

1919
<template>

packages/app/app/assets/css/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,7 @@ details {
117117
summary {
118118
@apply cursor-pointer;
119119
}
120+
121+
code > pre {
122+
@apply rounded-lg overflow-x-scroll bg-transparent! text-sm;
123+
}

packages/app/app/components/AppFooter.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
width="117"
1010
height="24"
1111
class="not-dark:hidden"
12-
/>
12+
>
1313
<img
1414
src="/stackblitz-black.svg"
1515
alt="StackBlitz"
1616
width="117"
1717
height="24"
1818
class="dark:hidden"
19-
/>
19+
>
2020
</a>
2121
<div class="flex gap-3 items-center">
2222
<div>
@@ -25,15 +25,12 @@
2525
href="https://github.com/stackblitz-labs"
2626
target="_blank"
2727
class="text-primary"
28-
>StackBlitz Labs</a
29-
>
28+
>StackBlitz Labs</a>
3029
</div>
3130
<UIcon name="ph-dot" />
3231
<div>
3332
UI by
34-
<a href="https://github.com/Akryum" target="_blank" class="text-primary"
35-
>Akryum</a
36-
>
33+
<a href="https://github.com/Akryum" target="_blank" class="text-primary">Akryum</a>
3734
</div>
3835
</div>
3936
</footer>

packages/app/app/components/CodeSnippet.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<script lang="ts" setup>
22
const props = defineProps<{
3-
code: string;
4-
}>();
3+
code: string
4+
}>()
55
6-
const { copy, isSupported } = useClipboard();
6+
const { copy, isSupported } = useClipboard()
77
8-
const toast = useToast();
8+
const toast = useToast()
99
1010
function copyCode() {
11-
copy(props.code);
11+
copy(props.code)
1212
toast.add({
13-
title: "Copied to clipboard",
14-
color: "success",
15-
icon: "ph-check",
16-
});
13+
title: 'Copied to clipboard',
14+
color: 'success',
15+
icon: 'ph-check',
16+
})
1717
}
1818
</script>
1919

packages/app/app/components/Commits.vue

Lines changed: 69 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,110 @@
11
<script lang="ts" setup>
2-
import type { RendererObject } from "marked";
3-
import { marked } from "marked";
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 } from 'shiki/core'
8+
import { createJavaScriptRegexEngine } from 'shiki/engine/javascript'
49
510
const props = defineProps<{
6-
owner: string;
7-
repo: string;
8-
}>();
11+
owner: string
12+
repo: string
13+
}>()
914
10-
const data = await $fetch("/api/repo/commits", {
15+
const data = await $fetch('/api/repo/commits', {
1116
query: {
1217
owner: props.owner,
1318
repo: props.repo,
1419
},
15-
});
20+
})
1621
1722
if (!data) {
18-
throw createError("Could not load Commits");
23+
throw createError('Could not load Commits')
1924
}
2025
21-
const branch = shallowReactive(data);
26+
const branch = shallowReactive(data)
2227
2328
const commitsWithRelease = computed(() =>
2429
branch.target.history.nodes
25-
.filter((commit) =>
30+
.filter(commit =>
2631
commit.statusCheckRollup?.contexts.nodes.some(
27-
(context) => context.name === "Continuous Releases",
32+
context => context.name === 'Continuous Releases',
2833
),
2934
)
30-
.map((commit) => ({
35+
.map(commit => ({
3136
...commit,
3237
release: commit.statusCheckRollup.contexts.nodes.find(
33-
(context) => context.name === "Continuous Releases",
38+
context => context.name === 'Continuous Releases',
3439
)!,
3540
})),
36-
);
41+
)
3742
3843
const selectedCommit = shallowRef<
3944
(typeof commitsWithRelease.value)[number] | null
40-
>(null);
45+
>(null)
4146
4247
// Markdown
4348
4449
// Add target to links
45-
const renderer: RendererObject = {
46-
link(originalLink) {
47-
const link = marked.Renderer.prototype.link.call(this, originalLink);
48-
return link.replace("<a", "<a target='_blank' rel='noreferrer' ");
49-
},
50-
};
51-
marked.use({ renderer });
5250
53-
// Pagination
51+
const colorMode = useColorMode()
52+
let shiki: HighlighterCore
53+
54+
onBeforeMount(() => {
55+
shiki = createHighlighterCoreSync({
56+
themes: [githubDark, githubLight],
57+
langs: [bash],
58+
engine: createJavaScriptRegexEngine(),
59+
})
60+
61+
const renderer: RendererObject = {
62+
link(originalLink) {
63+
const link = marked.Renderer.prototype.link.call(this, originalLink)
64+
return link.replace('<a', '<a target=\'_blank\' rel=\'noreferrer\' class=\'text-primary underline\'')
65+
},
66+
code({ text }) {
67+
return `<code class="language-bash">${shiki.codeToHtml(text, {
68+
theme: colorMode.value === 'dark' ? 'github-dark' : 'github-light',
69+
lang: 'bash',
70+
})}</code>`
71+
},
72+
}
73+
74+
marked.use({ renderer })
75+
})
5476
55-
const fetching = ref(false);
56-
const fetchMoreForceDisabled = ref(!commitsWithRelease.value.length);
77+
onBeforeUnmount(() => {
78+
shiki.dispose()
79+
})
80+
81+
// Pagination
82+
const fetching = ref(false)
83+
const fetchMoreForceDisabled = ref(!commitsWithRelease.value.length)
5784
5885
async function fetchMore() {
5986
if (!branch.target.history.pageInfo.hasNextPage) {
60-
return;
87+
return
6188
}
6289
6390
if (fetching.value) {
64-
return;
91+
return
6592
}
6693
6794
try {
68-
fetching.value = true;
95+
fetching.value = true
6996
70-
const cursor = branch.target.history.pageInfo.endCursor;
97+
const cursor = branch.target.history.pageInfo.endCursor
7198
72-
const result = await $fetch("/api/repo/commits", {
99+
const result = await $fetch('/api/repo/commits', {
73100
query: {
74101
owner: props.owner,
75102
repo: props.repo,
76103
cursor,
77104
},
78-
});
105+
})
79106
80-
const count = commitsWithRelease.value.length;
107+
const count = commitsWithRelease.value.length
81108
82109
branch.target = {
83110
...branch.target,
@@ -86,13 +113,14 @@ async function fetchMore() {
86113
nodes: [...branch.target.history.nodes, ...result.target.history.nodes],
87114
pageInfo: result.target.history.pageInfo,
88115
},
89-
};
116+
}
90117
91118
if (count === commitsWithRelease.value.length) {
92-
fetchMoreForceDisabled.value = true;
119+
fetchMoreForceDisabled.value = true
93120
}
94-
} finally {
95-
fetching.value = false;
121+
}
122+
finally {
123+
fetching.value = false
96124
}
97125
}
98126
</script>
@@ -162,15 +190,16 @@ async function fetchMore() {
162190
class="flex flex-col items-center gap-4 border border-gray-100 dark:border-gray-800 rounded-xl p-8"
163191
>
164192
<UIcon name="i-ph-crane-tower-light" class="text-6xl opacity-50" />
165-
<p class="text-center text-lg">No Continuous Releases found</p>
193+
<p class="text-center text-lg">
194+
No Continuous Releases found
195+
</p>
166196
<p class="text-center">
167197
Setup continuous releases with
168198
<a
169199
href="https://github.com/stackblitz-labs/pkg.pr.new"
170200
target="_blank"
171201
class="text-primary"
172-
>pkg.pr.new</a
173-
>
202+
>pkg.pr.new</a>
174203
first!
175204
</p>
176205
</div>
@@ -218,7 +247,7 @@ async function fetchMore() {
218247
</div>
219248

220249
<div
221-
class="max-w-full p-4 border border-gray-100 dark:border-gray-800 rounded-lg prose dark:prose-invert"
250+
class="max-w-full p-4 overflow-x-scroll border border-gray-100 dark:border-gray-800 rounded-lg prose dark:prose-invert flex flex-col gap-2"
222251
v-html="marked(selectedCommit.release.text)"
223252
/>
224253
</div>

packages/app/app/components/GettingStarted.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<GettingStartedStep step="3">
5050
<div>Done! Enjoy continuous releases on your Pull Requests!</div>
5151

52-
<img src="/pr-screenshot.png" alt="PR Screenshot" class="rounded-lg" />
52+
<img src="/pr-screenshot.png" alt="PR Screenshot" class="rounded-lg">
5353
</GettingStartedStep>
5454
</div>
5555
</template>

packages/app/app/components/GettingStartedStep.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts" setup>
22
defineProps<{
3-
step: number | string;
4-
}>();
3+
step: number | string
4+
}>()
55
</script>
66

77
<template>

packages/app/app/components/RepoButton.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script lang="ts" setup>
22
defineProps<{
3-
owner: string;
4-
name: string;
5-
avatar?: string;
6-
}>();
3+
owner: string
4+
name: string
5+
avatar?: string
6+
}>()
77
</script>
88

99
<template>

0 commit comments

Comments
 (0)