commit b1c4f0aba66929fec0436249abf09e9a6fd51c2f Author: Snoweuph Date: Fri Dec 20 22:14:36 2024 +0000 Setup diff --git a/.gitea/template b/.gitea/template new file mode 100644 index 0000000..89e253d --- /dev/null +++ b/.gitea/template @@ -0,0 +1,2 @@ +Readme.md +src/main.user.js diff --git a/.gitea/workflows/qs.yml b/.gitea/workflows/qs.yml new file mode 100644 index 0000000..817a8bc --- /dev/null +++ b/.gitea/workflows/qs.yml @@ -0,0 +1,20 @@ +name: "QS" + +on: + push: + branches: + - main + +jobs: + qs: + name: "QS" + runs-on: "ubuntu-latest" + container: + image: "git.euph.dev/actions/runner-js-latest:latest" + steps: + - name: "Checkout" + uses: "https://git.euph.dev/actions/checkout@v3" + - name: "Prettier" + run: npm_config_yes=true npx prettier src/ types/ --check --log-level=error + - name: "Run Tests" + run: cd test && npm i --no-fund && npm run test diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..e69de29 diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..37ddf7a --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,10 @@ +{ + "useTabs": false, + "tabWidth": 4, + "arrowParens": "avoid", + "bracketSameLine": false, + "singleQuote": true, + "semi": true, + "trailingComma": "none", + "endOfLine": "lf" +} diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..28f1f51 --- /dev/null +++ b/Justfile @@ -0,0 +1,8 @@ +_choose: + @just --choose + +lint: + @npx prettier src/ types/ test/ --write + +test: + @cd test && npm run test diff --git a/License.md b/License.md new file mode 100644 index 0000000..fa5fb63 --- /dev/null +++ b/License.md @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2024 Userscripts + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..2cc35b9 --- /dev/null +++ b/Readme.md @@ -0,0 +1,14 @@ +# ${REPO_NAME} + +![Stars Badge](https://git.euph.dev/${REPO_LINK}/badges/stars.svg?style=flat-square&label=★Stars&labelColor=gray&color=yellow) +![QS Badge](https://.git.euph.dev/${REPO_LINK}/actions/workflows/qs.yml/badge.svg?style=flat-square&label=Status&labelColor=gray) + +## Installation + +[![Install Userscript](https://img.shields.io/badge/Install_Userscript-${REPO_NAME}-gray?style=for-the-badge&logo=greasyfork&logoColor=black&labelColor=brown)](https://git.euph.dev/${REPO_LINK}/raw/branch/main/src/main.user.js) + +## Description + + +## Usage + diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..d2b27d9 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "checkJs": true, + "target": "es6", + "lib": [ + "dom", + "es6" + ] + } +} diff --git a/src/lib.js b/src/lib.js new file mode 100644 index 0000000..ada0ad5 --- /dev/null +++ b/src/lib.js @@ -0,0 +1,5 @@ +function testLib() { + console.log('lib works!'); +} + +window.testLib = testLib; diff --git a/src/main.user.js b/src/main.user.js new file mode 100644 index 0000000..c0cb670 --- /dev/null +++ b/src/main.user.js @@ -0,0 +1,13 @@ +// ==UserScript== +// @name ${REPO_NAME} +// @namespace https://git.euph.dev/${REPO_OWNER} +// @match * +// @require ${REPO_LINK}/raw/branch/main/src/lib.js +// @grant GM_setValue +// @grant GM_getValue +// @grant GM_xmlhttpRequest +// @version 0.0.1 +// @author Userscripts +// ==/UserScript== + +window.testLib(); diff --git a/test/package.json b/test/package.json new file mode 100644 index 0000000..2c44c11 --- /dev/null +++ b/test/package.json @@ -0,0 +1,5 @@ +{ + "scripts": { + "test": "node test.js" + } +} diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..e67afbc --- /dev/null +++ b/test/test.js @@ -0,0 +1 @@ +console.log('Test Okay'); diff --git a/types/GM_getValue.d.js b/types/GM_getValue.d.js new file mode 100644 index 0000000..60a8662 --- /dev/null +++ b/types/GM_getValue.d.js @@ -0,0 +1,7 @@ +/** + * @param {string} storageKey + * @returns {string} + */ +function GM_getValue(storageKey) { + return ''; +} diff --git a/types/GM_setValue.d.js b/types/GM_setValue.d.js new file mode 100644 index 0000000..a003dd5 --- /dev/null +++ b/types/GM_setValue.d.js @@ -0,0 +1,5 @@ +/** + * @param {string} storageKey + * @param {string} value + */ +function GM_setValue(storageKey, value) {} diff --git a/types/GM_xmlhttpRequest.d.js b/types/GM_xmlhttpRequest.d.js new file mode 100644 index 0000000..9d09b8f --- /dev/null +++ b/types/GM_xmlhttpRequest.d.js @@ -0,0 +1,16 @@ +/** + * @param {Object} request + * @param {string} request.method + * @param {string} request.url + * @param {Object} [request.headers] + * @param {function(GMXMLHttpRequestResponse):void} [request.onload] + * @param {Function} [request.onerror] + * @returns {void} + */ +function GM_xmlhttpRequest(request) {} + +/** + * Response object for the HTTP request. + * @typedef {Object} GMXMLHttpRequestResponse + * @property {string} responseText - The response body as text. + */