From ed5391117844d7a460511cd2b25fd564d1264060 Mon Sep 17 00:00:00 2001 From: Myx Date: Sun, 12 Apr 2026 17:34:35 +0200 Subject: [PATCH] ci: attempt to fix --- .gitea/workflows/release-draft.yml | 30 ++++++++++++------- package.json | 6 +++- .../1000000000002-ServerChannels.ts | 6 +++- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/release-draft.yml b/.gitea/workflows/release-draft.yml index 8c6d144..e685f45 100644 --- a/.gitea/workflows/release-draft.yml +++ b/.gitea/workflows/release-draft.yml @@ -184,23 +184,33 @@ jobs: # because their resolved path sits outside the package root. New-Item -ItemType Directory -Path $electronBuilderWorkspace | Out-Null - # Point electron-builder at the Electron binary already present - # in the main workspace so the packaging workspace can skip it. - $env:ELECTRON_OVERRIDE_DIST_PATH = Join-Path $projectRoot 'node_modules\electron\dist' - try { - Copy-Item -Path (Join-Path $projectRoot 'package.json') -Destination (Join-Path $electronBuilderWorkspace 'package.json') -Force - Copy-Item -Path (Join-Path $projectRoot 'package-lock.json') -Destination (Join-Path $electronBuilderWorkspace 'package-lock.json') -Force + # Write a trimmed package.json listing only electron main-process + # runtime deps. electron-builder v26 runs `npm ls` to build the + # dep graph — if it sees Angular/mermaid/etc. it tries to resolve + # them, fails, and crashes with "dependency path is undefined". + $trimmedPkgPath = Join-Path $electronBuilderWorkspace 'package.json' + node -e "var p=require('./package.json'),k='auto-launch electron-updater reflect-metadata sql.js typeorm uuid tslib'.split(' '),d={};k.forEach(function(n){if(p.dependencies[n])d[n]=p.dependencies[n]});p.dependencies=d;p.devDependencies={};require('fs').writeFileSync(process.argv[1],JSON.stringify(p,null,2))" "$trimmedPkgPath" + Invoke-RoboCopy (Join-Path $projectRoot 'dist') (Join-Path $electronBuilderWorkspace 'dist') Invoke-RoboCopy (Join-Path $projectRoot 'images') (Join-Path $electronBuilderWorkspace 'images') Push-Location $electronBuilderWorkspace $locationPushed = $true - # Install only production dependencies — much faster than - # mirroring the full node_modules tree via robocopy and also - # avoids the junction/symlink issues that require the temp workspace. - npm ci --omit=dev --ignore-scripts + # Install only the 7 runtime deps + their transitive closure (~50 MB). + # This gives electron-builder a clean, complete dep tree so its + # NpmNodeModulesCollector won't hit missing-path errors. + npm install --ignore-scripts 2>&1 | Select-String -NotMatch '^npm warn' + + # electron-builder needs the electron package to read the version, + # but npm install won't fetch it (not in trimmed deps). Copy just + # the package.json so it can resolve the version string, and point + # ELECTRON_OVERRIDE_DIST_PATH at the real binary in the main tree. + $destElectron = Join-Path $electronBuilderWorkspace 'node_modules\electron' + New-Item -ItemType Directory -Path $destElectron -Force | Out-Null + Copy-Item -Path (Join-Path $projectRoot 'node_modules\electron\package.json') -Destination (Join-Path $destElectron 'package.json') -Force + $env:ELECTRON_OVERRIDE_DIST_PATH = Join-Path $projectRoot 'node_modules\electron\dist' $electronBuilderBin = Join-Path $projectRoot 'node_modules\.bin\electron-builder.cmd' & $electronBuilderBin --win --publish never diff --git a/package.json b/package.json index 1a67b36..a00be6f 100644 --- a/package.json +++ b/package.json @@ -146,9 +146,13 @@ "output": "dist-electron" }, "files": [ + "!node_modules", "dist/client/**/*", "dist/electron/**/*", - "node_modules/**/*", + "node_modules/{ansi-regex,ansi-styles,ansis,app-root-path,applescript,argparse,auto-launch,available-typed-arrays,balanced-match,base64-js,brace-expansion,buffer,builder-util-runtime,call-bind,call-bind-apply-helpers,call-bound,cliui,concat-map,cross-spawn,dayjs,debug,dedent,define-data-property,dotenv,dunder-proto,electron-updater,emoji-regex,es-define-property,es-errors,es-object-atoms,escalade,for-each,foreground-child,fs-extra,function-bind,get-caller-file,get-east-asian-width,get-intrinsic,get-proto,glob,gopd,graceful-fs,has-property-descriptors,has-symbols,has-tostringtag,hasown,ieee754,inherits,is-callable,is-fullwidth-code-point,is-typed-array,isarray,isexe,jackspeak,js-yaml,jsonfile,lazy-val,lodash.escaperegexp,lodash.isequal,lru-cache,math-intrinsics,minimatch,minimist,minipass,mkdirp,ms,package-json-from-dist,path-is-absolute,path-key,path-scurry,possible-typed-array-names,reflect-metadata,safe-buffer,sax,semver,set-function-length,sha.js,shebang-command,shebang-regex,signal-exit,sql-highlight,sql.js,string-width,string-width-cjs,strip-ansi,strip-ansi-cjs,tiny-typed-emitter,to-buffer,tslib,typed-array-buffer,typeorm,universalify,untildify,uuid,which,which-typed-array,winreg,wrap-ansi,wrap-ansi-cjs,y18n,yallist,yargs,yargs-parser}/**/*", + "node_modules/@isaacs/cliui/**/*", + "node_modules/@pkgjs/parseargs/**/*", + "node_modules/@sqltools/formatter/**/*", "!node_modules/**/test/**/*", "!node_modules/**/tests/**/*", "!node_modules/**/*.d.ts", diff --git a/server/src/migrations/1000000000002-ServerChannels.ts b/server/src/migrations/1000000000002-ServerChannels.ts index fba903c..c5aebc6 100644 --- a/server/src/migrations/1000000000002-ServerChannels.ts +++ b/server/src/migrations/1000000000002-ServerChannels.ts @@ -4,7 +4,11 @@ export class ServerChannels1000000000002 implements MigrationInterface { name = 'ServerChannels1000000000002'; public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "servers" ADD COLUMN "channels" TEXT NOT NULL DEFAULT '[]'`); + const columns: { name: string }[] = await queryRunner.query(`PRAGMA table_info("servers")`); + const hasChannels = columns.some(c => c.name === 'channels'); + if (!hasChannels) { + await queryRunner.query(`ALTER TABLE "servers" ADD COLUMN "channels" TEXT NOT NULL DEFAULT '[]'`); + } } public async down(queryRunner: QueryRunner): Promise {