1
0
mirror of https://github.com/NickKaramoff/shareon synced 2025-03-09 16:00:17 +01:00

Add script to format with Deno

This commit is contained in:
Nikita Karamov 2025-01-28 07:24:14 +01:00
parent 722411b7ec
commit 6a4009b1a2
3 changed files with 14 additions and 7 deletions

View File

@ -2,5 +2,8 @@
"compilerOptions": {
"checkJs": true,
"lib": ["dom", "dom.iterable", "dom.asynciterable"]
},
"fmt": {
"exclude": ["pnpm-lock.yaml", "**/*.md"]
}
}

7
script/fmt Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
set -eu
ROOT="$(dirname "$(dirname "$0")")"
deno fmt "$@" "$ROOT"

View File

@ -1,6 +1,6 @@
import "./shareon.css";
// prettier-ignore
// deno-fmt-ignore
/**
* Map of social networks to their respective URL builders.
*
@ -61,8 +61,7 @@ const init = () => {
// if it's "Copy URL"
if (cls === "copy-url") {
child.addEventListener("click", () => {
const url =
child.dataset.url ||
const url = child.dataset.url ||
container.dataset.url ||
window.location.href;
navigator.clipboard.writeText(url);
@ -83,13 +82,11 @@ const init = () => {
// if it's "Web Share"
if (cls === "web-share") {
const data = {
title:
child.dataset.title ||
title: child.dataset.title ||
container.dataset.title ||
document.title,
text: child.dataset.text || container.dataset.text || "",
url:
child.dataset.url ||
url: child.dataset.url ||
container.dataset.url ||
window.location.href,
};