From 8b4fe69cc3c3da932685df228c74378fffce6af2 Mon Sep 17 00:00:00 2001 From: Stefan Zerkalica Date: Fri, 24 Jan 2025 15:17:07 +0300 Subject: [PATCH] $mol_build meta override url --- build/ensure/vcs/vcs.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/build/ensure/vcs/vcs.ts b/build/ensure/vcs/vcs.ts index 2865389d0a0..efb2a473da3 100644 --- a/build/ensure/vcs/vcs.ts +++ b/build/ensure/vcs/vcs.ts @@ -17,6 +17,15 @@ namespace $ { return null as $mol_tree2 | null } + @ $mol_mem + overrides() { + const overrides = this.meta(this.root().path()) + return overrides?.select('override')?.kids + ?.map( + item => (item.kids?.[0].value?.split(' ') ?? []) as [string, string] + ) ?? [] + } + @ $mol_mem_key protected repo( path : string ) { const vcs_type = this.vcs_type() @@ -29,11 +38,15 @@ namespace $ { const parent = mod.parent() const mapping = this.meta( parent.path() ) + const url_branch = mapping?.select( 'pack' , mod.name(), vcs_type).kids .find($mol_guard_defined)?.kids[0] - - const url = url_branch?.value ?? null + + let url = url_branch?.value ?? null const branch = url_branch?.kids[0]?.value ?? null + + const parts = this.overrides().find(([from, to]) => url?.startsWith(from)) + if (url && parts) url = parts[1] + url.slice(parts[0].length) return url ? { url, branch } : null }