From: self Date: Mon, 10 Jul 2023 08:40:54 +0000 (-0700) Subject: update lemmy to 0.18.1 X-Git-Url: http://these/git/readmes/%24%7B%60data:application/%7B%60%24%7BghostArchiveUrl%7D/search?a=commitdiff_plain;h=7328836fa913633cd48dc93a2862e035c600d332;p=awful.systems.git update lemmy to 0.18.1 --- diff --git a/lemmy/disable-sharp.patch b/lemmy/disable-sharp.patch deleted file mode 100644 index 13d77a6..0000000 --- a/lemmy/disable-sharp.patch +++ /dev/null @@ -1,96 +0,0 @@ -diff --git a/package.json b/package.json -index 01f5100..54016b6 100644 ---- a/package.json -+++ b/package.json -@@ -85,7 +85,6 @@ - "sass-loader": "^13.2.2", - "serialize-javascript": "^6.0.1", - "service-worker-webpack": "^1.0.0", -- "sharp": "^0.32.1", - "tippy.js": "^6.3.7", - "toastify-js": "^1.12.0", - "tributejs": "^5.1.3", -diff --git a/src/server/utils/create-ssr-html.tsx b/src/server/utils/create-ssr-html.tsx -index 1377598..452e0c8 100644 ---- a/src/server/utils/create-ssr-html.tsx -+++ b/src/server/utils/create-ssr-html.tsx -@@ -1,7 +1,6 @@ - import { Helmet } from "inferno-helmet"; - import { renderToString } from "inferno-server"; - import serialize from "serialize-javascript"; --import sharp from "sharp"; - import { favIconPngUrl, favIconUrl } from "../../shared/config"; - import { ILemmyConfig, IsoDataOptionalSite } from "../../shared/interfaces"; - import { buildThemeList } from "./build-themes-list"; -@@ -9,7 +8,6 @@ import { fetchIconPng } from "./fetch-icon-png"; - - const customHtmlHeader = process.env["LEMMY_UI_CUSTOM_HTML_HEADER"] || ""; - --let appleTouchIcon: string | undefined = undefined; - - export async function createSsrHtml( - root: string, -@@ -21,25 +19,6 @@ export async function createSsrHtml( - (await buildThemeList())[0] - }.css" />`; - -- if (!appleTouchIcon) { -- appleTouchIcon = site?.site_view.site.icon -- ? `data:image/png;base64,${sharp( -- await fetchIconPng(site.site_view.site.icon) -- ) -- .resize(180, 180) -- .extend({ -- bottom: 20, -- top: 20, -- left: 20, -- right: 20, -- background: "#222222", -- }) -- .png() -- .toBuffer() -- .then(buf => buf.toString("base64"))}` -- : favIconPngUrl; -- } -- - const erudaStr = - process.env["LEMMY_UI_DEBUG"] === "true" - ? renderToString( -@@ -83,9 +62,7 @@ export async function createSsrHtml( - - - -- -- -- -+ - - - -diff --git a/src/server/utils/generate-manifest-json.ts b/src/server/utils/generate-manifest-json.ts -index 2f9d8b8..245ad4f 100644 ---- a/src/server/utils/generate-manifest-json.ts -+++ b/src/server/utils/generate-manifest-json.ts -@@ -2,7 +2,6 @@ import { getHttpBaseExternal } from "@utils/env"; - import { readFile } from "fs/promises"; - import { GetSiteResponse } from "lemmy-js-client"; - import path from "path"; --import sharp from "sharp"; - import { fetchIconPng } from "./fetch-icon-png"; - - const iconSizes = [72, 96, 128, 144, 152, 192, 384, 512]; -@@ -40,14 +39,6 @@ export default async function ({ - path.join(defaultLogoPathDirectory, `icon-${size}x${size}.png`) - ).then(buf => buf.toString("base64")); - -- if (icon) { -- src = await sharp(icon) -- .resize(size, size) -- .png() -- .toBuffer() -- .then(buf => buf.toString("base64")); -- } -- - return { - sizes: `${size}x${size}`, - type: "image/png", diff --git a/lemmy/package.json b/lemmy/package.json index 45d4daf..40d2eb2 100644 --- a/lemmy/package.json +++ b/lemmy/package.json @@ -1,20 +1,20 @@ { "name": "lemmy-ui", - "version": "0.18.0", + "version": "0.18.1", "description": "An isomorphic UI for lemmy", "repository": "https://github.com/LemmyNet/lemmy-ui", "license": "AGPL-3.0", "author": "Dessalines ", "scripts": { + "analyze": "webpack --mode=none", "prebuild:dev": "yarn clean && node generate_translations.js", - "build:dev": "webpack --mode=development", + "build:dev": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=development", "prebuild:prod": "yarn clean && node generate_translations.js", - "build:prod": "webpack --mode=production", + "build:prod": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=production", "clean": "yarn run rimraf dist", - "dev": "yarn start", + "dev": "yarn build:dev --watch", "lint": "yarn translations:generate && tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx \"src/**\" && prettier --check \"src/**/*.{ts,tsx,js,css,scss}\"", "prepare": "husky install", - "start": "yarn build:dev --watch", "themes:build": "sass src/assets/css/themes/:src/assets/css/themes", "themes:watch": "sass --watch src/assets/css/themes/:src/assets/css/themes", "translations:generate": "node generate_translations.js", @@ -48,9 +48,11 @@ "check-password-strength": "^2.0.7", "classnames": "^2.3.1", "clean-webpack-plugin": "^4.0.0", + "cookie": "^0.5.0", "copy-webpack-plugin": "^11.0.0", "cross-fetch": "^3.1.5", "css-loader": "^6.7.3", + "date-fns": "^2.30.0", "emoji-mart": "^5.4.0", "emoji-short-name": "^2.0.0", "express": "~4.18.2", @@ -64,19 +66,19 @@ "inferno-i18next-dess": "0.0.2", "inferno-router": "^8.1.1", "inferno-server": "^8.1.1", - "isomorphic-cookie": "^1.2.4", "jwt-decode": "^3.1.2", "lemmy-js-client": "0.18.0-rc.2", - "lodash": "^4.17.21", + "lodash.isequal": "^4.5.0", + "lodash.merge": "^4.6.2", "markdown-it": "^13.0.1", "markdown-it-container": "^3.0.0", "markdown-it-emoji": "^2.0.2", "markdown-it-footnote": "^3.0.3", "markdown-it-html5-embed": "^1.0.0", + "markdown-it-ruby": "^0.1.1", "markdown-it-sub": "^1.0.0", "markdown-it-sup": "^1.0.0", "mini-css-extract-plugin": "^2.7.5", - "moment": "^2.29.4", "register-service-worker": "^1.7.2", "run-node-webpack-plugin": "^1.3.0", "sanitize-html": "^2.10.0", @@ -96,11 +98,14 @@ "@babel/core": "^7.21.8", "@types/autosize": "^4.0.0", "@types/bootstrap": "^5.2.6", + "@types/cookie": "^0.5.1", "@types/express": "^4.17.17", "@types/html-to-text": "^9.0.0", + "@types/lodash.isequal": "^4.5.6", "@types/markdown-it": "^12.2.3", "@types/markdown-it-container": "^2.0.5", "@types/node": "^20.1.2", + "@types/path-browserify": "^1.0.0", "@types/sanitize-html": "^2.9.0", "@types/serialize-javascript": "^5.0.1", "@types/toastify-js": "^1.11.1", @@ -122,6 +127,8 @@ "style-loader": "^3.3.2", "terser": "^5.17.3", "typescript": "^5.0.4", + "typescript-language-server": "^3.3.2", + "webpack-bundle-analyzer": "^4.9.0", "webpack-dev-server": "4.15.0" }, "packageManager": "yarn@1.22.19", diff --git a/lemmy/pin.json b/lemmy/pin.json index 8522dbb..85fef5a 100644 --- a/lemmy/pin.json +++ b/lemmy/pin.json @@ -1,7 +1,7 @@ { - "version": "0.18.0", - "serverSha256": "sha256-KzEelj2/+wfp570Vw1+FoqiYZd1PxELTdopGSeel97E=", - "serverCargoSha256": "sha256-p1ZytuaXouKFkKjsEsaNjndoioTSVVM2pf72qE8/qyM=", - "uiSha256": "sha256-pB6uEL9gDwvsi+FbooKBhTCJ+Qmc6Vl2bBTMiL1hUJI=", - "uiYarnDepsSha256": "sha256-NtluS6Cr39L9nGwNA17c7xsM5xoJraS02a7sp7r9KPI=" + "version": "0.18.1", + "serverSha256": "sha256-jYbrbIRyXo2G113ReG32oZ56ed2FEB/ZBcqYAxoxzGQ=", + "serverCargoSha256": "sha256-7DNMNPSjzYY45DlR6Eo2q6QdwrMrRb51cFOnXfOuub0=", + "uiSha256": "sha256-tc7fGA4okIv+3kq5t6I+EN+owdekCgAdk0EtkDgodIU=", + "uiYarnDepsSha256": "sha256-/T1PQ0XsGY82/RlLq94hJgv8Yx1bIf2gcklhgtPu1RM=" } diff --git a/lemmy/server.nix b/lemmy/server.nix index 9fcf594..890cc59 100644 --- a/lemmy/server.nix +++ b/lemmy/server.nix @@ -15,15 +15,15 @@ in rustPlatform.buildRustPackage rec { fetchSubmodules = true; }; + preConfigure = '' + echo "pub const VERSION: &str = \"${version}\";" > "crates/utils/src/version.rs" + ''; + cargoSha256 = pinData.serverCargoSha256; buildInputs = [ postgresql ] ++ lib.optionals stdenv.isDarwin [ libiconv Security ]; - postPatch = '' - echo "pub const VERSION: &str = \"${version}\";" > "crates/utils/src/version.rs" - ''; - # Using OPENSSL_NO_VENDOR is not an option on darwin # As of version 0.10.35 rust-openssl looks for openssl on darwin # with a hardcoded path to /usr/lib/libssl.x.x.x.dylib diff --git a/lemmy/sharp.nix b/lemmy/sharp.nix deleted file mode 100644 index 353890b..0000000 --- a/lemmy/sharp.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ lib, buildNpmPackage, fetchFromGitHub }: - -buildNpmPackage rec { - pname = "sharp"; - version = "0.32.1"; - - src = fetchFromGitHub { - owner = "lovell"; - repo = "sharp"; - rev = "v${version}"; - hash = "sha256-bpReMsKXK7/fivLsk6QyHTBX9LL2WbxXdDBrTV5luWo="; - }; - - npmDepsHash = "sha256-p1ZytuaXouKFkKjsEsaNjndo1oTSVVM2pf12qE8/q1M="; - - npmPackFlags = [ "--ignore-scripts" ]; - - NODE_OPTIONS = "--openssl-legacy-provider"; -} diff --git a/lemmy/ui.nix b/lemmy/ui.nix index fe2e4ab..63551c3 100644 --- a/lemmy/ui.nix +++ b/lemmy/ui.nix @@ -1,5 +1,5 @@ { lib, mkYarnPackage, libsass, nodejs, python3, pkg-config, fetchFromGitHub -, fetchYarnDeps, nixosTests }: +, fetchYarnDeps, nixosTests, vips, nodePackages }: let pinData = lib.importJSON ./pin.json; @@ -13,6 +13,13 @@ let rm build/config.gypi ''; }; + sharp = { + nativeBuildInputs = [ pkg-config nodePackages.semver ]; + buildInputs = [ vips ]; + postInstall = '' + yarn --offline run install + ''; + }; }; name = "lemmy-ui"; @@ -26,10 +33,9 @@ let sha256 = pinData.uiSha256; }; - patches = [ ./disable-sharp.patch ]; in mkYarnPackage { - inherit src pkgConfig name version patches; + inherit src pkgConfig name version; extraBuildInputs = [ libsass ]; diff --git a/lemmy/update.sh b/lemmy/update.sh deleted file mode 100755 index 61dd05a..0000000 --- a/lemmy/update.sh +++ /dev/null @@ -1,51 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell -i oil -p oil jq sd nix-prefetch-github ripgrep moreutils - -# TODO set to `verbose` or `extdebug` once implemented in oil -shopt --set xtrace -# we need failures inside of command subs to get the correct dependency sha256 -shopt --unset inherit_errexit - -const directory = $(dirname $0 | xargs realpath) -const owner = "LemmyNet" -const ui_repo = "lemmy-ui" -const server_repo = "lemmy" -const latest_rev = $(curl -q https://api.github.com/repos/${owner}/${server_repo}/releases/latest | \ - jq -r '.tag_name') -const latest_version = $(echo $latest_rev) -const current_version = $(jq -r '.version' $directory/pin.json) -echo "latest version: $latest_version, current version: $current_version" -if ("$latest_version" === "$current_version") { - echo "lemmy is already up-to-date" - return 0 -} else { - # for some strange reason, hydra fails on reading upstream package.json directly - const source = "https://raw.githubusercontent.com/$owner/$ui_repo/$latest_version" - const package_json = $(curl -qf $source/package.json) - echo $package_json > $directory/package.json - - const server_tarball_meta = $(nix-prefetch-github $owner $server_repo --rev $latest_rev --fetch-submodules) - const server_tarball_hash = "sha256-$(echo $server_tarball_meta | jq -r '.sha256')" - const ui_tarball_meta = $(nix-prefetch-github $owner $ui_repo --rev $latest_rev --fetch-submodules) - const ui_tarball_hash = "sha256-$(echo $ui_tarball_meta | jq -r '.sha256')" - - jq ".version = \"$latest_version\" | \ - .\"serverSha256\" = \"$server_tarball_hash\" | \ - .\"uiSha256\" = \"$ui_tarball_hash\" | \ - .\"serverCargoSha256\" = \"\" | \ - .\"uiYarnDepsSha256\" = \"\"" $directory/pin.json | sponge $directory/pin.json - - const new_cargo_sha256 = $(nix-build $directory/../../../.. -A lemmy-server 2>&1 | \ - tail -n 2 | \ - head -n 1 | \ - sd '\s+got:\s+' '') - - const new_offline_cache_sha256 = $(nix-build $directory/../../../.. -A lemmy-ui 2>&1 | \ - tail -n 2 | \ - head -n 1 | \ - sd '\s+got:\s+' '') - - jq ".\"serverCargoSha256\" = \"$new_cargo_sha256\" | \ - .\"uiYarnDepsSha256\" = \"$new_offline_cache_sha256\"" \ - $directory/pin.json | sponge $directory/pin.json -}