Switch to shareable configs and fix linting issues.
This commit is contained in:
parent
9158503c69
commit
9abfe1f260
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"extends": [
|
|
||||||
"stylelint-config-standard-scss"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"no-descending-specificity": null,
|
|
||||||
"string-quotes": "single"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -13,18 +13,25 @@
|
||||||
"modern-normalize": "^2.0.0"
|
"modern-normalize": "^2.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@bauke/eslint-config": "^0.1.5",
|
||||||
|
"@bauke/prettier-config": "^0.1.5",
|
||||||
|
"@bauke/stylelint-config": "^0.1.5",
|
||||||
"@types/node": "^20.11.5",
|
"@types/node": "^20.11.5",
|
||||||
"@types/nunjucks": "^3.2.6",
|
"@types/nunjucks": "^3.2.6",
|
||||||
"netlify-cli": "^17.14.0",
|
"netlify-cli": "^17.14.0",
|
||||||
"sass": "^1.69.7",
|
"sass": "^1.69.7",
|
||||||
"stylelint": "^16.1.0",
|
"stylelint": "^16.1.0",
|
||||||
"stylelint-config-standard-scss": "^13.0.0",
|
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3",
|
||||||
"vite": "^5.0.11",
|
"vite": "^5.0.11",
|
||||||
"vite-plugin-nunjucks": "^0.2.0",
|
"vite-plugin-nunjucks": "^0.2.0",
|
||||||
"xo": "^0.56.0"
|
"xo": "^0.56.0"
|
||||||
},
|
},
|
||||||
|
"prettier": "@bauke/prettier-config",
|
||||||
|
"stylelint": {
|
||||||
|
"extends": "@bauke/stylelint-config"
|
||||||
|
},
|
||||||
"xo": {
|
"xo": {
|
||||||
|
"extends": "@bauke/eslint-config",
|
||||||
"prettier": true,
|
"prettier": true,
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/consistent-type-definitions": "off"
|
"@typescript-eslint/consistent-type-definitions": "off"
|
||||||
|
|
1128
pnpm-lock.yaml
1128
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
||||||
@use 'reset';
|
@use "reset";
|
||||||
|
|
||||||
html {
|
html {
|
||||||
font-size: 62.5%;
|
font-size: 62.5%;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@use '../mixins';
|
@use "../mixins";
|
||||||
|
|
||||||
body {
|
body {
|
||||||
padding: var(--spacing-16);
|
padding: var(--spacing-16);
|
||||||
|
@ -51,7 +51,7 @@ body {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-bottom: var(--spacing-16);
|
margin-bottom: var(--spacing-16);
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
@media (width < 600px) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
@use '../mixins';
|
@use "../mixins";
|
||||||
@use 'sections';
|
@use "sections";
|
||||||
|
|
||||||
.page-header {
|
.page-header {
|
||||||
@include mixins.responsive-container;
|
@include mixins.responsive-container;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@use '../mixins';
|
@use "../mixins";
|
||||||
|
|
||||||
.sections {
|
.sections {
|
||||||
@include mixins.responsive-container;
|
@include mixins.responsive-container;
|
||||||
|
|
|
@ -17,8 +17,8 @@ $large-breakpoint: 1200px;
|
||||||
&::after {
|
&::after {
|
||||||
--shadow-size: #{$size};
|
--shadow-size: #{$size};
|
||||||
|
|
||||||
background: url('/assets/shadow-pattern.png') repeat;
|
background: url("/assets/shadow-pattern.png") repeat;
|
||||||
content: '';
|
content: "";
|
||||||
height: 100%;
|
height: 100%;
|
||||||
left: var(--shadow-size);
|
left: var(--shadow-size);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
@use '../../node_modules/modern-normalize/modern-normalize.css';
|
@use "../../node_modules/modern-normalize/modern-normalize.css";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@use '../mixins';
|
@use "../mixins";
|
||||||
|
|
||||||
body {
|
body {
|
||||||
padding: var(--spacing-16);
|
padding: var(--spacing-16);
|
||||||
|
@ -50,7 +50,7 @@ body {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-bottom: var(--spacing-16);
|
margin-bottom: var(--spacing-16);
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
@media (width < 600px) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@use '../mixins';
|
@use "../mixins";
|
||||||
|
|
||||||
body {
|
body {
|
||||||
padding: var(--spacing-16);
|
padding: var(--spacing-16);
|
||||||
|
@ -51,7 +51,7 @@ body {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-bottom: var(--spacing-16);
|
margin-bottom: var(--spacing-16);
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
@media (width < 600px) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
import '../../node_modules/@fontsource/inter/latin.css';
|
import "../../node_modules/@fontsource/inter/latin.css";
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import {Base64} from 'js-base64';
|
import {Base64} from "js-base64";
|
||||||
|
|
||||||
const fragmentPrefix = '#json=';
|
const fragmentPrefix = "#json=";
|
||||||
|
|
||||||
const exampleRedirect: Redirect = {
|
const exampleRedirect: Redirect = {
|
||||||
matcherType: 'hostname',
|
matcherType: "hostname",
|
||||||
matcherValue: 'example.com',
|
matcherValue: "example.com",
|
||||||
redirectType: 'hostname',
|
redirectType: "hostname",
|
||||||
redirectValue: 'example.org',
|
redirectValue: "example.org",
|
||||||
};
|
};
|
||||||
|
|
||||||
function decodeBase64<T>(base64: string): T {
|
function decodeBase64<T>(base64: string): T {
|
||||||
|
@ -17,8 +17,8 @@ function encodeBase64(source: any): string {
|
||||||
return Base64.encode(JSON.stringify(source), true);
|
return Base64.encode(JSON.stringify(source), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
window['Re-Nav'] = {
|
window["Re-Nav"] = {
|
||||||
decodeBase64,
|
decodeBase64,
|
||||||
encodeBase64,
|
encodeBase64,
|
||||||
share,
|
share,
|
||||||
|
@ -26,11 +26,11 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
"Want to manually create a share link? Use the window['Re-Nav'].share",
|
"Want to manually create a share link? Use the window['Re-Nav'].share",
|
||||||
'function, where redirect is an object with matcherType, matcherValue,',
|
"function, where redirect is an object with matcherType, matcherValue,",
|
||||||
'redirectType and redirectValue properties. Like this:',
|
"redirectType and redirectValue properties. Like this:",
|
||||||
);
|
);
|
||||||
console.log(JSON.stringify(exampleRedirect, undefined, 2));
|
console.log(JSON.stringify(exampleRedirect, undefined, 2));
|
||||||
console.log(window['Re-Nav'].share);
|
console.log(window["Re-Nav"].share);
|
||||||
|
|
||||||
if (!location.hash.startsWith(fragmentPrefix)) {
|
if (!location.hash.startsWith(fragmentPrefix)) {
|
||||||
return;
|
return;
|
||||||
|
@ -43,12 +43,12 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
insertText(key as keyof Redirect, value);
|
insertText(key as keyof Redirect, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const element of document.querySelectorAll('.hidden-by-default')) {
|
for (const element of document.querySelectorAll(".hidden-by-default")) {
|
||||||
element.classList.remove('hidden-by-default');
|
element.classList.remove("hidden-by-default");
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector('.subtitle')!.textContent =
|
document.querySelector(".subtitle")!.textContent =
|
||||||
'Someone shared a redirect with you!';
|
"Someone shared a redirect with you!";
|
||||||
});
|
});
|
||||||
|
|
||||||
function insertText(key: keyof Redirect, value: string): void {
|
function insertText(key: keyof Redirect, value: string): void {
|
||||||
|
@ -57,14 +57,14 @@ function insertText(key: keyof Redirect, value: string): void {
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line unicorn/prefer-switch
|
// eslint-disable-next-line unicorn/prefer-switch
|
||||||
if (key === 'matcherType') {
|
if (key === "matcherType") {
|
||||||
insert('.matcher-type', value);
|
insert(".matcher-type", value);
|
||||||
} else if (key === 'matcherValue') {
|
} else if (key === "matcherValue") {
|
||||||
insert('.matcher-value', value);
|
insert(".matcher-value", value);
|
||||||
} else if (key === 'redirectType') {
|
} else if (key === "redirectType") {
|
||||||
insert('.redirect-type', value);
|
insert(".redirect-type", value);
|
||||||
} else if (key === 'redirectValue') {
|
} else if (key === "redirectValue") {
|
||||||
insert('.redirect-value', value);
|
insert(".redirect-value", value);
|
||||||
} else {
|
} else {
|
||||||
console.warn(`Unknown key: ${key as string}`);
|
console.warn(`Unknown key: ${key as string}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,11 @@ declare global {
|
||||||
readonly DEV: boolean;
|
readonly DEV: boolean;
|
||||||
readonly MODE: string;
|
readonly MODE: string;
|
||||||
readonly PROD: boolean;
|
readonly PROD: boolean;
|
||||||
readonly VITE_BROWSER: 'chromium' | 'firefox';
|
readonly VITE_BROWSER: "chromium" | "firefox";
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Window {
|
interface Window {
|
||||||
'Re-Nav': {
|
"Re-Nav": {
|
||||||
decodeBase64<T>(base64: string): T;
|
decodeBase64<T>(base64: string): T;
|
||||||
encodeBase64(source: any): string;
|
encodeBase64(source: any): string;
|
||||||
share(redirect: Redirect): string;
|
share(redirect: Redirect): string;
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
import path from 'node:path';
|
import path from "node:path";
|
||||||
import url from 'node:url';
|
import {defineConfig} from "vite";
|
||||||
|
import nunjucks from "vite-plugin-nunjucks";
|
||||||
|
|
||||||
import {defineConfig} from 'vite';
|
const relative = (input: string) => new URL(input, import.meta.url).pathname;
|
||||||
|
|
||||||
import nunjucks from 'vite-plugin-nunjucks';
|
const buildDir = relative("build");
|
||||||
|
const sourceDir = relative("source");
|
||||||
const currentDir = path.dirname(url.fileURLToPath(import.meta.url));
|
|
||||||
const buildDir = path.join(currentDir, 'build');
|
|
||||||
const sourceDir = path.join(currentDir, 'source');
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
|
@ -15,11 +13,11 @@ export default defineConfig({
|
||||||
outDir: buildDir,
|
outDir: buildDir,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: {
|
input: {
|
||||||
fangs: path.join(sourceDir, 'fangs/index.html'),
|
fangs: path.join(sourceDir, "fangs/index.html"),
|
||||||
home: path.join(sourceDir, 'index.html'),
|
home: path.join(sourceDir, "index.html"),
|
||||||
queue: path.join(sourceDir, 'queue/index.html'),
|
queue: path.join(sourceDir, "queue/index.html"),
|
||||||
're-nav': path.join(sourceDir, 're-nav/index.html'),
|
"re-nav": path.join(sourceDir, "re-nav/index.html"),
|
||||||
're-nav/share': path.join(sourceDir, 're-nav/share/index.html'),
|
"re-nav/share": path.join(sourceDir, "re-nav/share/index.html"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
|
@ -31,6 +29,6 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
publicDir: path.join(sourceDir, 'static'),
|
publicDir: path.join(sourceDir, "static"),
|
||||||
root: sourceDir,
|
root: sourceDir,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue