mirror of
https://github.com/revanced/revanced-website.git
synced 2025-04-29 14:14:30 +02:00
chore: bump everything (#56)
This commit is contained in:
parent
e1b8445b59
commit
c9e0edf842
@ -1,5 +1,7 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
|
/public
|
||||||
|
/images
|
||||||
/build
|
/build
|
||||||
/.svelte-kit
|
/.svelte-kit
|
||||||
/package
|
/package
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
/build
|
/build
|
||||||
|
/testing-docs
|
||||||
|
/public
|
||||||
/.svelte-kit
|
/.svelte-kit
|
||||||
/package
|
/package
|
||||||
.env
|
.env
|
||||||
|
@ -2,5 +2,8 @@
|
|||||||
"useTabs": true,
|
"useTabs": true,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"printWidth": 100
|
"printWidth": 100,
|
||||||
|
"plugins": ["prettier-plugin-svelte"],
|
||||||
|
"pluginSearchDirs": ["."],
|
||||||
|
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
|
||||||
}
|
}
|
||||||
|
1591
package-lock.json
generated
1591
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
28
package.json
28
package.json
@ -7,30 +7,30 @@
|
|||||||
"package": "svelte-kit package",
|
"package": "svelte-kit package",
|
||||||
"preview": "sirv ./public --no-clear",
|
"preview": "sirv ./public --no-clear",
|
||||||
"vite:preview": "vite preview",
|
"vite:preview": "vite preview",
|
||||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||||
"lint": "prettier --check --plugin-search-dir=. . && eslint .",
|
"lint": "prettier --check --plugin-search-dir=. . && eslint .",
|
||||||
"format": "prettier --write --plugin-search-dir=. ."
|
"format": "prettier --write --plugin-search-dir=. ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/adapter-static": "next",
|
"@sveltejs/adapter-static": "^1.0.0",
|
||||||
"@sveltejs/kit": "next",
|
"@sveltejs/kit": "^1.0.0",
|
||||||
"@types/marked": "^4.0.7",
|
"@types/marked": "^4.0.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
||||||
"@typescript-eslint/parser": "^5.27.0",
|
"@typescript-eslint/parser": "^5.27.0",
|
||||||
"eslint": "^8.16.0",
|
"eslint": "^8.28.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-svelte3": "^4.0.0",
|
"eslint-plugin-svelte3": "^4.0.0",
|
||||||
"prettier": "^2.6.2",
|
"imagetools-core": "^3.2.3",
|
||||||
"prettier-plugin-svelte": "^2.7.0",
|
"prettier": "^2.8.0",
|
||||||
|
"prettier-plugin-svelte": "^2.8.1",
|
||||||
"sass": "^1.55.0",
|
"sass": "^1.55.0",
|
||||||
"sirv-cli": "^2.0.2",
|
"sirv-cli": "^2.0.2",
|
||||||
"svelte": "^3.44.0",
|
"svelte": "^3.54.0",
|
||||||
"svelte-check": "^2.7.1",
|
"svelte-check": "^2.9.2",
|
||||||
"svelte-preprocess": "^4.10.6",
|
"tslib": "^2.4.1",
|
||||||
"tslib": "^2.3.1",
|
"typescript": "^4.9.3",
|
||||||
"typescript": "^4.7.4",
|
"vite": "^4.0.0",
|
||||||
"vite": "^3.0.0",
|
|
||||||
"vite-imagetools": "^4.0.11"
|
"vite-imagetools": "^4.0.11"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
@ -2,7 +2,7 @@ import type { Readable, Subscriber, Unsubscriber, Writable } from 'svelte/store'
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
|
|
||||||
import { prerendering, browser, dev } from '$app/environment';
|
import { building, browser, dev } from '$app/environment';
|
||||||
|
|
||||||
import * as settings from './settings';
|
import * as settings from './settings';
|
||||||
import * as cache from './cache';
|
import * as cache from './cache';
|
||||||
@ -64,12 +64,12 @@ export class API<T> implements Readable<T> {
|
|||||||
// Implements the load function found in `+page/layout.ts` files.
|
// Implements the load function found in `+page/layout.ts` files.
|
||||||
page_load_impl() {
|
page_load_impl() {
|
||||||
return async ({ fetch }) => {
|
return async ({ fetch }) => {
|
||||||
if (prerendering) {
|
if (building) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Might be better to actually return some data from the load function and use that on the client.
|
// Might be better to actually return some data from the load function and use that on the client.
|
||||||
if (!(dev || browser || prerendering)) {
|
if (!(dev || browser || building)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'The API client is not optimized for production server-side rendering. Please change that :)'
|
'The API client is not optimized for production server-side rendering. Please change that :)'
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import '../app.scss';
|
||||||
import { derived } from 'svelte/store';
|
import { derived } from 'svelte/store';
|
||||||
|
|
||||||
import NavHost from '$layout/Navbar/NavHost.svelte';
|
import NavHost from '$layout/Navbar/NavHost.svelte';
|
||||||
@ -32,6 +33,3 @@
|
|||||||
afn if you are moving the footer here, please make it not use the repositories store directly and instead use component props :) -->
|
afn if you are moving the footer here, please make it not use the repositories store directly and instead use component props :) -->
|
||||||
|
|
||||||
<!-- <Footer repos={$repositories}> -->
|
<!-- <Footer repos={$repositories}> -->
|
||||||
<style lang="scss" global>
|
|
||||||
@import '../app.scss';
|
|
||||||
</style>
|
|
||||||
|
@ -1,209 +1,213 @@
|
|||||||
import { is_tree } from './documentation.shared';
|
import { is_tree } from './documentation.shared';
|
||||||
import type { Document, DocsTree, DocsTreeNode, DocumentInfo } from './documentation.shared';
|
import type { Document, DocsTree, DocsTreeNode, DocumentInfo } from './documentation.shared';
|
||||||
|
|
||||||
import { browser, prerendering } from '$app/environment';
|
import { browser, building } from '$app/environment';
|
||||||
|
|
||||||
import fs, { existsSync as exists } from 'fs';
|
import fs, { existsSync as exists } from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import { parse as parse_md } from 'marked';
|
import { parse as parse_md } from 'marked';
|
||||||
import AsciiDocProcessor from 'asciidoctor'
|
import AsciiDocProcessor from 'asciidoctor';
|
||||||
|
|
||||||
// This file does not work in a browser.
|
// This file does not work in a browser.
|
||||||
if (browser) {
|
if (browser) {
|
||||||
throw Error('SvelteKit has skill issues');
|
throw Error('SvelteKit has skill issues');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constants
|
/// Constants
|
||||||
|
|
||||||
const supported_formats: Map<string, (markup: string) => Document> = new Map();
|
const supported_formats: Map<string, (markup: string) => Document> = new Map();
|
||||||
|
|
||||||
supported_formats.set("md", markup => {
|
supported_formats.set('md', (markup) => {
|
||||||
let lines = markup.split('\n');
|
let lines = markup.split('\n');
|
||||||
|
|
||||||
// Get and remove the first line.
|
// Get and remove the first line.
|
||||||
const first_line = lines.splice(0, 1)[0];
|
const first_line = lines.splice(0, 1)[0];
|
||||||
// Remove `# `.
|
// Remove `# `.
|
||||||
const title = first_line.substring(2);
|
const title = first_line.substring(2);
|
||||||
|
|
||||||
// Convert the rest to html
|
// Convert the rest to html
|
||||||
const content = parse_md(lines.join('\n'));
|
const content = parse_md(lines.join('\n'));
|
||||||
|
|
||||||
return { title, content };
|
return { title, content };
|
||||||
});
|
});
|
||||||
|
|
||||||
const asciidoctor = AsciiDocProcessor();
|
const asciidoctor = AsciiDocProcessor();
|
||||||
const adoc_fn = markup => {
|
const adoc_fn = (markup) => {
|
||||||
// Get first line.
|
// Get first line.
|
||||||
const first_line = markup.split('\n')[0];
|
const first_line = markup.split('\n')[0];
|
||||||
// Remove `= `.
|
// Remove `= `.
|
||||||
const title = first_line.substring(2);
|
const title = first_line.substring(2);
|
||||||
|
|
||||||
// Convert it to html. Unlike markdown, we do not need to remove the first title heading.
|
// Convert it to html. Unlike markdown, we do not need to remove the first title heading.
|
||||||
// NOTE: Maybe consider change the safe mode value.
|
// NOTE: Maybe consider change the safe mode value.
|
||||||
const content = asciidoctor.convert(markup, { doctype: "book" })
|
const content = asciidoctor.convert(markup, { doctype: 'book' });
|
||||||
|
|
||||||
return { title, content };
|
return { title, content };
|
||||||
}
|
};
|
||||||
|
|
||||||
supported_formats.set("adoc", adoc_fn)
|
supported_formats.set('adoc', adoc_fn);
|
||||||
supported_formats.set("asciidoc", adoc_fn)
|
supported_formats.set('asciidoc', adoc_fn);
|
||||||
|
|
||||||
const supported_filetypes = [...supported_formats.keys()];
|
const supported_filetypes = [...supported_formats.keys()];
|
||||||
|
|
||||||
let docs_folder = process.env.REVANCED_DOCS_FOLDER;
|
let docs_folder = process.env.REVANCED_DOCS_FOLDER;
|
||||||
if (docs_folder === undefined) {
|
if (docs_folder === undefined) {
|
||||||
if (prerendering) { console.warn("Using testing docs in production build") }
|
if (building) {
|
||||||
docs_folder = "testing-docs";
|
console.warn('Using testing docs in production build');
|
||||||
|
}
|
||||||
|
docs_folder = 'testing-docs';
|
||||||
}
|
}
|
||||||
|
|
||||||
const ignored_items = ["assets"];
|
const ignored_items = ['assets'];
|
||||||
|
|
||||||
/// Utility functions
|
/// Utility functions
|
||||||
|
|
||||||
function is_directory(item: string) {
|
function is_directory(item: string) {
|
||||||
return fs.lstatSync(item).isDirectory();
|
return fs.lstatSync(item).isDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_ext(fname: string) {
|
function get_ext(fname: string) {
|
||||||
// Get extname and remove the first dot.
|
// Get extname and remove the first dot.
|
||||||
return path.extname(fname).substring(1);
|
return path.extname(fname).substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_slug_of_node(node: DocsTreeNode): string {
|
function get_slug_of_node(node: DocsTreeNode): string {
|
||||||
if (is_tree(node)) {
|
if (is_tree(node)) {
|
||||||
return node.index.slug;
|
return node.index.slug;
|
||||||
}
|
}
|
||||||
|
|
||||||
return node.slug;
|
return node.slug;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Important functions
|
/// Important functions
|
||||||
|
|
||||||
// Get a document. Returns null if it does not exist.
|
// Get a document. Returns null if it does not exist.
|
||||||
export function get(slug: string): Document|null {
|
export function get(slug: string): Document | null {
|
||||||
let target = path.join(docs_folder, slug);
|
let target = path.join(docs_folder, slug);
|
||||||
// Handle index (readme) file for folder.
|
// Handle index (readme) file for folder.
|
||||||
if (exists(target) && is_directory(target)) {
|
if (exists(target) && is_directory(target)) {
|
||||||
target += "/README";
|
target += '/README';
|
||||||
}
|
}
|
||||||
|
|
||||||
const dir = path.dirname(target);
|
const dir = path.dirname(target);
|
||||||
if (!exists(dir)) {
|
if (!exists(dir)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let full_path, ext, found = false;
|
let full_path,
|
||||||
// We are looking for the file `${target}.(any_supported_extension)`. Try to find it.
|
ext,
|
||||||
for (const item of fs.readdirSync(dir)) {
|
found = false;
|
||||||
full_path = path.join(dir, item);
|
// We are looking for the file `${target}.(any_supported_extension)`. Try to find it.
|
||||||
// Get file extension
|
for (const item of fs.readdirSync(dir)) {
|
||||||
ext = get_ext(item);
|
full_path = path.join(dir, item);
|
||||||
|
// Get file extension
|
||||||
|
ext = get_ext(item);
|
||||||
|
|
||||||
// Unsupported/unrelated file.
|
// Unsupported/unrelated file.
|
||||||
if (!supported_formats.has(ext)) {
|
if (!supported_formats.has(ext)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const desired_path = `${target}.${ext}`; // Don't grab some other random supported file.
|
const desired_path = `${target}.${ext}`; // Don't grab some other random supported file.
|
||||||
if (!is_directory(full_path) && desired_path == full_path) {
|
if (!is_directory(full_path) && desired_path == full_path) {
|
||||||
// We found it.
|
// We found it.
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process the file and return.
|
// Process the file and return.
|
||||||
return supported_formats.get(ext)(fs.readFileSync(full_path, 'utf-8'));
|
return supported_formats.get(ext)(fs.readFileSync(full_path, 'utf-8'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get file information
|
// Get file information
|
||||||
function process_file(fname: string): DocumentInfo {
|
function process_file(fname: string): DocumentInfo {
|
||||||
// Remove docs folder prefix and file extension suffix, then split it.
|
// Remove docs folder prefix and file extension suffix, then split it.
|
||||||
const parts = fname
|
const parts = fname
|
||||||
.substring(`${docs_folder}/`.length, fname.length - (get_ext(fname).length + 1))
|
.substring(`${docs_folder}/`.length, fname.length - (get_ext(fname).length + 1))
|
||||||
.split("/");
|
.split('/');
|
||||||
|
|
||||||
// Remove `README` suffix if present.
|
// Remove `README` suffix if present.
|
||||||
const last_part_index = parts.length - 1;
|
const last_part_index = parts.length - 1;
|
||||||
if (parts[last_part_index] == "README") {
|
if (parts[last_part_index] == 'README') {
|
||||||
parts.pop();
|
parts.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
const slug = parts.join("/");
|
const slug = parts.join('/');
|
||||||
const title = get(slug).title;
|
const title = get(slug).title;
|
||||||
|
|
||||||
return { slug, title };
|
return { slug, title };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a document tree.
|
// Returns a document tree.
|
||||||
function process_folder(dir: string): DocsTree|null {
|
function process_folder(dir: string): DocsTree | null {
|
||||||
let tree: DocsTree = {
|
let tree: DocsTree = {
|
||||||
index: null,
|
index: null,
|
||||||
nodes: []
|
nodes: []
|
||||||
};
|
};
|
||||||
|
|
||||||
// List everything in the directory.
|
// List everything in the directory.
|
||||||
const items = fs.readdirSync(dir);
|
const items = fs.readdirSync(dir);
|
||||||
|
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
if (ignored_items.includes(item) || [".", "_"].includes(item[0])) {
|
if (ignored_items.includes(item) || ['.', '_'].includes(item[0])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const itemPath = path.join(dir, item);
|
const itemPath = path.join(dir, item);
|
||||||
|
|
||||||
const is_dir = is_directory(itemPath);
|
const is_dir = is_directory(itemPath);
|
||||||
let is_index_file = false;
|
let is_index_file = false;
|
||||||
|
|
||||||
if (!is_dir) {
|
if (!is_dir) {
|
||||||
// Ignore files we cannot process.
|
// Ignore files we cannot process.
|
||||||
if (!supported_formats.has(get_ext(item))) {
|
if (!supported_formats.has(get_ext(item))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const ext of supported_filetypes) {
|
for (const ext of supported_filetypes) {
|
||||||
if (item == `README.${ext}`) {
|
if (item == `README.${ext}`) {
|
||||||
is_index_file = true;
|
is_index_file = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const node = is_dir ? process_folder(itemPath) : process_file(itemPath);
|
const node = is_dir ? process_folder(itemPath) : process_file(itemPath);
|
||||||
if (node === null) {
|
if (node === null) {
|
||||||
console.error(`The ${itemPath} directory does not have a README/index file! ignoring...`)
|
console.error(`The ${itemPath} directory does not have a README/index file! ignoring...`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_index_file) {
|
if (is_index_file) {
|
||||||
tree.index = node;
|
tree.index = node;
|
||||||
} else {
|
} else {
|
||||||
tree.nodes.push(node);
|
tree.nodes.push(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tree.index === null) {
|
if (tree.index === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// `numeric: true` because we want to be able to specify
|
// `numeric: true` because we want to be able to specify
|
||||||
// the order if necessary by prepending a number to the file name.
|
// the order if necessary by prepending a number to the file name.
|
||||||
tree.nodes.sort(
|
tree.nodes.sort((a, b) =>
|
||||||
(a, b) => get_slug_of_node(a).localeCompare(get_slug_of_node(b), "en", { numeric: true })
|
get_slug_of_node(a).localeCompare(get_slug_of_node(b), 'en', { numeric: true })
|
||||||
);
|
);
|
||||||
|
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the document tree.
|
// Returns the document tree.
|
||||||
export function index_content(): DocsTree {
|
export function index_content(): DocsTree {
|
||||||
const tree = process_folder(docs_folder);
|
const tree = process_folder(docs_folder);
|
||||||
if (tree === null) {
|
if (tree === null) {
|
||||||
throw new Error("Root must have index (README) file.")
|
throw new Error('Root must have index (README) file.');
|
||||||
}
|
}
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
import adapter from '@sveltejs/adapter-static';
|
import adapter from '@sveltejs/adapter-static';
|
||||||
import preprocess from 'svelte-preprocess';
|
import { vitePreprocess } from '@sveltejs/kit/vite';
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Config} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
// Consult https://github.com/sveltejs/svelte-preprocess
|
preprocess: [vitePreprocess()],
|
||||||
// for more information about preprocessors
|
|
||||||
preprocess: preprocess(),
|
|
||||||
|
|
||||||
kit: {
|
kit: {
|
||||||
// adapter-static has vercel detection, but that does not let you set a custom 404 page easily.
|
// adapter-static has vercel detection, but that does not let you set a custom 404 page easily.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user