From 006c222cc596984a5d62d11103063b48d090709d Mon Sep 17 00:00:00 2001 From: Alois Date: Fri, 1 May 2026 15:24:04 +0200 Subject: [PATCH] (feat): improve builds (fix): duplicates in license copy script --- apps/tauri/src-tauri/src/lib.rs | 4 +- licenses/THIRD_PARTY_NOTICES.md | 69 --------- licenses/sbom.cyclonedx.json | 243 +----------------------------- licenses/third-party-credits.json | 95 +----------- package.json | 5 +- scripts/copy-licenses.ts | 37 ++++- 6 files changed, 40 insertions(+), 413 deletions(-) diff --git a/apps/tauri/src-tauri/src/lib.rs b/apps/tauri/src-tauri/src/lib.rs index 926ace0..66e9c06 100644 --- a/apps/tauri/src-tauri/src/lib.rs +++ b/apps/tauri/src-tauri/src/lib.rs @@ -207,12 +207,12 @@ pub fn run() { let builder = builder.plugin(tauri_plugin_barcode_scanner::init()); builder - .setup(|app| { + .setup(|_app| { #[cfg(any(target_os = "linux", windows))] { use tauri_plugin_deep_link::DeepLinkExt; - if let Err(error) = app.deep_link().register_all() { + if let Err(error) = _app.deep_link().register_all() { if cfg!(debug_assertions) { eprintln!("Skipping deep link registration during dev: {error}"); } else { diff --git a/licenses/THIRD_PARTY_NOTICES.md b/licenses/THIRD_PARTY_NOTICES.md index 6a51341..a66397f 100644 --- a/licenses/THIRD_PARTY_NOTICES.md +++ b/licenses/THIRD_PARTY_NOTICES.md @@ -76,16 +76,6 @@ Generated from bun.lock and installed packages in workspace node_modules folders - Folder: `licenses/@noble_curves@2.0.1` - Source package dir: `apps/web/node_modules/@noble/curves` -## @noble/curves@2.0.1 - -- License: MIT -- Homepage: https://paulmillr.com/noble/ -- Repository: git+https://github.com/paulmillr/noble-curves.git -- Description: Audited & minimal JS implementation of elliptic curve cryptography -- Included files: LICENSE -- Folder: `licenses/@noble_curves@2.0.1` -- Source package dir: `apps/web/node_modules/@noble/curves` - ## @tailwindcss/vite@4.2.2 - License: MIT @@ -351,16 +341,6 @@ Generated from bun.lock and installed packages in workspace node_modules folders - Folder: `licenses/lucide-react@1.8.0` - Source package dir: `apps/tauri/node_modules/lucide-react` -## lucide-react@1.8.0 - -- License: ISC -- Homepage: https://lucide.dev -- Repository: https://github.com/lucide-icons/lucide.git -- Description: A Lucide icon library package for React applications. -- Included files: LICENSE -- Folder: `licenses/lucide-react@1.8.0` -- Source package dir: `apps/tauri/node_modules/lucide-react` - ## prettier@3.8.2 - License: MIT @@ -411,16 +391,6 @@ Generated from bun.lock and installed packages in workspace node_modules folders - Folder: `licenses/recharts@3.8.1` - Source package dir: `packages/call/node_modules/recharts` -## recharts@3.8.1 - -- License: MIT -- Homepage: https://github.com/recharts/recharts -- Repository: git+https://github.com/recharts/recharts.git -- Description: React charts -- Included files: LICENSE -- Folder: `licenses/recharts@3.8.1` -- Source package dir: `packages/call/node_modules/recharts` - ## shadcn@4.2.0 - License: MIT @@ -430,25 +400,6 @@ Generated from bun.lock and installed packages in workspace node_modules folders - Folder: `licenses/shadcn@4.2.0` - Source package dir: `apps/web/node_modules/shadcn` -## shadcn@4.2.0 - -- License: MIT -- Repository: https://github.com/shadcn-ui/ui.git -- Description: Add components to your apps. -- Included files: LICENSE.md -- Folder: `licenses/shadcn@4.2.0` -- Source package dir: `apps/web/node_modules/shadcn` - -## sonner@1.7.4 - -- License: MIT -- Homepage: https://sonner.emilkowal.ski/ -- Repository: git+https://github.com/emilkowalski/sonner.git -- Description: An opinionated toast component for React. -- Included files: LICENSE.md -- Folder: `licenses/sonner@1.7.4` -- Source package dir: `apps/web/node_modules/sonner` - ## sonner@1.7.4 - License: MIT @@ -509,16 +460,6 @@ Generated from bun.lock and installed packages in workspace node_modules folders - Folder: `licenses/typescript@5.9.3` - Source package dir: `apps/web/node_modules/typescript` -## typescript@5.9.3 - -- License: Apache-2.0 -- Homepage: https://www.typescriptlang.org/ -- Repository: https://github.com/microsoft/TypeScript.git -- Description: TypeScript is a language for application scale JavaScript development -- Included files: LICENSE.txt -- Folder: `licenses/typescript@5.9.3` -- Source package dir: `apps/web/node_modules/typescript` - ## typescript-eslint@8.58.1 - License: MIT @@ -558,16 +499,6 @@ Generated from bun.lock and installed packages in workspace node_modules folders - Folder: `licenses/zod@4.3.6` - Source package dir: `apps/web/node_modules/zod` -## zod@4.3.6 - -- License: MIT -- Homepage: https://zod.dev -- Repository: git+https://github.com/colinhacks/zod.git -- Description: TypeScript-first schema declaration and validation library with static type inference -- Included files: LICENSE -- Folder: `licenses/zod@4.3.6` -- Source package dir: `apps/web/node_modules/zod` - ## zustand@5.0.12 - License: MIT diff --git a/licenses/sbom.cyclonedx.json b/licenses/sbom.cyclonedx.json index 9d774d4..b3ab1b7 100644 --- a/licenses/sbom.cyclonedx.json +++ b/licenses/sbom.cyclonedx.json @@ -3,7 +3,7 @@ "specVersion": "1.5", "version": 1, "metadata": { - "timestamp": "2026-04-30T20:51:14.827Z", + "timestamp": "2026-05-01T13:23:05.336Z", "tools": [ { "vendor": "OpenAI", @@ -275,41 +275,6 @@ } ] }, - { - "type": "library", - "bomRef": "pkg:npm/%40noble/curves@2.0.1", - "name": "@noble/curves", - "version": "2.0.1", - "purl": "pkg:npm/%40noble/curves@2.0.1", - "description": "Audited & minimal JS implementation of elliptic curve cryptography", - "licenses": [ - { - "license": { - "id": "MIT" - } - } - ], - "externalReferences": [ - { - "type": "website", - "url": "https://paulmillr.com/noble/" - }, - { - "type": "vcs", - "url": "git+https://github.com/paulmillr/noble-curves.git" - } - ], - "properties": [ - { - "name": "local:licenseFolder", - "value": "licenses/@noble_curves@2.0.1" - }, - { - "name": "local:sourcePackageDir", - "value": "apps/web/node_modules/@noble/curves" - } - ] - }, { "type": "library", "bomRef": "pkg:npm/%40tailwindcss/vite@4.2.2", @@ -1220,41 +1185,6 @@ } ] }, - { - "type": "library", - "bomRef": "pkg:npm/lucide-react@1.8.0", - "name": "lucide-react", - "version": "1.8.0", - "purl": "pkg:npm/lucide-react@1.8.0", - "description": "A Lucide icon library package for React applications.", - "licenses": [ - { - "license": { - "id": "ISC" - } - } - ], - "externalReferences": [ - { - "type": "website", - "url": "https://lucide.dev" - }, - { - "type": "vcs", - "url": "https://github.com/lucide-icons/lucide.git" - } - ], - "properties": [ - { - "name": "local:licenseFolder", - "value": "licenses/lucide-react@1.8.0" - }, - { - "name": "local:sourcePackageDir", - "value": "apps/tauri/node_modules/lucide-react" - } - ] - }, { "type": "library", "bomRef": "pkg:npm/prettier@3.8.2", @@ -1430,41 +1360,6 @@ } ] }, - { - "type": "library", - "bomRef": "pkg:npm/recharts@3.8.1", - "name": "recharts", - "version": "3.8.1", - "purl": "pkg:npm/recharts@3.8.1", - "description": "React charts", - "licenses": [ - { - "license": { - "id": "MIT" - } - } - ], - "externalReferences": [ - { - "type": "website", - "url": "https://github.com/recharts/recharts" - }, - { - "type": "vcs", - "url": "git+https://github.com/recharts/recharts.git" - } - ], - "properties": [ - { - "name": "local:licenseFolder", - "value": "licenses/recharts@3.8.1" - }, - { - "name": "local:sourcePackageDir", - "value": "packages/call/node_modules/recharts" - } - ] - }, { "type": "library", "bomRef": "pkg:npm/shadcn@4.2.0", @@ -1496,72 +1391,6 @@ } ] }, - { - "type": "library", - "bomRef": "pkg:npm/shadcn@4.2.0", - "name": "shadcn", - "version": "4.2.0", - "purl": "pkg:npm/shadcn@4.2.0", - "description": "Add components to your apps.", - "licenses": [ - { - "license": { - "id": "MIT" - } - } - ], - "externalReferences": [ - { - "type": "vcs", - "url": "https://github.com/shadcn-ui/ui.git" - } - ], - "properties": [ - { - "name": "local:licenseFolder", - "value": "licenses/shadcn@4.2.0" - }, - { - "name": "local:sourcePackageDir", - "value": "apps/web/node_modules/shadcn" - } - ] - }, - { - "type": "library", - "bomRef": "pkg:npm/sonner@1.7.4", - "name": "sonner", - "version": "1.7.4", - "purl": "pkg:npm/sonner@1.7.4", - "description": "An opinionated toast component for React.", - "licenses": [ - { - "license": { - "id": "MIT" - } - } - ], - "externalReferences": [ - { - "type": "website", - "url": "https://sonner.emilkowal.ski/" - }, - { - "type": "vcs", - "url": "git+https://github.com/emilkowalski/sonner.git" - } - ], - "properties": [ - { - "name": "local:licenseFolder", - "value": "licenses/sonner@1.7.4" - }, - { - "name": "local:sourcePackageDir", - "value": "apps/web/node_modules/sonner" - } - ] - }, { "type": "library", "bomRef": "pkg:npm/sonner@1.7.4", @@ -1772,41 +1601,6 @@ } ] }, - { - "type": "library", - "bomRef": "pkg:npm/typescript@5.9.3", - "name": "typescript", - "version": "5.9.3", - "purl": "pkg:npm/typescript@5.9.3", - "description": "TypeScript is a language for application scale JavaScript development", - "licenses": [ - { - "license": { - "id": "Apache-2.0" - } - } - ], - "externalReferences": [ - { - "type": "website", - "url": "https://www.typescriptlang.org/" - }, - { - "type": "vcs", - "url": "https://github.com/microsoft/TypeScript.git" - } - ], - "properties": [ - { - "name": "local:licenseFolder", - "value": "licenses/typescript@5.9.3" - }, - { - "name": "local:sourcePackageDir", - "value": "apps/web/node_modules/typescript" - } - ] - }, { "type": "library", "bomRef": "pkg:npm/typescript-eslint@8.58.1", @@ -1943,41 +1737,6 @@ } ] }, - { - "type": "library", - "bomRef": "pkg:npm/zod@4.3.6", - "name": "zod", - "version": "4.3.6", - "purl": "pkg:npm/zod@4.3.6", - "description": "TypeScript-first schema declaration and validation library with static type inference", - "licenses": [ - { - "license": { - "id": "MIT" - } - } - ], - "externalReferences": [ - { - "type": "website", - "url": "https://zod.dev" - }, - { - "type": "vcs", - "url": "git+https://github.com/colinhacks/zod.git" - } - ], - "properties": [ - { - "name": "local:licenseFolder", - "value": "licenses/zod@4.3.6" - }, - { - "name": "local:sourcePackageDir", - "value": "apps/web/node_modules/zod" - } - ] - }, { "type": "library", "bomRef": "pkg:npm/zustand@5.0.12", diff --git a/licenses/third-party-credits.json b/licenses/third-party-credits.json index eb5caa6..8079462 100644 --- a/licenses/third-party-credits.json +++ b/licenses/third-party-credits.json @@ -1,6 +1,6 @@ { - "generatedAt": "2026-04-30T20:51:14.826Z", - "packageCount": 60, + "generatedAt": "2026-05-01T13:23:05.335Z", + "packageCount": 53, "packages": [ { "name": "@codemirror/commands", @@ -106,19 +106,6 @@ "licenseFolder": "licenses/@noble_curves@2.0.1", "sourcePackageDir": "apps/web/node_modules/@noble/curves" }, - { - "name": "@noble/curves", - "version": "2.0.1", - "license": "MIT", - "homepage": "https://paulmillr.com/noble/", - "repository": "git+https://github.com/paulmillr/noble-curves.git", - "description": "Audited & minimal JS implementation of elliptic curve cryptography", - "files": [ - "LICENSE" - ], - "licenseFolder": "licenses/@noble_curves@2.0.1", - "sourcePackageDir": "apps/web/node_modules/@noble/curves" - }, { "name": "@tailwindcss/vite", "version": "4.2.2", @@ -484,19 +471,6 @@ "licenseFolder": "licenses/lucide-react@1.8.0", "sourcePackageDir": "apps/tauri/node_modules/lucide-react" }, - { - "name": "lucide-react", - "version": "1.8.0", - "license": "ISC", - "homepage": "https://lucide.dev", - "repository": "https://github.com/lucide-icons/lucide.git", - "description": "A Lucide icon library package for React applications.", - "files": [ - "LICENSE" - ], - "licenseFolder": "licenses/lucide-react@1.8.0", - "sourcePackageDir": "apps/tauri/node_modules/lucide-react" - }, { "name": "prettier", "version": "3.8.2", @@ -562,19 +536,6 @@ "licenseFolder": "licenses/recharts@3.8.1", "sourcePackageDir": "packages/call/node_modules/recharts" }, - { - "name": "recharts", - "version": "3.8.1", - "license": "MIT", - "homepage": "https://github.com/recharts/recharts", - "repository": "git+https://github.com/recharts/recharts.git", - "description": "React charts", - "files": [ - "LICENSE" - ], - "licenseFolder": "licenses/recharts@3.8.1", - "sourcePackageDir": "packages/call/node_modules/recharts" - }, { "name": "shadcn", "version": "4.2.0", @@ -588,32 +549,6 @@ "licenseFolder": "licenses/shadcn@4.2.0", "sourcePackageDir": "apps/web/node_modules/shadcn" }, - { - "name": "shadcn", - "version": "4.2.0", - "license": "MIT", - "homepage": null, - "repository": "https://github.com/shadcn-ui/ui.git", - "description": "Add components to your apps.", - "files": [ - "LICENSE.md" - ], - "licenseFolder": "licenses/shadcn@4.2.0", - "sourcePackageDir": "apps/web/node_modules/shadcn" - }, - { - "name": "sonner", - "version": "1.7.4", - "license": "MIT", - "homepage": "https://sonner.emilkowal.ski/", - "repository": "git+https://github.com/emilkowalski/sonner.git", - "description": "An opinionated toast component for React.", - "files": [ - "LICENSE.md" - ], - "licenseFolder": "licenses/sonner@1.7.4", - "sourcePackageDir": "apps/web/node_modules/sonner" - }, { "name": "sonner", "version": "1.7.4", @@ -692,19 +627,6 @@ "licenseFolder": "licenses/typescript@5.9.3", "sourcePackageDir": "apps/web/node_modules/typescript" }, - { - "name": "typescript", - "version": "5.9.3", - "license": "Apache-2.0", - "homepage": "https://www.typescriptlang.org/", - "repository": "https://github.com/microsoft/TypeScript.git", - "description": "TypeScript is a language for application scale JavaScript development", - "files": [ - "LICENSE.txt" - ], - "licenseFolder": "licenses/typescript@5.9.3", - "sourcePackageDir": "apps/web/node_modules/typescript" - }, { "name": "typescript-eslint", "version": "8.58.1", @@ -757,19 +679,6 @@ "licenseFolder": "licenses/zod@4.3.6", "sourcePackageDir": "apps/web/node_modules/zod" }, - { - "name": "zod", - "version": "4.3.6", - "license": "MIT", - "homepage": "https://zod.dev", - "repository": "git+https://github.com/colinhacks/zod.git", - "description": "TypeScript-first schema declaration and validation library with static type inference", - "files": [ - "LICENSE" - ], - "licenseFolder": "licenses/zod@4.3.6", - "sourcePackageDir": "apps/web/node_modules/zod" - }, { "name": "zustand", "version": "5.0.12", diff --git a/package.json b/package.json index 53a31ac..66dc7c2 100644 --- a/package.json +++ b/package.json @@ -12,10 +12,11 @@ "lint": "bun scripts/lint-packages.ts", "copy-licenses": "bun scripts/copy-licenses.ts", "copy-releases": "bun scripts/copy-releases.ts", - "build:all": "bun run copy-licenses && bun run lint && bun run build:packages && bun run build:web && bun run build:mobile && bun run build:desktop && bun --bun run copy-releases", + "pre-build": "bun run lint && bun run build:packages", + "build:apps": "bun run copy-licenses && bun run pre-build && bun run build:mobile && bun run build:desktop && bun --bun run copy-releases", "build:packages": "bun scripts/build-packages.ts", "dev:web": "cd apps/web && bun dev", - "build:web": "bun run build:packages && cd apps/web && bun run build", + "build:web": "cd apps/web && bun run build", "preview:web": "cd apps/web && bun run preview", "dev:mobile": "cd apps/tauri && bun dev:mobile", "build:mobile": "cd apps/tauri && bun run build:mobile", diff --git a/scripts/copy-licenses.ts b/scripts/copy-licenses.ts index f22b111..eb8886b 100644 --- a/scripts/copy-licenses.ts +++ b/scripts/copy-licenses.ts @@ -78,18 +78,20 @@ async function main(): Promise { } } - records.sort((a, b) => { + const uniqueRecords = dedupePackageRecords(records); + + uniqueRecords.sort((a, b) => { const byName = a.name.localeCompare(b.name); if (byName !== 0) return byName; return a.version.localeCompare(b.version); }); - await writeThirdPartyNotices(records); - await writeCreditsJson(records); - await writeCycloneDxSbom(records); + await writeThirdPartyNotices(uniqueRecords); + await writeCreditsJson(uniqueRecords); + await writeCycloneDxSbom(uniqueRecords); console.log( - `Generated ${records.length} third-party package records in ${OUTPUT_DIR}`, + `Generated ${uniqueRecords.length} third-party package records in ${OUTPUT_DIR}`, ); } @@ -458,6 +460,31 @@ async function writeCycloneDxSbom(records: PackageRecord[]): Promise { ); } +function dedupePackageRecords(records: PackageRecord[]): PackageRecord[] { + const unique = new Map(); + + for (const record of records) { + const key = `${record.name}@${record.version}`; + const existing = unique.get(key); + + if (!existing) { + unique.set(key, record); + continue; + } + + unique.set(key, { + ...existing, + copiedFiles: [...new Set([...existing.copiedFiles, ...record.copiedFiles])], + license: existing.license ?? record.license, + description: existing.description ?? record.description, + homepage: existing.homepage ?? record.homepage, + repository: existing.repository ?? record.repository, + }); + } + + return [...unique.values()]; +} + function toCycloneDxLicenses( value: string | string[] | undefined, ): Array<{ license: { id?: string; name?: string } }> | undefined {