removed bloat and updated packages

This commit is contained in:
Philip Ahlqvist 2025-04-21 04:10:38 +02:00
parent 15ff3bd393
commit ac51344f5b
12 changed files with 432 additions and 7551 deletions

View file

@ -3,14 +3,14 @@
"@babel/env"
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-export-namespace-from",
"@babel/proposal-function-sent",
"@babel/proposal-json-strings",
"@babel/proposal-numeric-separator",
"@babel/proposal-throw-expressions",
"@babel/syntax-dynamic-import",
"@babel/syntax-import-meta"
// "@babel/proposal-class-properties",
// "@babel/proposal-export-namespace-from",
// "@babel/proposal-function-sent",
// "@babel/proposal-json-strings",
// "@babel/proposal-numeric-separator",
// "@babel/proposal-throw-expressions",
// "@babel/syntax-dynamic-import",
// "@babel/syntax-import-meta"
],
"ignore": [
"app/dist/*.js"

View file

@ -1,5 +1,5 @@
language: node_js
node_js:
- "10.2"
- "22"
before_install:
- npm i -g npm@latest

View file

@ -4,10 +4,9 @@
// I M P O R T S
import decamelize from "decamelize";
import exists from "fs-exists-sync";
// import decamelize from "decamelize";
import fs from "fs";
import fm from "front-matter";
import fs from "graceful-fs";
import html from "choo/html";
import m from "markdown-it";
import markdownAnchor from "markdown-it-anchor";
@ -65,10 +64,10 @@ function partialFinder(markdownBody) {
if (partials) {
for (const partial of partials) {
const filename = decamelize(partial, "-").replace("<", "")
const filename = decamelize(partial).replace("<", "")
.replace("/>", "")
.trim();
const fileExistsTest = exists(`./app/components/${filename}.js`);
const fileExistsTest = fs.existsSync(`./app/components/${filename}.js`);
if (!fileExistsTest)
markdownBody = markdownBody.replace(partial, "");
@ -95,3 +94,13 @@ function wikiFinder(markdownBody) {
match.input;
});
}
function decamelize(str) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
return str
.replace(/([a-z])([A-Z])/g, '$1-$2')
.replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')
.toLowerCase();
}

View file

@ -4,7 +4,6 @@
// I M P O R T S
import dedent from "dedent";
import html from "choo/html";
import raw from "choo/html/raw";
@ -12,7 +11,7 @@ import raw from "choo/html/raw";
// E X P O R T
export default () => dedent`
export default () => html`
<section class="playground">
<ul class="playground-navigation">
${raw(navigation())}
@ -43,7 +42,7 @@ function example1() {
}
function navigation() {
return dedent`
return html`
<li
class="playground-navigation__example"
data-action="playground, example 1"

View file

@ -6,7 +6,6 @@
import prism from "prismjs";
import raw from "choo/html/raw";
import stringifyObject from "stringify-object";
// U T I L S
@ -140,7 +139,7 @@ export default async(data, socket) => {
delete memePublishResponse.result.lbrytech_claim_name;
const renderedCode = prism.highlight(
stringifyObject(memePublishResponse, { indent: " ", singleQuotes: false }),
JSON.stringify(memePublishResponse, null, 2),
prism.languages.json,
"json"
);
@ -186,7 +185,7 @@ export default async(data, socket) => {
if (socket) {
const renderedCode = prism.highlight(
stringifyObject(resolveResponse, { indent: " ", singleQuotes: false }),
JSON.stringify(resolveResponse, null, 2),
prism.languages.json,
"json"
);
@ -245,7 +244,7 @@ export default async(data, socket) => {
if (socket) {
const renderedCode = prism.highlight(
stringifyObject(response.body, { indent: " ", singleQuotes: false }),
JSON.stringify(response.body, null, 2),
prism.languages.json,
"json"
);

View file

@ -1,90 +1,81 @@
"use strict";
const request = require("request");
const addSupport = function () { };
const publish = function () { };
const addSupport = function() {};
const publish = function() {};
const resolve = function(urls) {
return new Promise(function(resolve, reject) {
const resolve = function (urls) {
return new Promise(async (resolve, reject) => {
const options = {
method: "POST",
url: "https://api.na-backend.odysee.com/api/v1/proxy",
headers:
{
"Content-Type": "application/json"
},
body: {
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
method: "resolve",
params: { urls: urls }
},
json: true
})
};
request(options, function(error, response, daemonResponse) {
if (error) {
return reject(new Error("DAEMON ERROR: resolve"));
}
const response = await fetch("https://api.na-backend.odysee.com/api/v1/proxy", options);
let json;
if (!response.ok) return reject(new Error("DAEMON ERROR: resolve"));
if (Object.prototype.hasOwnProperty.call(daemonResponse, "error")) {
return reject(new Error("DAEMON ERROR: resolve"));
} else
return resolve(daemonResponse.result);
});
try {
json = await response.json();
} catch (err) {
return reject(new Error("DAEMON ERROR: resolve"));
}
return resolve(json.result);
});
};
const getTrending = function() {
return new Promise(function(resolve, reject) {
const getTrending = function () {
return new Promise(async (resolve, reject) => {
const options = {
method: "POST",
url: "https://api.na-backend.odysee.com/api/v1/proxy",
headers:
{
"Content-Type": "application/json"
},
body:
{
method: "claim_search",
params:
{
page_size: 20,
page: 1,
no_totals: true,
any_tags:
["art",
"automotive",
"blockchain",
"comedy",
"economics",
"education",
"gaming",
"music",
"news",
"science",
"sports",
"technology"],
channel_ids: [],
not_channel_ids: [],
not_tags: ["porn", "porno", "nsfw", "mature", "xxx", "sex", "creampie", "blowjob", "handjob", "vagina", "boobs", "big boobs", "big dick", "pussy", "cumshot", "anal", "hard fucking", "ass", "fuck", "hentai"],
order_by: ["trending_group", "trending_mixed"]
}
},
json: true
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
method: "claim_search",
params: {
page_size: 20,
page: 1,
no_totals: true,
any_tags:
["art",
"automotive",
"blockchain",
"comedy",
"economics",
"education",
"gaming",
"music",
"news",
"science",
"sports",
"technology"],
channel_ids: [],
not_channel_ids: [],
not_tags: ["porn", "porno", "nsfw", "mature", "xxx", "sex", "creampie", "blowjob", "handjob", "vagina", "boobs", "big boobs", "big dick", "pussy", "cumshot", "anal", "hard fucking", "ass", "fuck", "hentai"],
order_by: ["trending_group", "trending_mixed"]
}
})
};
request(options, function(error, response, daemonResponse) {
if (error) {
return reject(new Error("DAEMON ERROR: trending"));
}
const response = await fetch("https://api.na-backend.odysee.com/api/v1/proxy", options);
let json;
if (!response.ok) return reject(new Error("DAEMON ERROR: resolve"));
if (Object.prototype.hasOwnProperty.call(daemonResponse, "error")) {
return reject(JSON.stringify(daemonResponse));
} else
return resolve(daemonResponse.result.items);
});
try {
json = await response.json();
} catch (err) {
return reject(new Error("DAEMON ERROR: resolve"));
}
return resolve(json.result.items);
});
};

View file

@ -4,7 +4,6 @@
// P A C K A G E S
import * as color from "colorette";
import compress from "fastify-compress";
import fastify from "fastify";
import ssr from "choo-ssr/fastify";
@ -62,5 +61,5 @@ server
// B E G I N
server.listen(process.env.PORT || 8080, process.env.IP || "0.0.0.0", async() => {
process.stdout.write(`\n${color.green("⚡")} ${server.server.address().port}\n`)
process.stdout.write(`\n ${server.server.address().port}\n`);
});

View file

@ -1,6 +1,6 @@
@charset "utf-8";
@import "@lbry/components/sass/";
@import "@lbry/components/sass/index";
@import "init/markdown";
@import "init/extends";

View file

@ -5,7 +5,6 @@
// I M P O R T S
import asyncHtml from "choo-async/html";
import dedent from "dedent";
// U T I L S
@ -401,3 +400,24 @@ function renderCodeLanguageToggles(pageSlug) {
onSdkPage ? "<button class='api-content__item' id='toggle-python' type='button'>python</button>" : ""
];
}
function dedent(string) {
// Split into lines
const lines = string.split('\n');
if (lines[0].trim() === '') lines.shift();
if (lines.length > 0 && lines[lines.length - 1].trim() === '') lines.pop();
const indents = lines
.slice(1)
.filter(line => line.trim() !== '')
.map(line => line.match(/^\s*/)[0].length);
const minIndent = indents.length > 0 ? Math.min(...indents) : 0;
return lines.map(line => {
const leadingWhitespace = line.match(/^\s*/)[0];
if (leadingWhitespace.length >= minIndent) {
return line.slice(minIndent);
}
return line;
}).join('\n');
}

View file

@ -6,7 +6,6 @@
// require('module-alias/register')
require("@babel/register");
require("@babel/polyfill");
require("date-format-lite");
require("dotenv").config();

7713
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,66 +1,37 @@
{
"author": "LBRY Team",
"dependencies": {
"@babel/polyfill": "^7.4.4",
"async": "^3.1.0",
"async-es": "^3.1.0",
"choo": "6.13.3",
"choo-async": "^0.1.1",
"choo-devtools": "^3.0.0",
"choo-ssr": "^0.2.1",
"choo-websocket": "^2.0.0",
"colorette": "^1.1.0",
"date-format-lite": "^17.7.0",
"decamelize": "^3.2.0",
"dedent": "^0.7.0",
"dotenv": "^8.0.0",
"dotenv": "^8.6.0",
"fastify": "~2.7.1",
"fastify-compress": "^0.10.0",
"fastify-static": "^2.5.0",
"fastify-ws": "^1.0.3",
"front-matter": "^3.0.2",
"fs-exists-sync": "^0.1.0",
"graceful-fs": "^4.2.1",
"link-module-alias": "^1.2.0",
"make-promises-safe": "^5.0.0",
"markdown-it": "^9.0.1",
"markdown-it-anchor": "^5.2.4",
"module-alias": "^2.2.3",
"prismjs": "^1.17.1",
"redis": "^2.8.0",
"request": "latest",
"socket.io": "^2.2.0",
"stringify-object": "^3.3.0"
"front-matter": "^4.0.2",
"markdown-it": "^14.1.0",
"markdown-it-anchor": "^9.2.0",
"pino-pretty": "^3.2.0",
"prismjs": "^1.30.0",
"socket.io": "^4.8.1"
},
"description": "Documentation for the LBRY protocol and associated projects",
"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/plugin-external-helpers": "7.2.0",
"@babel/plugin-proposal-class-properties": "7.5.5",
"@babel/plugin-proposal-decorators": "7.4.4",
"@babel/plugin-proposal-export-namespace-from": "7.5.2",
"@babel/plugin-proposal-function-sent": "7.5.0",
"@babel/plugin-proposal-json-strings": "7.2.0",
"@babel/plugin-proposal-numeric-separator": "7.2.0",
"@babel/plugin-proposal-throw-expressions": "7.2.0",
"@babel/plugin-syntax-dynamic-import": "7.2.0",
"@babel/plugin-syntax-import-meta": "7.2.0",
"@babel/preset-env": "^7.5.5",
"@babel/register": "^7.5.5",
"@lbry/color": "^1.1.1",
"@babel/cli": "^7.27.0",
"@babel/core": "^7.26.10",
"@babel/preset-env": "^7.26.9",
"@babel/register": "^7.25.9",
"@lbry/components": "^2019.6.22",
"@springernature/sasslint-config": "^1.2.1",
"eslint": "^6.1.0",
"eslint-config": "^0.3.0",
"eslint-config": "^0.2.1",
"husky": "^3.0.2",
"nodemon": "^1.19.1",
"npm-run-all": "^4.1.5",
"pino-pretty": "^3.2.0",
"sass": "^1.22.9",
"sass-lint": "^1.13.1",
"standardx": "^4.0.0",
"updates": "^8.5.1"
"sass-lint": "^1.13.1"
},
"husky": {
"hooks": {
@ -74,18 +45,13 @@
"css": "sass --load-path=node_modules --update app/sass:app/dist --style compressed",
"format": "eslint . --fix --ignore-pattern '/app/dist/'",
"start": "npm i && npm run css && NODE_ENV=production node index.js",
"test": "run-s test:*",
"test": "npm run test:dependencies & npm run test:lint & npm run test:sass",
"test:dependencies": "updates --update ./ --exclude prismjs",
"test:lint": "standardx --verbose | snazzy",
"test:sass": "sass-lint --config ./node_modules/@inc/sasslint-config/config.json --verbose --no-exit",
"watch": "npm run css && run-p watch:*",
"watch": "npm run css && npm run watch:server & npm run watch:sass",
"watch:sass": "sass --load-path=node_modules --watch app/sass:app/dist --style compressed",
"watch:server": "NODE_ENV=development nodemon --ignore 'app/dist'"
},
"standardx": {
"ignore": [
"app/dist"
]
"watch:server": "NODE_ENV=development node --watch index.js"
},
"version": "6.0.0"
}