From 010188a0ce0f7a003ef76e7556af9d2467643304 Mon Sep 17 00:00:00 2001 From: adbenitez Date: Sat, 24 Jun 2023 17:00:45 +0200 Subject: [PATCH] apply prettier --- .github/workflows/release-webxdc.yml | 2 +- .prettierignore | 3 +- css/main.css | 30 ++++++------- index.html | 49 ++++++++++++-------- js/main.js | 67 +++++++++++++++------------- test/basic.test.js | 3 +- vite.config.js | 15 +++---- 7 files changed, 93 insertions(+), 76 deletions(-) diff --git a/.github/workflows/release-webxdc.yml b/.github/workflows/release-webxdc.yml index 6064574..8356d71 100644 --- a/.github/workflows/release-webxdc.yml +++ b/.github/workflows/release-webxdc.yml @@ -3,7 +3,7 @@ name: Release Webxdc on: push: tags: - - 'v*.*.*' + - "v*.*.*" jobs: build: diff --git a/.prettierignore b/.prettierignore index 1e520f3..a61513a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,5 @@ dist dist-xdc webxdc.js -webxdc.d.ts \ No newline at end of file +webxdc.d.ts +pnpm-lock.yaml \ No newline at end of file diff --git a/css/main.css b/css/main.css index 92d66f6..765abc8 100644 --- a/css/main.css +++ b/css/main.css @@ -1,33 +1,33 @@ .btn { - background-color: #248bf5; - color: white; - padding: 0.4em; - border: none; - border-radius: 0.2rem; + background-color: #248bf5; + color: white; + padding: 0.4em; + border: none; + border-radius: 0.2rem; } input[type="text" i] { - padding: 0.3em; + padding: 0.3em; } .nick { - font-weight: bold; + font-weight: bold; } #chat-area { - background-color: #fff; - border: 1px solid #e5e5ea; - border-radius: 0.25rem; - display: flex; - flex-direction: column; - align-items: flex-start; - padding: 0.5rem; + background-color: #fff; + border: 1px solid #e5e5ea; + border-radius: 0.25rem; + display: flex; + flex-direction: column; + align-items: flex-start; + padding: 0.5rem; } .msg { border-radius: 1.15rem; line-height: 1.25; - padding: 0.5rem .875rem; + padding: 0.5rem 0.875rem; margin: 0.1rem; position: relative; word-wrap: break-word; diff --git a/index.html b/index.html index 7c1818b..7e53123 100644 --- a/index.html +++ b/index.html @@ -1,28 +1,41 @@ - - - + + + - - - - -

Chat

-
- - -
-

-

- + + + + +

Chat

+
+ + +
+

+

+ +

+ - - + - + diff --git a/js/main.js b/js/main.js index e850056..9ba6c53 100644 --- a/js/main.js +++ b/js/main.js @@ -1,40 +1,45 @@ function h(tag, attributes, ...children) { - const element = document.createElement(tag); - if (attributes) { - Object.entries(attributes).forEach(entry => { - element.setAttribute(entry[0], entry[1]); - }); - } - element.append(...children); - return element; + const element = document.createElement(tag); + if (attributes) { + Object.entries(attributes).forEach((entry) => { + element.setAttribute(entry[0], entry[1]); + }); + } + element.append(...children); + return element; } window.sendMsg = () => { - let msg = document.getElementById("input").value; - let info = window.webxdc.selfName + ': ' + msg; - document.getElementById("input").value = ''; + let msg = document.getElementById("input").value; + let info = window.webxdc.selfName + ": " + msg; + document.getElementById("input").value = ""; - // send new updates - window.webxdc.sendUpdate({ - payload: { - name: window.webxdc.selfName, - msg, - }, - info, - }, info); -} + // send new updates + window.webxdc.sendUpdate( + { + payload: { + name: window.webxdc.selfName, + msg, + }, + info, + }, + info + ); +}; window.onload = () => { - // handle past and future state updates - window.webxdc.setUpdateListener(function (update) { - const chat = document.getElementById('chat-area'); - chat.append( - h("p", {class: "msg"}, - h("span", {class: "nick"}, update.payload.name, ": "), - update.payload.msg, - ) - ); - }); + // handle past and future state updates + window.webxdc.setUpdateListener(function (update) { + const chat = document.getElementById("chat-area"); + chat.append( + h( + "p", + { class: "msg" }, + h("span", { class: "nick" }, update.payload.name, ": "), + update.payload.msg + ) + ); + }); - window.deviceName.innerHTML = 'You are: ' + window.webxdc.selfName; + window.deviceName.innerHTML = "You are: " + window.webxdc.selfName; }; diff --git a/test/basic.test.js b/test/basic.test.js index 9e40d0a..cb81999 100644 --- a/test/basic.test.js +++ b/test/basic.test.js @@ -1,6 +1,5 @@ import { expect, test } from "vitest"; - test("Example Test", () => { - expect(1+1).toBe(2); + expect(1 + 1).toBe(2); }); diff --git a/vite.config.js b/vite.config.js index 255bfb9..c2f031f 100644 --- a/vite.config.js +++ b/vite.config.js @@ -6,18 +6,17 @@ import packageJson from "./package.json"; let version = ""; if (packageJson.version) { - version = "_" + packageJson.version; + version = "_" + packageJson.version; } // https://vitejs.dev/config/ export default defineConfig({ - plugins: [ - zipPack({ - outDir: "dist-xdc", - outFileName: - (packageJson.name || "app") + version + ".xdc", - }), - ], + plugins: [ + zipPack({ + outDir: "dist-xdc", + outFileName: (packageJson.name || "app") + version + ".xdc", + }), + ], // https://github.com/vitest-dev/vitest test: {