From c2a5e05334add4a3b5b0a3a26086339662671d89 Mon Sep 17 00:00:00 2001 From: Rory& Date: Sun, 15 Sep 2024 22:52:35 +0000 Subject: [PATCH] fixup! draupnir: init at 2.0.0-beta.6 - ugly sed hack to drop corepack Fixes build with corepack upstream introduced by https://github.com/the-draupnir-project/Draupnir/pull/472 Upstream may move to yarn v4, need to investigate options. (https://github.com/the-draupnir-project/Draupnir/issues/475) Looks like the recommended option is to use a fixed-output derivation? Sources: - https://www.reddit.com/r/NixOS/comments/1f8tq94/its_2024_has_anyone_figured_out_how_to_build_a/ - https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/cluster/tilt/assets.nix --- pkgs/by-name/dr/draupnir/hashes.json | 2 +- pkgs/by-name/dr/draupnir/package.json | 53 +++++++++++++++------------ pkgs/by-name/dr/draupnir/package.nix | 6 ++- 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/pkgs/by-name/dr/draupnir/hashes.json b/pkgs/by-name/dr/draupnir/hashes.json index f574d7ce11c786a..f8ec73c940a94ee 100644 --- a/pkgs/by-name/dr/draupnir/hashes.json +++ b/pkgs/by-name/dr/draupnir/hashes.json @@ -1,3 +1,3 @@ { - "yarn_offline_cache_hash": "sha256-ofF1TpybxXHuK1lXdiSY2FW4oXFLnME9EwJOMLWPKCw=" + "yarn_offline_cache_hash": "sha256-5h8d8LKE9RIWYckbEITkYBGj5MIfScrFZiVbJXZSf+8=" } diff --git a/pkgs/by-name/dr/draupnir/package.json b/pkgs/by-name/dr/draupnir/package.json index 52b80ca04b57bb1..0c73708386e022d 100644 --- a/pkgs/by-name/dr/draupnir/package.json +++ b/pkgs/by-name/dr/draupnir/package.json @@ -1,6 +1,6 @@ { "name": "draupnir", - "version": "2.0.0-beta.4", + "version": "2.0.0-beta.6", "description": "A moderation tool for Matrix", "main": "lib/index.js", "repository": "https://github.com/the-draupnir-project/Draupnir.git", @@ -9,62 +9,68 @@ "private": true, "scripts": { "build": "tsc --project test/tsconfig.json && tsc > /dev/null 2>&1", - "postbuild": "yarn describe-version", + "postbuild": "corepack yarn describe-version", "describe-version": "(git describe > version.txt.tmp && mv version.txt.tmp version.txt) || true && rm -f version.txt.tmp", "remove-tests-from-lib": "rm -rf lib/test/ && cp -r lib/src/* lib/ && rm -rf lib/src/", - "lint": "eslint -c .eslintrc.js src/**/*.ts test/**/*.ts src/**/*.tsx", - "start:dev": "yarn build && node --async-stack-traces lib/index.js", - "test": "ts-mocha --project ./tsconfig.json test/commands/**/*.ts", - "test:integration": "NODE_ENV=harness ts-mocha --async-stack-traces --forbid-only --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json \"test/integration/**/*Test.ts\"", - "test:integration:single": "NODE_ENV=harness npx ts-mocha --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json", - "test:appservice:integration": "NODE_ENV=harness ts-mocha --async-stack-traces --forbid-only --timeout 300000 --project ./tsconfig.json \"test/appservice/integration/**/*Test.ts\"", - "test:appservice:integration:single": "NODE_ENV=harness npx ts-mocha --timeout 300000 --project ./tsconfig.json", + "lint": "corepack yarn eslint src test && corepack yarn prettier --check src test", + "start:dev": "corepack yarn build && node --async-stack-traces lib/index.js", + "test:unit": "mocha --require './test/tsnode.cjs' --forbid-only 'test/unit/**/*.{ts,tsx}'", + "test:unit:single": "mocha --require test/tsnode.cjs", + "test:integration": "NODE_ENV=harness mocha --require test/tsnode.cjs --async-stack-traces --forbid-only --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json \"test/integration/**/*Test.ts\"", + "test:integration:single": "NODE_ENV=harness corepack yarn mocha --require test/tsnode.cjs --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json", + "test:appservice:integration": "NODE_ENV=harness mocha --require test/tsnode.cjs --async-stack-traces --forbid-only --timeout 300000 --project ./tsconfig.json \"test/appservice/integration/**/*Test.ts\"", + "test:appservice:integration:single": "NODE_ENV=harness corepack yarn mocha --require test/tsnode.cjs --timeout 300000 --project ./tsconfig.json", "test:manual": "NODE_ENV=harness ts-node test/integration/manualLaunchScript.ts", "version": "sed -i '/# version automated/s/[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][^\"]*/'$npm_package_version'/' synapse_antispam/setup.py && git add synapse_antispam/setup.py && cat synapse_antispam/setup.py" }, "devDependencies": { + "@eslint/js": "^9.7.0", "@types/better-sqlite3": "^7.6.9", "@types/config": "^3.3.1", "@types/crypto-js": "^4.2.2", + "@types/eslint__js": "^8.42.3", "@types/express": "^4.17.21", "@types/html-to-text": "^8.0.1", "@types/humanize-duration": "^3.27.1", "@types/js-yaml": "^4.0.9", "@types/jsdom": "21.1.6", - "@types/mocha": "^10.0.6", + "@types/mocha": "^10.0.7", "@types/nedb": "^1.8.16", - "@types/node": "^20.11.5", + "@types/node": "^20.14.11", "@types/pg": "^8.6.5", "@types/request": "^2.48.12", "@types/shell-quote": "1.7.1", - "@typescript-eslint/eslint-plugin": "^6.19.0", - "@typescript-eslint/parser": "^6.19.0", "crypto-js": "^4.2.0", - "eslint": "^8.56", - "eslint-plugin-editorconfig": "^4.0.3", + "eslint": "^9.7.0", "expect": "^29.7.0", - "mocha": "^10.2.0", - "ts-mocha": "^10.0.0", - "typescript": "^5.3.3", + "mocha": "^10.7.0", + "prettier": "^3.3.3", + "ts-auto-mock": "^3.7.4", + "ts-node": "^10.9.2", + "typescript": "^5.5.3", + "typescript-eslint": "^7.16.1", "typescript-formatter": "^7.2" }, "dependencies": { + "@gnuxie/typescript-result": "^1.0.0", "@sentry/node": "^7.17.2", "@sentry/tracing": "^7.17.2", - "@sinclair/typebox": "0.32.29", + "@sinclair/typebox": "0.32.34", + "@the-draupnir-project/interface-manager": "^2.3.0", + "@the-draupnir-project/matrix-basic-types": "^0.2.0", "await-lock": "^2.2.2", "better-sqlite3": "^9.4.3", "body-parser": "^1.20.2", "config": "^3.3.9", - "express": "^4.18", + "express": "^4.19", "html-to-text": "^8.0.0", "humanize-duration": "^3.27.1", "humanize-duration-ts": "^2.1.1", "js-yaml": "^4.1.0", "jsdom": "^24.0.0", "matrix-appservice-bridge": "^9.0.1", - "matrix-protection-suite": "npm:@gnuxie/matrix-protection-suite@0.22.0", - "matrix-protection-suite-for-matrix-bot-sdk": "npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@0.22.0", + "matrix-protection-suite": "npm:@gnuxie/matrix-protection-suite@1.3.0", + "matrix-protection-suite-for-matrix-bot-sdk": "npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@1.3.0", "parse-duration": "^1.0.2", "pg": "^8.8.0", "shell-quote": "^1.7.3", @@ -77,5 +83,6 @@ }, "engines": { "node": ">=18.0.0" - } + }, + "packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610" } diff --git a/pkgs/by-name/dr/draupnir/package.nix b/pkgs/by-name/dr/draupnir/package.nix index fb2faad56350e9e..c2987712bf6f59d 100644 --- a/pkgs/by-name/dr/draupnir/package.nix +++ b/pkgs/by-name/dr/draupnir/package.nix @@ -15,12 +15,12 @@ let in mkYarnPackage rec { pname = "draupnir"; - version = "2.0.0-beta.4"; + version = "2.0.0-beta.6"; src = fetchFromGitHub { owner = "the-draupnir-project"; repo = "Draupnir"; rev = "v${version}"; - hash = "sha256-ZbAst3XaTdJxCPsgPc8cAqN0lo6vOvFphqBDjduQ/to="; + hash = "sha256-s1LWXVwY+7LD7cJtZW7mBLsdpB499zS/nDsJ7qaQDfg="; }; nativeBuildInputs = [ @@ -45,6 +45,8 @@ in echo "Adding version.txt..." mkdir -p deps/draupnir/ echo "${version}-nix" > deps/draupnir/version.txt + + sed -i 's/corepack //g' deps/draupnir/package.json ''; buildPhase = ''