Skip to content

Commit 8b4fe69

Browse files
committed
$mol_build meta override url
1 parent 35a008f commit 8b4fe69

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

build/ensure/vcs/vcs.ts

+15-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ namespace $ {
1717
return null as $mol_tree2 | null
1818
}
1919

20+
@ $mol_mem
21+
overrides() {
22+
const overrides = this.meta(this.root().path())
23+
return overrides?.select('override')?.kids
24+
?.map(
25+
item => (item.kids?.[0].value?.split(' ') ?? []) as [string, string]
26+
) ?? []
27+
}
28+
2029
@ $mol_mem_key
2130
protected repo( path : string ) {
2231
const vcs_type = this.vcs_type()
@@ -29,11 +38,15 @@ namespace $ {
2938
const parent = mod.parent()
3039
const mapping = this.meta( parent.path() )
3140

41+
3242
const url_branch = mapping?.select( 'pack' , mod.name(), vcs_type).kids
3343
.find($mol_guard_defined)?.kids[0]
34-
35-
const url = url_branch?.value ?? null
44+
45+
let url = url_branch?.value ?? null
3646
const branch = url_branch?.kids[0]?.value ?? null
47+
48+
const parts = this.overrides().find(([from, to]) => url?.startsWith(from))
49+
if (url && parts) url = parts[1] + url.slice(parts[0].length)
3750

3851
return url ? { url, branch } : null
3952
}

0 commit comments

Comments
 (0)