add and run prettier & eslint
This commit is contained in:
parent
c471d03c90
commit
2143595613
14 changed files with 2711 additions and 419 deletions
1
.eslintignore
Normal file
1
.eslintignore
Normal file
|
|
@ -0,0 +1 @@
|
|||
dist
|
||||
7
.eslintrc.json
Normal file
7
.eslintrc.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"root": true,
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
}
|
||||
}
|
||||
1
.prettierignore
Normal file
1
.prettierignore
Normal file
|
|
@ -0,0 +1 @@
|
|||
dist
|
||||
4
.prettierrc.json
Normal file
4
.prettierrc.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"useTabs": false,
|
||||
"singleQuote": false
|
||||
}
|
||||
10
README.md
10
README.md
|
|
@ -7,21 +7,28 @@ Static files/assets used to spin up an Ultraviolet website.
|
|||
## Packaging
|
||||
|
||||
1. Clone the repository
|
||||
|
||||
```sh
|
||||
$ git clone https://github.com/titaniumnetwork-development/Ultraviolet-Static.git
|
||||
> Cloning into Ultraviolet-Static...
|
||||
$ cd Ultraviolet-Static
|
||||
```
|
||||
|
||||
2. Install dependencies
|
||||
|
||||
```sh
|
||||
npm install
|
||||
```
|
||||
|
||||
3. Make your changes...
|
||||
4. Produce the `dist/` directory and import the Ultraviolet scripts
|
||||
|
||||
```sh
|
||||
npm run build
|
||||
```
|
||||
|
||||
5. Package for NPM to produce `ultraviolet-static.X.X.X.tar.gz` file
|
||||
|
||||
```sh
|
||||
npm pack
|
||||
```
|
||||
|
|
@ -30,12 +37,15 @@ npm pack
|
|||
|
||||
1. Follow installation steps until you need to run `npm install`
|
||||
2. Install the produced Ultraviolet-Static tgz (upload to Discord, Github, etc...) (see [Packaging](#packaging))
|
||||
|
||||
```sh
|
||||
$ npm install https://github.com/titaniumnetwork-development/Ultraviolet-Static/releases/download/v1.0.0/ultraviolet-static-1.0.0.tgz
|
||||
# OR
|
||||
$ npm install ../path/to/ultraviolet-static-1.0.0.tgz
|
||||
```
|
||||
|
||||
3. Continue instructions...
|
||||
|
||||
```sh
|
||||
$ npm start
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
export const publicPath = fileURLToPath(new URL('../dist/', import.meta.url));
|
||||
export const publicPath = fileURLToPath(new URL("../dist/", import.meta.url));
|
||||
|
|
|
|||
2211
package-lock.json
generated
2211
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -13,5 +13,9 @@
|
|||
"dependencies": {
|
||||
"fs-extra": "^10.1.0",
|
||||
"ultraviolet": "https://github.com/titaniumnetwork-development/Ultraviolet/releases/download/v1.0.1/ultraviolet-1.0.1.tgz"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.23.0",
|
||||
"prettier": "^2.7.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;1,300;1,400&display=swap');
|
||||
@import url('https://unpkg.com/@fortawesome/fontawesome-free@5.15.4/css/all.min.css');
|
||||
@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;1,300;1,400&display=swap");
|
||||
@import url("https://unpkg.com/@fortawesome/fontawesome-free@5.15.4/css/all.min.css");
|
||||
@keyframes fadeInAnimation {
|
||||
0% {
|
||||
opacity: 0;
|
||||
|
|
@ -43,7 +43,7 @@ body {
|
|||
.logo-wrapper .text {
|
||||
font-size: 75px;
|
||||
font-family: "Roboto";
|
||||
color: #FFF;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.logo-wrapper h1 {
|
||||
|
|
@ -64,7 +64,7 @@ footer a,
|
|||
footer span {
|
||||
margin: 0 15px;
|
||||
text-decoration: none;
|
||||
color: #FFF;
|
||||
color: #fff;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
|
|
@ -96,14 +96,14 @@ form input {
|
|||
font-family: inherit;
|
||||
padding: 0px 17px;
|
||||
height: 48px;
|
||||
border: 1px solid rgb(255, 255, 255, .2);
|
||||
border: 1px solid rgb(255, 255, 255, 0.2);
|
||||
color: var(--text-color);
|
||||
border-radius: 3px;
|
||||
outline: none;
|
||||
width: 350px;
|
||||
margin-top: 5px;
|
||||
border-radius: 50px;
|
||||
color: #FFF;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
form input:focus {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,21 +1,27 @@
|
|||
const form = document.querySelector('form');
|
||||
const input = document.querySelector('input');
|
||||
const form = document.querySelector("form");
|
||||
const input = document.querySelector("input");
|
||||
|
||||
form.addEventListener('submit', async event => {
|
||||
form.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
window.navigator.serviceWorker.register('./sw.js', {
|
||||
scope: __uv$config.prefix
|
||||
}).then(() => {
|
||||
window.navigator.serviceWorker
|
||||
.register("./sw.js", {
|
||||
scope: __uv$config.prefix,
|
||||
})
|
||||
.then(() => {
|
||||
let url = input.value.trim();
|
||||
if (!isUrl(url)) url = 'https://www.google.com/search?q=' + url;
|
||||
else if (!(url.startsWith('https://') || url.startsWith('http://'))) url = 'http://' + url;
|
||||
|
||||
if (!isUrl(url)) url = "https://www.google.com/search?q=" + url;
|
||||
else if (!(url.startsWith("https://") || url.startsWith("http://")))
|
||||
url = "http://" + url;
|
||||
|
||||
window.location.href = __uv$config.prefix + __uv$config.encodeUrl(url);
|
||||
});
|
||||
});
|
||||
|
||||
function isUrl(val = ''){
|
||||
if (/^http(s?):\/\//.test(val) || val.includes('.') && val.substr(0, 1) !== ' ') return true;
|
||||
function isUrl(val = "") {
|
||||
if (
|
||||
/^http(s?):\/\//.test(val) ||
|
||||
(val.includes(".") && val.substr(0, 1) !== " ")
|
||||
)
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
importScripts('./uv/uv.bundle.js');
|
||||
importScripts('./uv/uv.config.js');
|
||||
importScripts('./uv/uv.sw.js');
|
||||
importScripts("./uv/uv.bundle.js");
|
||||
importScripts("./uv/uv.config.js");
|
||||
importScripts("./uv/uv.sw.js");
|
||||
|
||||
const sw = new UVServiceWorker();
|
||||
|
||||
self.addEventListener('fetch', (event) => event.respondWith(sw.fetch(event)));
|
||||
self.addEventListener("fetch", (event) => event.respondWith(sw.fetch(event)));
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
// This file overwrites the stock UV config.js
|
||||
|
||||
self.__uv$config = {
|
||||
prefix: '/service/',
|
||||
bare: '/bare/',
|
||||
prefix: "/service/",
|
||||
bare: "/bare/",
|
||||
encodeUrl: Ultraviolet.codec.xor.encode,
|
||||
decodeUrl: Ultraviolet.codec.xor.decode,
|
||||
handler: '/uv/uv.handler.js',
|
||||
bundle: '/uv/uv.bundle.js',
|
||||
config: '/uv/uv.config.js',
|
||||
sw: '/uv/uv.sw.js',
|
||||
handler: "/uv/uv.handler.js",
|
||||
bundle: "/uv/uv.bundle.js",
|
||||
config: "/uv/uv.config.js",
|
||||
sw: "/uv/uv.sw.js",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
/**
|
||||
* Copies public & ultraviolet into the dist directory.
|
||||
* Copies src & ultraviolet into the dist directory.
|
||||
*/
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import { uvPath } from 'ultraviolet';
|
||||
import fs from "fs-extra";
|
||||
import { uvPath } from "ultraviolet";
|
||||
|
||||
try {
|
||||
await fs.mkdir('dist');
|
||||
await fs.mkdir("dist");
|
||||
} catch (err) {
|
||||
if (err?.code !== 'EEXIST') throw err;
|
||||
if (err?.code !== "EEXIST") throw err;
|
||||
}
|
||||
|
||||
await fs.copy(uvPath, 'dist/uv/');
|
||||
await fs.copy('public', 'dist/');
|
||||
await fs.copy(uvPath, "dist/uv/");
|
||||
await fs.copy("src", "dist/");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue