documenso: 1.12.6 -> 2.14.0

Assisted-by: OpenAI ChatGPT (GPT-5)
This commit is contained in:
mulatta
2026-07-08 00:18:31 +09:00
parent 478044ca25
commit 8d5dd8c60e
5 changed files with 466 additions and 878 deletions
File diff suppressed because it is too large Load Diff
+18 -37
View File
@@ -1,40 +1,21 @@
diff --git a/package.json b/package.json
index 1ff8701..e337979 100644
index d0ffcb2..9b47856 100644
--- a/package.json
+++ b/package.json
@@ -44,22 +44,22 @@
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@lingui/cli": "^5.2.0",
+ "@prisma/client": "^6.8.2",
"dotenv": "^16.5.0",
"dotenv-cli": "^8.0.0",
"eslint": "^8.40.0",
"eslint-config-custom": "*",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
+ "nodemailer": "^6.10.1",
"playwright": "1.52.0",
"prettier": "^3.3.3",
- "rimraf": "^5.0.1",
- "turbo": "^1.9.3",
- "vite": "^6.3.5",
- "@prisma/client": "^6.8.2",
"prisma": "^6.8.2",
"prisma-extension-kysely": "^3.0.0",
"prisma-kysely": "^1.8.0",
- "nodemailer": "^6.10.1"
+ "rimraf": "^5.0.1",
+ "turbo": "^2.5.8",
+ "vite": "^6.3.5"
},
"name": "@documenso/root",
"workspaces": [
@@ -71,7 +71,6 @@
"@documenso/prisma": "^0.0.0",
"@lingui/conf": "^5.2.0",
"@lingui/core": "^5.2.0",
- "inngest-cli": "^0.29.1",
"luxon": "^3.5.0",
"mupdf": "^1.0.0",
"react": "^18",
@@ -63,7 +63,6 @@
"dotenv-cli": "^11.0.0",
"husky": "^9.1.7",
"inngest": "^3.54.0",
- "inngest-cli": "^1.17.9",
"lint-staged": "^16.2.7",
"nanoid": "^5.1.6",
"nodemailer": "^8.0.5",
@@ -78,7 +77,7 @@
"rimraf": "^6.1.2",
"superjson": "^2.2.5",
"syncpack": "^14.0.0-alpha.27",
- "turbo": "^1.13.4",
+ "turbo": "^2.10.1",
"vite": "^7.2.4",
"vite-plugin-static-copy": "^3.1.4",
"zod-openapi": "^4.2.4",
+52 -5
View File
@@ -1,30 +1,53 @@
{
lib,
stdenv,
nodejs,
node-gyp,
node-pre-gyp,
pixman,
fetchFromGitHub,
fetchurl,
buildNpmPackage,
prisma_6,
prisma-engines_6,
vips,
pkg-config,
gzip,
autoPatchelfHook,
cairo,
pango,
bash,
openssl,
}:
let
skiaCanvasVersion = "3.0.8";
skiaCanvasTriplet =
{
x86_64-linux = "linux-x64-glibc";
aarch64-linux = "linux-arm64-glibc";
}
.${stdenv.hostPlatform.system}
or (throw "unsupported skia-canvas platform ${stdenv.hostPlatform.system}");
skiaCanvasPrebuild = fetchurl {
url = "https://github.com/samizdatco/skia-canvas/releases/download/v${skiaCanvasVersion}/${skiaCanvasTriplet}.gz";
hash =
{
x86_64-linux = "sha256-9FklKQWZ1LfLUhHBI/re4nvImddVZpbi4zPQ76xpN7I=";
aarch64-linux = "sha256-BmXQemDAXZEqL9FFmus3cU6wRFwveEhAdjhUbD0uGnA=";
}
.${stdenv.hostPlatform.system};
};
in
buildNpmPackage (finalAttrs: {
pname = "documenso";
version = "1.12.6";
version = "2.14.0";
src = fetchFromGitHub {
owner = "documenso";
repo = "documenso";
rev = "v${finalAttrs.version}";
hash = "sha256-1TKjsOKJkv3COFgsE4tPAymI0MdeT+T8HiNgnoWHlAY=";
hash = "sha256-ZVcbOKBqjDnCo2pZKjaAuO3MK7r/S6k4kEHwBteHVGg=";
};
patches = [
@@ -33,9 +56,12 @@ buildNpmPackage (finalAttrs: {
./turbo.json.patch
];
npmDepsHash = "sha256-ZddRSBDasa3mMAS2dqXgXRMOc1nvspdXsuTZ7c+einw=";
npmDepsHash = "sha256-/Jt1ct/GSumu/pgTrmnVHdMhhg8J2Epvu7wnnCakqGs=";
npmDepsFetcherVersion = 2;
nativeBuildInputs = [
autoPatchelfHook
gzip
pkg-config
vips
node-gyp
@@ -47,9 +73,12 @@ buildNpmPackage (finalAttrs: {
pixman
cairo
pango
stdenv.cc.cc.lib
vips
];
npmRebuildFlags = [ "--ignore-scripts" ];
env = {
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
PRISMA_QUERY_ENGINE_LIBRARY = "${lib.getLib prisma-engines_6}/lib/libquery_engine.node";
@@ -60,6 +89,13 @@ buildNpmPackage (finalAttrs: {
TURBO_REMOTE_CACHE_ENABLED = "false";
};
preBuild = ''
mkdir -p node_modules/skia-canvas/lib
gzip -dc ${skiaCanvasPrebuild} > node_modules/skia-canvas/lib/skia.node
npm exec patch-package
'';
buildPhase = ''
runHook preBuild
@@ -81,7 +117,7 @@ buildNpmPackage (finalAttrs: {
export PKG_CONFIG_PATH=${lib.getLib openssl.dev}/lib/pkgconfig;
export PRISMA_QUERY_ENGINE_LIBRARY=${lib.getLib prisma-engines_6}/lib/libquery_engine.node
export PRISMA_QUERY_ENGINE_BINARY=${lib.getExe' prisma-engines_6 "query-engine"}
export PRISMA_SCHEMA_ENGINE_BINARY=${prisma-engines_6}
export PRISMA_SCHEMA_ENGINE_BINARY=${lib.getExe' prisma-engines_6 "schema-engine"}
cd $out/apps/remix
${lib.getExe prisma_6} migrate deploy --schema ../../packages/prisma/schema.prisma
${lib.getExe nodejs} build/server/main.js
@@ -91,6 +127,14 @@ buildNpmPackage (finalAttrs: {
runHook postInstall
'';
postInstall = ''
# These optional prebuilds are for musl libc and can make autoPatchelf link
# glibc addons against incompatible vendored libraries.
rm -rf $out/node_modules/*musl* $out/node_modules/@*/*musl*
rm -rf $out/node_modules/@datadog/pprof/prebuilds/linuxmusl-*
rm -rf $out/node_modules/aws-crt/dist/bin/linux-*-musl
'';
# cleanup dangling symlinks for workspaces
preFixup = ''
rm -Rf $out/lib/node_modules/@documenso/root/node_modules/@documenso/assets
@@ -118,7 +162,10 @@ buildNpmPackage (finalAttrs: {
homepage = "https://github.com/documenso/documenso";
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [ happysalada ];
platforms = lib.platforms.unix;
platforms = [
"x86_64-linux"
"aarch64-linux"
];
mainProgram = "documenso";
};
})
+10 -94
View File
@@ -1,104 +1,20 @@
diff --git a/turbo.json b/turbo.json
index d767b46..b2d1ad3 100644
index c5c0db0..8c79030 100644
--- a/turbo.json
+++ b/turbo.json
@@ -1,41 +1,8 @@
@@ -1,6 +1,6 @@
{
"$schema": "https://turbo.build/schema.json",
- "pipeline": {
- "build": {
- "dependsOn": ["prebuild", "^build"],
- "outputs": [".next/**", "!.next/cache/**"]
- },
- "prebuild": {
- "cache": false,
- "dependsOn": ["^prebuild"]
- },
- "lint": {
- "cache": false
- },
- "lint:fix": {
- "cache": false
- },
- "clean": {
- "cache": false
- },
- "dev": {
- "cache": false,
- "persistent": true
- },
- "start": {
- "dependsOn": ["^build"],
- "cache": false,
- "persistent": true
- },
- "dev:test": {
- "cache": false
- },
- "test:e2e": {
- "dependsOn": ["^build"],
- "cache": false
- }
- },
- "globalDependencies": ["**/.env.*local"],
+ "globalDependencies": [
+ "**/.env.*local"
+ ],
"globalEnv": [
"APP_VERSION",
"NEXT_PRIVATE_ENCRYPTION_KEY",
@@ -119,5 +86,53 @@
"E2E_TEST_AUTHENTICATE_USERNAME",
"E2E_TEST_AUTHENTICATE_USER_EMAIL",
"E2E_TEST_AUTHENTICATE_USER_PASSWORD"
+ "tasks": {
"build": {
"dependsOn": ["prebuild", "^build"],
"outputs": [".next/**", "!.next/cache/**"]
@@ -152,5 +152,6 @@
"NEXT_PRIVATE_WEBHOOK_SSRF_BYPASS_HOSTS",
"NEXT_PUBLIC_TURNSTILE_SITE_KEY",
"NEXT_PRIVATE_TURNSTILE_SECRET_KEY"
- ]
+ ],
+ "tasks": {
+ "build": {
+ "dependsOn": [
+ "prebuild",
+ "^build"
+ ],
+ "outputs": [
+ ".next/**",
+ "!.next/cache/**"
+ ]
+ },
+ "prebuild": {
+ "cache": false,
+ "dependsOn": [
+ "^prebuild"
+ ]
+ },
+ "lint": {
+ "cache": false
+ },
+ "lint:fix": {
+ "cache": false
+ },
+ "clean": {
+ "cache": false
+ },
+ "dev": {
+ "cache": false,
+ "persistent": true
+ },
+ "start": {
+ "dependsOn": [
+ "^build"
+ ],
+ "cache": false,
+ "persistent": true
+ },
+ "dev:test": {
+ "cache": false
+ },
+ "test:e2e": {
+ "dependsOn": [
+ "^build"
+ ],
+ "cache": false
+ }
+ },
+ "envMode": "loose"
}
@@ -1,55 +1,116 @@
#!/usr/bin/env bash
CMDS=();DESC=();NARGS=$#;ARG1=$1;make_command(){ CMDS+=($1);DESC+=("$2");};usage(){ printf "\nUsage: %s [command]\n\nCommands:\n" $0;line=" ";for((i=0;i<=$(( ${#CMDS[*]} -1));i++));do printf " %s %s ${DESC[$i]}\n" ${CMDS[$i]} "${line:${#CMDS[$i]}}";done;echo;};runme(){ if test $NARGS -eq 1;then eval "$ARG1"||usage;else usage;fi;}
set -euo pipefail
version="1.12.6";
version="2.14.0"
make_command "about" "About this update script."
about(){
echo "Documenso upstream needs some fixing before it can be build in a pure sandbox"
echo "environment. This script does the following:"
usage() {
printf "Usage: %s {about|update} [version]\n" "$0"
}
about() {
echo "Documenso upstream needs some fixing before it can be built in a pure sandbox"
echo "environment. This script regenerates the JSON patches for a version bump:"
echo " - download documenso version ${version} from github in a temp dir"
echo " - uninstall inngest-cli which runs a binary download script at build time."
echo " - upgrade turborepo as the older upstream version 'phones home' at build time."
echo " - update the turbo.json to make it work with preset environment vars"
echo " - fix the lockfile by generating missing hash signatures"
echo " - remove inngest-cli which runs a binary download script at build time"
echo " - upgrade turborepo because the older upstream version phones home at build time"
echo " - update turbo.json for the newer turborepo config"
echo " - fix package-lock.json metadata needed by npmDepsFetcherVersion = 2"
echo " - create patches from changed json files"
}
make_command "update" "Get upstream and prepatch."
update(){
patch_sources() {
node <<'NODE'
const fs = require('fs');
const packageJsonPath = 'package.json';
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
delete packageJson.devDependencies['inngest-cli'];
packageJson.devDependencies.turbo = '^2.10.1';
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
const turboJsonPath = 'turbo.json';
let turboJson = fs.readFileSync(turboJsonPath, 'utf8');
turboJson = turboJson.replace(' "pipeline": {', ' "tasks": {');
if (!turboJson.includes(' "envMode": "loose"')) {
turboJson = turboJson.replace('\n ]\n}\n', '\n ],\n "envMode": "loose"\n}\n');
}
fs.writeFileSync(turboJsonPath, turboJson);
NODE
}
fix_playwright_lockfile_metadata() {
local package_key="packages/app-tests/node_modules/@playwright/test"
local playwright_version resolved integrity
playwright_version=$(jq -r --arg key "$package_key" '.packages[$key].version // empty' package-lock.json)
if [[ -z "$playwright_version" ]]; then
return
fi
resolved=$(npm view "@playwright/test@${playwright_version}" dist.tarball)
integrity=$(npm view "@playwright/test@${playwright_version}" dist.integrity)
node - "$package_key" "$resolved" "$integrity" <<'NODE'
const fs = require('fs');
const [packageKey, resolved, integrity] = process.argv.slice(2);
const path = 'package-lock.json';
const lockfile = JSON.parse(fs.readFileSync(path, 'utf8'));
const packageEntry = lockfile.packages[packageKey];
const updated = {};
for (const [key, value] of Object.entries(packageEntry)) {
updated[key] = value;
if (key === 'version') {
updated.resolved = resolved;
updated.integrity = integrity;
}
}
lockfile.packages[packageKey] = updated;
fs.writeFileSync(path, `${JSON.stringify(lockfile, null, 2)}\n`);
NODE
}
update() {
local update_version=${1:-$version}
local current_nixpkgs_dir temptarfile tempdir
echo "updating documenso for nixpkgs packaging"
current_nixpkgs_dir=${PWD}
temptarfile=/tmp/documenso-v${version}.tar.gz
tempdir=/tmp/documenso-v${version}
temptarfile="/tmp/documenso-v${update_version}.tar.gz"
tempdir="/tmp/documenso-v${update_version}"
if [ ! -f "$temptarfile" ]; then
echo "Tarball does not exist; downloading from github.";
wget https://github.com/documenso/documenso/archive/refs/tags/v${version}.tar.gz -O $temptarfile
if [[ ! -f "$temptarfile" ]]; then
echo "Tarball does not exist; downloading from github."
wget "https://github.com/documenso/documenso/archive/refs/tags/v${update_version}.tar.gz" -O "$temptarfile"
fi
rm -Rf $tempdir
mkdir $tempdir
tar -xzvf /tmp/documenso-v${version}.tar.gz -C $tempdir --strip-components=1
cd $tempdir
rm -Rf "$tempdir"
mkdir "$tempdir"
tar -xzf "$temptarfile" -C "$tempdir" --strip-components=1
cd "$tempdir"
git init
git add package-lock.json package.json turbo.json
git commit -m "commit4diff" package-lock.json package.json turbo.json
echo "rm inngest-cli from root"
npm uninstall inngest-cli
patch_sources
npm install --package-lock-only --ignore-scripts --no-audit --no-fund
fix_playwright_lockfile_metadata
npx @turbo/codemod migrate . --force
jq '.envMode="loose"' turbo.json > turbo-patched.json
cp turbo-patched.json turbo.json
echo "fix package-lock.json hashes"
nix run nixpkgs#npm-lockfile-fix -- package-lock.json
git diff package-lock.json > $current_nixpkgs_dir/package-lock.json.patch
git diff package.json > $current_nixpkgs_dir/package.json.patch
git diff turbo.json > $current_nixpkgs_dir/turbo.json.patch
git diff --src-prefix=a/ --dst-prefix=b/ -- package-lock.json > "$current_nixpkgs_dir/package-lock.json.patch"
git diff --src-prefix=a/ --dst-prefix=b/ -- package.json > "$current_nixpkgs_dir/package.json.patch"
git diff --src-prefix=a/ --dst-prefix=b/ -- turbo.json > "$current_nixpkgs_dir/turbo.json.patch"
}
runme
case "${1:-}" in
about)
about
;;
update)
shift
update "${1:-}"
;;
*)
usage
exit 1
;;
esac