Skip to content

Commit

Permalink
switch to dprint with biome - same TS code style, but now better cove…
Browse files Browse the repository at this point in the history
…rage.
  • Loading branch information
yellowsink committed Sep 23, 2024
1 parent a15ac41 commit e359c03
Show file tree
Hide file tree
Showing 29 changed files with 539 additions and 454 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:
# setup
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: 20.x
Expand All @@ -50,7 +50,7 @@ jobs:
- uses: actions/upload-pages-artifact@v3
with:
# Upload dist folder
path: 'packages/shelter-docs/docs/.vitepress/dist'
path: "packages/shelter-docs/docs/.vitepress/dist"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
22 changes: 22 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"lineWidth": 120,
"useTabs": false,
"indentWidth": 2,

"biome": {},
"toml": {},
"malva": {
"omitNumberLeadingZero": true,
"declarationOrder": "smacss"
},
"markup": {},
"yaml": {},
"excludes": ["pnpm-lock.yaml", "**/node_modules", "**/*-lock.json", "**/dist", "**/.vitepress/cache"],
"plugins": [
"https://plugins.dprint.dev/toml-0.6.2.wasm",
"https://plugins.dprint.dev/g-plane/malva-v0.10.1.wasm",
"https://plugins.dprint.dev/g-plane/markup_fmt-v0.13.0.wasm",
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm",
"https://plugins.dprint.dev/biome-0.6.0.wasm"
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"scripts": {
"postinstall": "husky install",
"format": "rome format --write ."
"format": "dprint fmt"
},
"devDependencies": {
"dprint": "^0.47.2",
"husky": "^8.0.3",
"rimraf": "^4.4.1",
"rome": "^11.0.0",
"typescript": "^5.6.2"
},
"overrides": {
Expand Down
16 changes: 8 additions & 8 deletions packages/shelter-docs/docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
:root {
/* shelter gradient goes from #2a3b4b to #2a7267
* these colours are that lightened by 17 in GIMP brightness-contrast
* so that they are more appropriate for use as foreground text colours, for the title.
*/
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(120deg, #387b71, #384857);
/* shelter gradient goes from #2a3b4b to #2a7267
* these colours are that lightened by 17 in GIMP brightness-contrast
* so that they are more appropriate for use as foreground text colours, for the title.
*/
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(120deg, #387b71, #384857);
}

body {
overflow-y: scroll;
}
overflow-y: scroll;
}
17 changes: 9 additions & 8 deletions packages/shelter-docs/docs/components/Pill.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<script setup lang="ts">
import {computed} from "vue";
import { computed } from "vue";
const props = defineProps<{ col: "red" | "green" | "blue" | "shelter" }>();
const colour = computed(
() => ({
red: "lch(34.44% 60.47 31.97)",
green: "lch(34.44% 60.47 131.97)",
blue: "lch(34.44% 60.47 231.97)",
shelter: "-webkit-linear-gradient(-90deg, #2a3b4b, #2a7267)",
}[props.col ?? "blue"])
() =>
({
red: "lch(34.44% 60.47 31.97)",
green: "lch(34.44% 60.47 131.97)",
blue: "lch(34.44% 60.47 231.97)",
shelter: "-webkit-linear-gradient(-90deg, #2a3b4b, #2a7267)",
})[props.col ?? "blue"],
);
</script>

<template>
<div class="inline-block text-sm mx-2 px-2.5 py-1 font-semibold rounded-full" :style="{background: colour}">
<div class="inline-block text-sm mx-2 px-2.5 py-1 font-semibold rounded-full" :style="{ background: colour }">
<slot />
</div>
</template>
80 changes: 57 additions & 23 deletions packages/shelter-docs/docs/components/PluginListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface PluginManifest {
repoName: string;
}
type PluginItem = PluginManifest & { isCopied: boolean, repoOwner: string };
type PluginItem = PluginManifest & { isCopied: boolean; repoOwner: string };
const data: PluginItem[] = reactive([]);
let isLoading = ref(true);
Expand All @@ -20,15 +20,17 @@ fetch("https://shindex.uwu.network/data")
.then((r) => r.json())
.then((items) => {
items.forEach((item) => {
item.plugins.forEach((plugin: PluginManifest) => data.push({
name: plugin.name,
description: plugin.description,
author: plugin.author,
url: plugin.url,
repoName: item.name,
repoOwner: item.name.split("/")[0],
isCopied: false
}))
item.plugins.forEach((plugin: PluginManifest) =>
data.push({
name: plugin.name,
description: plugin.description,
author: plugin.author,
url: plugin.url,
repoName: item.name,
repoOwner: item.name.split("/")[0],
isCopied: false,
}),
);
});
})
.then(() => (isLoading.value = false));
Expand All @@ -49,13 +51,12 @@ const copyUrl = (plugin: PluginItem) => {
copy(plugin.url);
plugin.isCopied = true;
setTimeout(() => plugin.isCopied = false, 1500);
setTimeout(() => (plugin.isCopied = false), 1500);
};
// fuse returns an empty array when the search query is empty
// so use data instead to show all plugins
const plugins = computed(() => (search.value ? results.value.map((i) => i.item) : data));
</script>

<template>
Expand All @@ -67,16 +68,33 @@ const plugins = computed(() => (search.value ? results.value.map((i) => i.item)
<div h="1px" bg="$vp-c-divider" m="b-4" />

<div text-center v-if="isLoading">Loading plugins...</div>
<div text-center v-else-if="plugins.length === 0">No plugins found.. <span font-mono tracking-tight ml-2>( • ᴖ • 。)</span></div>
<div text-center v-else-if="plugins.length === 0">
No plugins found.. <span font-mono tracking-tight ml-2>( • ᴖ • 。)</span>
</div>
<div v-else flex="~ wrap" gap-3 items-center justify-center>
<div v-for="(plugin) in plugins" w-20rem h-44 px-4 py-3 border="1 solid $vp-c-divider" rounded-md
important-transition-all duration-400 hover="shadow-md bg-$vp-c-bg-soft" flex="~ col" justify-between>
<div
v-for="plugin in plugins"
w-20rem
h-44
px-4
py-3
border="1 solid $vp-c-divider"
rounded-md
important-transition-all
duration-400
hover="shadow-md bg-$vp-c-bg-soft"
flex="~ col"
justify-between
>
<div font-semibold dark="text-gray-200" line-clamp-1 overflow-hidden text-gray-900 text-16px>
{{ plugin.name }}
</div>

<div dark="text-gray-400" text-gray-500 text-14px>by
<a text-gray-500 inline line-clamp-1 overflow-hidden :href="`https://github.com/` + plugin.repoOwner">{{plugin.repoOwner}}</a>
<div dark="text-gray-400" text-gray-500 text-14px>
by
<a text-gray-500 inline line-clamp-1 overflow-hidden :href="`https://github.com/` + plugin.repoOwner">{{
plugin.repoOwner
}}</a>
</div>
<div text-gray-500 dark="text-gray-400" flex-auto mt-2 text-14px>
<span line-clamp-2>
Expand All @@ -86,18 +104,34 @@ const plugins = computed(() => (search.value ? results.value.map((i) => i.item)

<div flex justify-between items-end>
<div flex items-center gap-1>
<button @click="copyUrl(plugin)" w-32 inline-flex justify-center whitespace-nowrap text-sm font-medium
cursor-pointer bg="$vp-badge-tip-bg" text="$vp-badge-tip-text" px2 py2 rounded-md block mt2 flex
items-center gap2>
<button
@click="copyUrl(plugin)"
w-32
inline-flex
justify-center
whitespace-nowrap
text-sm
font-medium
cursor-pointer
bg="$vp-badge-tip-bg"
text="$vp-badge-tip-text"
px2
py2
rounded-md
block
mt2
flex
items-center
gap2
>
<span v-if="!plugin.isCopied">Copy Plugin Link</span>
<span v-else>Copied!</span>
</button>
</div>
<div flex>
<a :href="`https://github.com/` + plugin.repoName" i-carbon-logo-github w-8 h-8 bg-dark dark:bg-light>
</a>
<a :href="`https://github.com/` + plugin.repoName" i-carbon-logo-github w-8 h-8 bg-dark dark:bg-light> </a>
</div>
</div>
</div>
</div>
</template>
</template>
2 changes: 1 addition & 1 deletion packages/shelter-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"fuse.js": "^7.0.0",
"vue": "^3.4.15"
}
}
}
Loading

0 comments on commit e359c03

Please sign in to comment.