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
|
## Packaging
|
||||||
|
|
||||||
1. Clone the repository
|
1. Clone the repository
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ git clone https://github.com/titaniumnetwork-development/Ultraviolet-Static.git
|
$ git clone https://github.com/titaniumnetwork-development/Ultraviolet-Static.git
|
||||||
> Cloning into Ultraviolet-Static...
|
> Cloning into Ultraviolet-Static...
|
||||||
$ cd Ultraviolet-Static
|
$ cd Ultraviolet-Static
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Install dependencies
|
2. Install dependencies
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Make your changes...
|
3. Make your changes...
|
||||||
4. Produce the `dist/` directory and import the Ultraviolet scripts
|
4. Produce the `dist/` directory and import the Ultraviolet scripts
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Package for NPM to produce `ultraviolet-static.X.X.X.tar.gz` file
|
5. Package for NPM to produce `ultraviolet-static.X.X.X.tar.gz` file
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm pack
|
npm pack
|
||||||
```
|
```
|
||||||
|
|
@ -30,12 +37,15 @@ npm pack
|
||||||
|
|
||||||
1. Follow installation steps until you need to run `npm install`
|
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))
|
2. Install the produced Ultraviolet-Static tgz (upload to Discord, Github, etc...) (see [Packaging](#packaging))
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ npm install https://github.com/titaniumnetwork-development/Ultraviolet-Static/releases/download/v1.0.0/ultraviolet-static-1.0.0.tgz
|
$ npm install https://github.com/titaniumnetwork-development/Ultraviolet-Static/releases/download/v1.0.0/ultraviolet-static-1.0.0.tgz
|
||||||
# OR
|
# OR
|
||||||
$ npm install ../path/to/ultraviolet-static-1.0.0.tgz
|
$ npm install ../path/to/ultraviolet-static-1.0.0.tgz
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Continue instructions...
|
3. Continue instructions...
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ npm start
|
$ 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": {
|
"dependencies": {
|
||||||
"fs-extra": "^10.1.0",
|
"fs-extra": "^10.1.0",
|
||||||
"ultraviolet": "https://github.com/titaniumnetwork-development/Ultraviolet/releases/download/v1.0.1/ultraviolet-1.0.1.tgz"
|
"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://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://unpkg.com/@fortawesome/fontawesome-free@5.15.4/css/all.min.css");
|
||||||
@keyframes fadeInAnimation {
|
@keyframes fadeInAnimation {
|
||||||
0% {
|
0% {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
@ -43,7 +43,7 @@ body {
|
||||||
.logo-wrapper .text {
|
.logo-wrapper .text {
|
||||||
font-size: 75px;
|
font-size: 75px;
|
||||||
font-family: "Roboto";
|
font-family: "Roboto";
|
||||||
color: #FFF;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo-wrapper h1 {
|
.logo-wrapper h1 {
|
||||||
|
|
@ -64,7 +64,7 @@ footer a,
|
||||||
footer span {
|
footer span {
|
||||||
margin: 0 15px;
|
margin: 0 15px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #FFF;
|
color: #fff;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,14 +96,14 @@ form input {
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
padding: 0px 17px;
|
padding: 0px 17px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
border: 1px solid rgb(255, 255, 255, .2);
|
border: 1px solid rgb(255, 255, 255, 0.2);
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
outline: none;
|
outline: none;
|
||||||
width: 350px;
|
width: 350px;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
color: #FFF;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
form input:focus {
|
form input:focus {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,21 +1,27 @@
|
||||||
const form = document.querySelector('form');
|
const form = document.querySelector("form");
|
||||||
const input = document.querySelector('input');
|
const input = document.querySelector("input");
|
||||||
|
|
||||||
form.addEventListener('submit', async event => {
|
form.addEventListener("submit", async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
window.navigator.serviceWorker.register('./sw.js', {
|
window.navigator.serviceWorker
|
||||||
scope: __uv$config.prefix
|
.register("./sw.js", {
|
||||||
}).then(() => {
|
scope: __uv$config.prefix,
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
let url = input.value.trim();
|
let url = input.value.trim();
|
||||||
if (!isUrl(url)) url = 'https://www.google.com/search?q=' + url;
|
if (!isUrl(url)) url = "https://www.google.com/search?q=" + url;
|
||||||
else if (!(url.startsWith('https://') || url.startsWith('http://'))) url = 'http://' + url;
|
else if (!(url.startsWith("https://") || url.startsWith("http://")))
|
||||||
|
url = "http://" + url;
|
||||||
|
|
||||||
window.location.href = __uv$config.prefix + __uv$config.encodeUrl(url);
|
window.location.href = __uv$config.prefix + __uv$config.encodeUrl(url);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function isUrl(val = ''){
|
function isUrl(val = "") {
|
||||||
if (/^http(s?):\/\//.test(val) || val.includes('.') && val.substr(0, 1) !== ' ') return true;
|
if (
|
||||||
|
/^http(s?):\/\//.test(val) ||
|
||||||
|
(val.includes(".") && val.substr(0, 1) !== " ")
|
||||||
|
)
|
||||||
|
return true;
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
importScripts('./uv/uv.bundle.js');
|
importScripts("./uv/uv.bundle.js");
|
||||||
importScripts('./uv/uv.config.js');
|
importScripts("./uv/uv.config.js");
|
||||||
importScripts('./uv/uv.sw.js');
|
importScripts("./uv/uv.sw.js");
|
||||||
|
|
||||||
const sw = new UVServiceWorker();
|
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
|
// This file overwrites the stock UV config.js
|
||||||
|
|
||||||
self.__uv$config = {
|
self.__uv$config = {
|
||||||
prefix: '/service/',
|
prefix: "/service/",
|
||||||
bare: '/bare/',
|
bare: "/bare/",
|
||||||
encodeUrl: Ultraviolet.codec.xor.encode,
|
encodeUrl: Ultraviolet.codec.xor.encode,
|
||||||
decodeUrl: Ultraviolet.codec.xor.decode,
|
decodeUrl: Ultraviolet.codec.xor.decode,
|
||||||
handler: '/uv/uv.handler.js',
|
handler: "/uv/uv.handler.js",
|
||||||
bundle: '/uv/uv.bundle.js',
|
bundle: "/uv/uv.bundle.js",
|
||||||
config: '/uv/uv.config.js',
|
config: "/uv/uv.config.js",
|
||||||
sw: '/uv/uv.sw.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 fs from "fs-extra";
|
||||||
import { uvPath } from 'ultraviolet';
|
import { uvPath } from "ultraviolet";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fs.mkdir('dist');
|
await fs.mkdir("dist");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err?.code !== 'EEXIST') throw err;
|
if (err?.code !== "EEXIST") throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
await fs.copy(uvPath, 'dist/uv/');
|
await fs.copy(uvPath, "dist/uv/");
|
||||||
await fs.copy('public', 'dist/');
|
await fs.copy("src", "dist/");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue